Skip to content

Commit 9a266a7

Browse files
committed
update per review comments
1 parent 41db793 commit 9a266a7

4 files changed

Lines changed: 109 additions & 89 deletions
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Splunk Command and Scripting Interpreter Risky SPL MLTK Baseline
2+
id: 273df2f7-643a-451a-8d4d-637e39eadc87
3+
version: 1
4+
date: '2022-05-27'
5+
author: Abhinav Mishra, Kumar Sharad and Xiao Lin, Splunk
6+
type: Baseline
7+
datamodel:
8+
- Splunk_Audit
9+
description: 'This search is to build a per user command and scripting risky SPL detection model using MLTK
10+
DensityFunction algorithm based on audit log data of Splunk apps. The model is built from past 7 days users
11+
history of running search commands from
12+
https://docs.splunk.com/Documentation/Splunk/latest/Security/SPLsafeguards#Commands_that_trigger_the_warninga,
13+
and aggregate the total search run time for each hour as indicator of user behavior. The default threshold of
14+
outlier boundary is defined as 0.1%, which means that the possibility of search run time exceeding that
15+
boundary is smaller than 0.1%. This search should be scheduled to run at least as frequently as every 7 days.
16+
The name of ML model generated is "risky_command_abuse" and should be configured to be globally shared (not
17+
private) in MLTK app as ducumented here:
18+
https://docs.splunk.com/Documentation/MLApp/5.3.1/User/Models#Sharing_models_from_other_Splunk_apps
19+
unless the same account of training this model will be used to perfeorm inference using this model for anomaly
20+
detection. '
21+
search: '| tstats values(Search_Activity.user) as user, sum(Search_Activity.total_run_time) as run_time count
22+
FROM datamodel=Splunk_Audit.Search_Activity WHERE (Search_Activity.user!="")
23+
AND (Search_Activity.total_run_time>1) AND (earliest=-7d@d latest=now)
24+
AND (Search_Activity.search IN ("*| runshellscript *", "*| collect *","*| delete *", "*| fit *", "*| outputcsv *",
25+
"*| outputlookup *", "*| run *", "*| script *", "*| sendalert *", "*| sendemail *", "*| tscollect *"))
26+
AND (Search_Activity.search_type=adhoc) AND (Search_Activity.user!=splunk-system-user)
27+
BY _time, Search_Activity.user span=1h
28+
| fit DensityFunction "run_time" dist=auto threshold=0.001 show_density=true by "user" into "risky_command_abuse" '
29+
how_to_implement: The corresponding detection of using this model is "Splunk Command and Scripting Interpreter Risky
30+
SPL MLTK". This detection depends on MLTK app which can be hound here - https://splunkbase.splunk.com/app/2890/
31+
and it assumes Splunk accelerated audit data model is available. For large enterprises, training the model might
32+
take significant computing resources. It might requires dedicated search head. The underlined machine learning
33+
algorithm this detection used is DensityFunction. It might need to incresase its settings default values, such as
34+
max_fit_time, max_groups, etc. More details of achieving optmal performance abd configuring DensityFunction
35+
parameters can be found here - https://docs.splunk.com/Documentation/MLApp/5.3.1/User/Configurefitandapply
36+
Users can modify earliest=-7d@d in the search to other value so that the search can collect enough data points
37+
to build a good bseline model. Users can also modify list of risky commands in "Search_Activity.search IN" to better
38+
suit users' violation policy and their usage environment.
39+
known_false_positives: If the run time of a search exceeds the boundaries of outlier defined by the fitted density
40+
function model, false positives can occur, incorrectly labeling a long running search as potentially risky.
41+
references:
42+
- https://docs.splunk.com/Documentation/Splunk/latest/Security/SPLsafeguards#Commands_that_trigger_the_warning
43+
tags:
44+
analytic_story:
45+
- Splunk Vulnerabilities
46+
asset_type: Web Server
47+
cis20:
48+
- CIS 3
49+
- CIS 6
50+
confidence: 40
51+
cve:
52+
- CVE-2022-32154
53+
context:
54+
- Source:Endpoint
55+
dataset:
56+
- https://github.com/splunk/attack_data/raw/master/datasets/attack_techniques/T1203/search_activity.txt
57+
impact: 50
58+
kill_chain_phases:
59+
- Actions on Objectives
60+
message: ML model "risky_command_abuse" training is completed.
61+
mitre_attack_id:
62+
- T1059
63+
nist:
64+
- DE.AE
65+
observable:
66+
- name: user
67+
type: User
68+
role:
69+
- Victim
70+
product:
71+
- Splunk Enterprise
72+
- Splunk Enterprise Security
73+
- Splunk Cloud
74+
required_fields:
75+
- _time
76+
- Search_Activity.search
77+
- Search_Activity.total_run_time
78+
- Search_Activity.user
79+
- Search_Activity.search_type
80+
risk_score: 20
81+
security_domain: audit
82+
detections:
83+
- Splunk Command and Scripting Interpreter Risky SPL MLTK
84+

‎baselines/splunk_risky_command_abuse_ml_detection_baseline.yml‎

Lines changed: 0 additions & 71 deletions
This file was deleted.

