Detection rules › Splunk
Suspicious Executable by Powershell (Sysmon)
Detect when an executable has been launched by powershell and similar processes. Such as powershell cscript or cmd and similar processes spawning cmd.exe, cscript rundll32 and similar processes being a child process of powershell
MITRE ATT&CK coverage
References
Event coverage
| Provider | Event | Title |
|---|---|---|
| Sysmon | Event ID 1 | Process creation |
Rule body yaml
id: '1041.11628'
title: Suspicious Executable by Powershell
description: 'Detect when an executable has been launched by powershell and similar
processes. Such as powershell cscript or cmd and similar processes spawning cmd.exe,
cscript rundll32 and similar processes being a child process of powershell. - Threat
Actor Association: APT29/Nobelium/Cozy Bear, APT34/OilRig, APT41, APT43, FIN7, Flax
Typhoon, Lancefly, MuddyWater, RedEyes - Software Association: Bazarloader, Blackbyte,
IcedID, Qakbot/Qbot - #TrendingThreat #Russia #Ukraine'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_sysmon` (TERM(EventCode=1) OR "<EventID>1<")
"powershell.exe" ("cmd.exe" OR "services.exe" OR "dllhost.exe" OR "rundll32.exe"
OR "cscript.exe" OR "mshta.exe" OR "regsvr32.exe") | regex parent_process_name="(?i)(powershell\.exe)"
| regex process_path="(?i)((cmd)|(services)|(dllhost)|(rundll32)|(mshta)|(regsvr32)|(cscript))\.exe"
| table _time, host, user event_id, parent_*, process_*, process, signature_id,
src_*, dest_* | bin span=1s | stats values(*) as * by _time, host | where isnotnull(user) '
techniques:
- execution:command and scripting interpreter:powershell
- execution:command and scripting interpreter:windows command shell
technique_id:
- T1059.001
- T1059.003
data_category:
- Process command-line parameters
- Windows Sysmon
references:
- https://docs.broadcom.com/doc/increased-use-of-powershell-in-attacks-16-en
- https://www.clearskysec.com/wp-content/uploads/2018/11/MuddyWater-Operations-in-Lebanon-and-Oman.pdf
Stages and Predicates
Stage 1: search
`get_endpoint_data` `get_endpoint_data_sysmon` (TERM(EventCode=1) OR "<EventID>1<") "powershell.exe" ("cmd.exe" OR "services.exe" OR "dllhost.exe" OR "rundll32.exe" OR "cscript.exe" OR "mshta.exe" OR "regsvr32.exe")
Stage 2: regex
| regex parent_process_name="(?i)(powershell\.exe)"
Stage 3: regex
| regex process_path="(?i)((cmd)|(services)|(dllhost)|(rundll32)|(mshta)|(regsvr32)|(cscript))\.exe"
Stage 4: table
| table _time, host, user event_id, parent_*, process_*, process, signature_id, src_*, dest_*
Stage 5: bucket
| bin span=1s
Stage 6: stats
| stats values(*) as * by _time, host
Stage 7: where
| where isnotnull(user)
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
EventCode | eq |
|
parent_process_name | regex_match |
|
process_path | regex_match |
|
user | is_not_null |
Search terms
Bare-string tokens in the SPL search body. Splunk matches each token against _raw (the untyped raw event text) anywhere it appears, not against a specific field. These don't surface in the Indicators table because they aren't predicates on a known field.
| Stage | Term |
|---|---|
| 1 | TERM |
| 1 | "<EventID>1<" |
| 1 | "powershell.exe" |
| 1 | "cmd.exe" |
| 1 | "services.exe" |
| 1 | "dllhost.exe" |
| 1 | "rundll32.exe" |
| 1 | "cscript.exe" |
| 1 | "mshta.exe" |
| 1 | "regsvr32.exe" |