Command and Scripting Interpreter: Unix Shell T1059.004

Adversaries may abuse Unix shell commands and scripts for execution. Unix shells are the primary command prompt on Linux, macOS, and ESXi systems, though many variations of the Unix shell exist (e.g. sh, ash, bash, zsh, etc.) depending on the specific OS or distribution. Unix shells can control every aspect of a system, with certain commands requiring elevated privileges.

Events covered

7 catalog events are tagged with this technique by at least one rule.

Authoring guide

Patterns shared across the 11 rules above: which fields they filter on, what specific values they look for, and what they exclude. The catalog normalizes field names across vendors so Sigma's Image, Elastic's process.name, and Splunk's process_name collapse into one row. Each rule contributes at most once per row.

Fields filtered most (15 distinct)

The fields most rules look at when detecting this technique. The How column shows the operators authors use (eq, wildcard, regex_match, match) and how often each appears. Sample values are concrete examples to start from, not an exhaustive list.

FieldRulesHowSample values
CommandLine6contains 3, match 3(?i)((tracert)|(query)|(net\s+((localgroup)|(group)|(conf..., (?i)((netstat)|(netsh)|(schtasks)|(tasklist)|(driverquery..., (?i)((whoami)|(dir)|(hostname)|(hostname)|(systeminfo)|(i..., (?i)((netstat)|(netsh)|(schtasks)|(tasklist)|(driverquery..., (?i)((whoami)|(dir)|(hostname)|(hostname)|(systeminfo)|(i...
event.type5eq 5start, change
process_name4eq 3, match 1wsl.exe, (?i)((netstat)|(netsh)|(schtasks)|(tasklist)|(driverquery..., (?i)((tracert)|(query)|(net\s+((localgroup)|(group)|(conf..., (?i)((whoami)|(dir)|(hostname)|(hostname)|(systeminfo)|(i..., dllhost.exe
EventID3eq 31, 4104, 4688
Image3wildcard 2, ends_with 1, eq 1/curl, ?:\program files*\windowsapps\kalilinux.*\kali.exe, ?:\users\*\appdata\local\microsoft\windowsapps\kali.exe, ?:\users\*\appdata\local\packages\*\rootfs\usr\bin\bash, ?:\users\*\appdata\local\packages\kalilinux*
parent_process_name3eq 2, match 1wsl.exe, (?i)(powershell\.exe)|(cmd\.exe), wslhost.exe
dc_process_name2gt 22
process.args2eq 1, starts_with 1, wildcard 1--distribution, --exec, --install, --system, -d
OriginalFileName1eq 1bash.exe
ParentCommandLine1starts_with 1bash
ParentImage1ends_with 1/bun, /node
TargetFilename1regex_match 1, starts_with 1/run/systemd/units/invocation:systemd-fsck@, /sys/firmware/, /var/log/journal/
TargetObject1wildcard 1*\software\microsoft\windows\currentversion\lxss\*\packag...
Type1eq 1
registry_value_name1eq 1PackageFamilyName

Top indicator values (66 distinct)

Specific (field, operator, value) combinations the rules check for, ranked by how many rules under this technique use each one. The Corpus reach column counts how many rules across the entire catalog (any technique) check the same combination. High numbers point to widely-used indicators that are likely noisy on their own; combine them with another condition for useful signal. Blank means the combination is specific to rules under this technique. Click a value to expand the rules under this technique that use it.

FieldKindValueRules (here)Corpus reach
event.typeeq
start
4241
CommandLinematch
(?i)((tracert)|(query)|(net\s+((localgroup)|(group)|(config)|(share)|(use)|(u...
33
CommandLinematch
(?i)((netstat)|(netsh)|(schtasks)|(tasklist)|(driverquery)|(qprocess)|(nslook...
22
CommandLinematch
(?i)((whoami)|(dir)|(hostname)|(hostname)|(systeminfo)|(ipconfig)|(route)|(ar...
22
CommandLinematch
(?i)((netstat)|(netsh)|(schtasks)|(tasklist)|(driverquery)|(qprocess)|(nslook...
1
CommandLinematch
(?i)((whoami)|(dir)|(hostname)|(hostname)|(systeminfo)|(ipconfig)|(route)|(ar...
1
CommandLinecontains
curl
212
CommandLinecontains
nohup
22
CommandLinecontains
-rf
1
CommandLinecontains
/library/caches/com.apple.act.mond
1
CommandLinecontains
/tmp/6202033
1
CommandLinecontains
/tmp/ld.py
1
CommandLinecontains
6202033
1
CommandLinecontains
http://sfrclak.com
12
CommandLinecontains
osascript
1
CommandLinecontains
packages.npm.org/product
1
CommandLinecontains
python3
1
CommandLinecontains
rm
12
CommandLinecontains
{dfb65c4c-b34f-435d-afe9-a86218684aa8}
1
dc_process_namegt
2
24
parent_process_nameeq
wsl.exe
22
process_nameeq
wsl.exe
23
EventIDeq
1
1232
EventIDeq
4104
1268
EventIDeq
4688
1312
Imageends_with
/curl
19
Imageeq
?:\windows\system32\bash.exe
1
Imagewildcard
?:\program files*\windowsapps\kalilinux.*\kali.exe
1
Imagewildcard
?:\users\*\appdata\local\microsoft\windowsapps\kali.exe
1
Imagewildcard
?:\users\*\appdata\local\packages\*\rootfs\usr\bin\bash
1

Exclusions (34 distinct)

Field/operator/value combinations excluded by rules under this technique (top-level not() clauses), sorted by how many rules exclude each. These are the false-positive paths the community has learned to filter out. A new rule that ignores the high-count entries here will likely fire on the same noisy paths. Click a value to expand the rules under this technique that exclude it.

FieldKindValueRules excluding
CommandLineeq
powershell.exe -Command $env:USERPROFILE
1
CommandLinestarts_with
git.exe -c log.
1
CommandLinewildcard
*cli.js --folder-uri=vscode-remote://wsl*
1
CommandLinewildcard
*echo*%USERPROFILE%*
1
CommandLinewildcard
ms-vscode-remote.remote-wsl
1
EventTypeeq
ProcessRollup2
1
Imagewildcard
?:\program files (x86)\*
1
Imagewildcard
?:\program...
1
Imagewildcard
?:\program files\*
1
Imagewildcard
?:\windows\sys?????\wslconfig.exe
1
Imagewildcard
?:\windows\system32\conhost.exe
1
Imagewildcard
?:\windows\system32\lxss\wslhost.exe
1
Imagewildcard
?:\windows\system32\werfault.exe
1
Imagewildcard
?:\windows\system32\wsl.exe
1
Imagewildcard
\device\harddiskvolume*\program files (x86)\*
1

Rules under this technique

Every rule in the catalog tagged with this technique, grouped by vendor. Click a rule title for its full predicates, exclusions, and indicators.

Sigma 3 rules

Elastic 5 rules

Splunk 3 rules