detections/application/splunk_risky_command_abuse_ml_detection.yml renamed to detections/application/splunk_command_and_scripting_interpreter_risky_spl_mltk.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
1-
name: Splunk Risky Command Abuse ML Detection
1+
name: Splunk Command and Scripting Interpreter Risky SPL MLTK
22
id: 19d0146c-2eae-4e53-8d39-1198a78fa9ca
33
version: 1
44
date: '2022-05-27'
55
author: Abhinav Mishra, Kumar Sharad and Xiao Lin, Splunk
66
type: Anomaly
77
datamodel:
88
- Splunk_Audit
9-
description: 'This detection utilize machine learning model named "risky_command_abuse" trained from "Splunk
10-
Risky Command Abuse ML Model Baseline". It should be scheduled to run every hour
11-
to detect whether a user has run searches containing risky keywords with abnormal long running time in the
12-
past two hours, comparing with his/her past seven days history. '
9+
description: 'This detection utilize machine learning model named "risky_command_abuse" trained from "Splunk Command
10+
and Scripting Interpreter Risky SPL MLTK Baseline". It should be scheduled to run hourly to detect whether a user
11+
has run searches containing risky SPL from this list
12+
https://docs.splunk.com/Documentation/Splunk/latest/Security/SPLsafeguards#Commands_that_trigger_the_warninga
13+
with abnormal long running time in the past one hour, comparing with his/her past seven days history. This search
14+
uses the trained baseline to infer whether a search is an outlier (isOutlier ~= 1.0) or not (isOutlier_= 0.0)'
1315
search: '| tstats values(Search_Activity.user) AS user, sum(Search_Activity.total_run_time) AS run_time,
1416
values(Search_Activity.search) as searches, count
1517
FROM datamodel=Splunk_Audit.Search_Activity WHERE (Search_Activity.user!="")
16-
AND (Search_Activity.total_run_time>1) AND (earliest=-2h@h latest=now)
18+
AND (Search_Activity.total_run_time>1) AND (earliest=-1h@h latest=now)
1719
AND (Search_Activity.search IN ("*| runshellscript *", "*| collect *","*| delete *", "*| fit *", "*| outputcsv *",
1820
"*| outputlookup *", "*| run *", "*| script *", "*| sendalert *", "*| sendemail *", "*| tscollect *"))
1921
AND (Search_Activity.search_type=adhoc) AND (Search_Activity.user!=splunk-system-user)
2022
BY _time, Search_Activity.user span=1h
2123
| apply risky_command_abuse
2224
| fields _time, user, searches, run_time, IsOutlier(run_time)
2325
| rename IsOutlier(run_time) as isOutlier, _time as timestamp
24-
| where isOutlier>0.5 | `splunk_risky_command_abuse_ml_detection_filter`'
25-
how_to_implement: This detection depends on MLTK and assumes Splunk audit data model is available.
26-
known_false_positives: Benigh search of long run time will be flagged as positive (false), if the run time of
27-
a search exceeds the boundaries of outlier defined by the fitted density function model.
26+
| where isOutlier>0.5
27+
| `splunk_command_and_scripting_interpreter_risky_spl_mltk_filter`'
28+
how_to_implement: This detection depends on MLTK app which can be found here - https://splunkbase.splunk.com/app/2890/
29+
and the Splunk Audit datamodel which can be found here - https://splunkbase.splunk.com/app/1621/. Baseline model
30+
needs to be buillt using "Splunk Command and Scripting Interpreter Risky SPL MLTK Baseline" before this search can run.
31+
known_false_positives: If the run time of a search exceeds the boundaries of outlier defined by the fitted density
32+
function model, false positives can occur, incorrectly labeling a long running search as potentially risky.
2833
references:
2934
- https://docs.splunk.com/Documentation/Splunk/latest/Security/SPLsafeguards#Commands_that_trigger_the_warning
3035
tags:
@@ -35,16 +40,18 @@ tags:
3540
- CIS 3
3641
- CIS 6
3742
confidence: 40
43+
cve:
44+
- CVE-2022-32154
3845
context:
3946
- Source:Endpoint
4047
dataset:
4148
- https://github.com/splunk/attack_data/raw/master/datasets/attack_techniques/T1203/search_activity.txt
4249
impact: 50
4350
kill_chain_phases:
4451
- Actions on Objectives
45-
message: $user used abnormally long run time for searches with risky command.
52+
message: Abnormally long run time for risk SPL command seen by user $user.
4653
mitre_attack_id:
47-
- T1203
54+
- T1059
4855
nist:
4956
- DE.AE
5057
observable:
@@ -64,4 +71,4 @@ tags:
6471
- Search_Activity.search_type
6572
risk_score: 20
6673
security_domain: audit
67-
74+

tests/application/splunk_risky_command_abuse_ml_detection.test.yml renamed to tests/application/splunk_command_and_scripting_interpreter_risky_spl_mltk.test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: Splunk Risky Command Abuse ML Detection Unit Test
1+
name: Splunk Command and Scripting Interpreter Risky SPL MLTK Unit Test
22
tests:
3-
- name: Splunk Risky Command Abuse ML Detection
4-
file: application/splunk_risky_command_abuse_ml_detection.yml
3+
- name: Splunk Command and Scripting Interpreter Risky SPL MLTK
4+
file: splunk_command_and_scripting_interpreter_risky_spl_mltk.yml
55
pass_condition: '| stats count | where count > 0'
66
earliest_time: -1h
77
latest_time: now
88
baselines:
9-
- name: Splunk Risky Command Abuse ML Detection Baseline
10-
file: baselines/splunk_risky_command_abuse_ml_detection_baseline.yml
9+
- name: Splunk Command and Scripting Interpreter Risky SPL MLTK Baseline
10+
file: baselines/splunk_command_and_scripting_interpreter_risky_spl_mltk_baseline.yml
1111
pass_condition: '| stats count | where count > 0'
1212
earliest_time: -7d
1313
latest_time: now

0 commit comments

Comments
 (0)