Detection rules › Splunk

Command-Line Interface Execution (Windows Event Log)

Group by
_time, host
Source
github.com/anvilogic-forge/armory

Detects when a Command-Line Interface executes on a host

MITRE ATT&CK coverage

References

Telemetry coverage

Rule body

id: '1036.1047'
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_winevent` (TERM(EventCode=4688) OR
  "<EventID>4688<" OR Type=Process) AND ("powershell.exe" OR "cmd.exe") | table _time,
  host, user event_id, parent_*, process_*, process, signature_id | bin span=60s |
  stats values(*) as * by _time, host | where match(process_path,"(?i)powershell\.exe")
  OR match(process_path,"(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 event logs
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_winevent` (TERM(EventCode=4688) OR "<EventID>4688<" OR Type=Process) AND ("powershell.exe" OR "cmd.exe")

Stage 2: table

| table _time, host, user event_id, parent_*, process_*, process, signature_id

Stage 3: bucket

| bin span=60s

Stage 4: stats

| stats values(*) as * by _time, host

Stage 5: where

| where match(process_path,"(?i)powershell\.exe") OR match(process_path,"(i?)cmd\.exe")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
EventCodeeq
  • 4688 corpus 317 (splunk 283, kusto 33, elastic 1)
field:"EventID" kind:eq value:"4688"
process_pathregex_match
  • "(?i)powershell.exe" corpus 2 (splunk 2)
  • "(i?)cmd.exe" corpus 2 (splunk 2)
field:"process_name" kind:regex_match

Search terms

These SPL tokens match against raw event text.

StageTerm
1"<EventID>4688<"
1"powershell.exe"
1"cmd.exe"