Try in Splunk Security Cloud


The following analytic uses a pretrained machine learning text classifier to detect potentially risky commands. The model is trained independently and then the model file is packaged within ESCU for usage. A command is deemed risky based on the presence of certain trigger keywords, along with the context and the role of the user (please see references). The model uses custom features to predict whether a SPL is risky using text classification. The model takes as input the command text, user and search type and outputs a risk score between [0,1]. A high score indicates higher likelihood of a command being risky. This model is on-prem only.

  • Type: Anomaly
  • Product: Splunk Enterprise, Splunk Enterprise Security, Splunk Cloud
  • Datamodel: Splunk_Audit
  • Last Updated: 2022-06-16
  • Author: Abhinav Mishra, Kumar Sharad, Namratha Sreekanta and Xiao Lin, Splunk
  • ID: b4aefb5f-1037-410d-a149-1e091288ba33




ID Technique Tactic
T1059 Command and Scripting Interpreter Execution
Kill Chain Phase
  • Actions on Objectives
  • DE.AE
  • CIS 3
  • CIS 6
| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime from datamodel=Splunk_Audit.Search_Activity where Search_Activity.search_type=adhoc Search_Activity.user!=splunk-system-user by Search_Activity.user Search_Activity.search_type 
| eval spl_text = ''. " " .'Search_Activity.user'. " " .'Search_Activity.search_type'
| dedup spl_text 
| apply risky_spl_pre_trained_model 
| where risk_score > 0.5 
| `drop_dm_object_name(Search_Activity)` 
| table search, user, search_type, risk_score 
| `detect_risky_spl_using_pretrained_ml_model_filter`


The SPL above uses the following Macros:

:information_source: detect_risky_spl_using_pretrained_ml_model_filter is a empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Required fields

List of fields required to use this analytic.

  • _time
  • Search_Activity.user
  • Search_Activity.search_type

How To Implement

This detection depends on the MLTK app which can be found here - and the Splunk Audit datamodel which can be found here - Additionally, you need to be ingesting logs which include, Search_Activity.user, Search_Activity.search_type from your endpoints. The risk score threshold should be adjusted based on the environment. The detection uses a custom MLTK model hence we need a few more steps for deployment, as outlined here -

Known False Positives

False positives may be present if suspicious behavior is observed, as determined by frequent usage of risky keywords.

Associated Analytic Story


Risk Score Impact Confidence Message
20.0 50 40 A potentially risky Splunk command has been run by $user$, kindly review.

:information_source: The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.


Test Dataset

Replay any dataset to Splunk Enterprise by using our tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range

source | version: 1