Detection rules › Splunk
Command-Line Interface Execution (Sysmon)
Detects when a Command-Line Interface executes on a host
MITRE ATT&CK coverage
References
Telemetry coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
Rule body
id: '1036.1048'
title: Command-Line Interface Execution
description: 'Detects when a Command-Line Interface executes on a host. -- Threat
Actor Association: APT29/Nobelium/Cozy Bear, APT31, APT35/Phosphorus/Magic Hound,
APT36, APT37, APT41, Carbanak, FamousSparrow, FIN6, FIN7, FIN8, Kimsuky, MalKamak,
MuddyWater, Night Spider, TA,505, TA551, Prophet Spider, Wizard Spider, WIRTE --
Software Association: Astaroth, BadHatch, Bazar, Conti, Cring, Emotet, GhostShell,
Hafnium, Hancitor, Harvester, Hive, IcedID, MINEBRIDGE, MirrorBlast, MysterySnail,
Nefilim, PowerShortShell, Prometheus / Spook, QakBot, Ransom Cartel, RATDispenser,
Remcos, Ryuk, Sodinokibi/REvil, SquirrelWaffle, Trickbot, XingLocker, Zloader, Zumkong'
logic_format: Splunk
logic: ' `get_endpoint_data` `get_endpoint_data_sysmon` EventCode=1 AND ("powershell.exe"
OR "cmd.exe") | table _time, host, user dest, direction, client, event_id, eventtype,
hashes, host, index, parent_process, parent_process_id, parent_process_name, parent_process_path,
process, process_current_directory, process_id, process_name, process_path, signature_id,
source, sourcetype, tag, user, user_id | bin span=60s | stats values(*) as * by
_time, host | where match(process_name,"(?i)powershell\.exe") OR match(process_name,"(i?)cmd\.exe") '
techniques:
- execution:command and scripting interpreter:powershell
- execution:command and scripting interpreter:windows command shell
technique_id:
- T1059.001
- T1059.003
data_category:
- Windows Sysmon
references:
- https://securityintelligence.com/an-increase-in-powershell-attacks-observations-from-ibm-x-force-iris/
- https://www.trendmicro.com/vinfo/us/security/news/cybercrime-and-digital-threats/tracking-detecting-and-thwarting-powershell-based-malware-and-attacks
Stages and Predicates
Stage 1: search
`get_endpoint_data` `get_endpoint_data_sysmon` EventCode=1 AND ("powershell.exe" OR "cmd.exe")
Stage 2: table
| table _time, host, user dest, direction, client, event_id, eventtype, hashes, host, index, parent_process, parent_process_id, parent_process_name, parent_process_path, process, process_current_directory, process_id, process_name, process_path, signature_id, source, sourcetype, tag, user, user_id
Stage 3: bucket
| bin span=60s
Stage 4: stats
| stats values(*) as * by _time, host
Stage 5: where
| where match(process_name,"(?i)powershell\.exe") OR match(process_name,"(i?)cmd\.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
EventCode | eq |
| field:"EventID" kind:eq value:"1" |
process_name | regex_match |
| field:"process_name" kind:regex_match |
Search terms
These SPL tokens match against raw event text.
| Stage | Term |
|---|---|
| 1 | "powershell.exe" |
| 1 | "cmd.exe" |