Command and Scripting Interpreter T1059

Adversaries may abuse command and script interpreters to execute commands, scripts, or binaries. These interfaces and languages provide ways of interacting with computer systems and are a common feature across many different platforms. Most systems come with some built-in command-line interface and scripting capabilities, for example, macOS and Linux distributions include some flavor of Unix Shell while Windows installations include the Windows Command Shell and PowerShell.

Events covered

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

ProviderEventTitle
SysmonEvent ID 1Process creation
SysmonEvent ID 3Network connection
SysmonEvent ID 5Process terminated
SysmonEvent ID 7Image loaded
SysmonEvent ID 8CreateRemoteThread
SysmonEvent ID 10ProcessAccess
SysmonEvent ID 11FileCreate
SysmonEvent ID 12RegistryEvent (Object create and delete)
SysmonEvent ID 13RegistryEvent (Value Set)
SysmonEvent ID 14RegistryEvent (Key and Value Rename)
SysmonEvent ID 17PipeEvent (Pipe Created)
SysmonEvent ID 18PipeEvent (Pipe Connected)
SysmonEvent ID 19WmiEvent (WmiEventFilter activity detected)
SysmonEvent ID 20WmiEvent (WmiEventConsumer activity detected)
SysmonEvent ID 21WmiEvent (WmiEventConsumerToFilter activity detected)
SysmonEvent ID 22DNSEvent (DNS query)
SysmonEvent ID 23FileDelete (File Delete archived)
SysmonEvent ID 26FileDeleteDetected (File Delete logged)
Security-AuditingEvent ID 4624An account was successfully logged on.
Security-AuditingEvent ID 4625An account failed to log on.
Security-AuditingEvent ID 4656A handle to an object was requested.
Security-AuditingEvent ID 4657A registry value was modified.
Security-AuditingEvent ID 4663An attempt was made to access an object.
Security-AuditingEvent ID 4688A new process has been created.
Security-AuditingEvent ID 4689A process has exited.
Security-AuditingEvent ID 4697A service was installed in the system.
Security-AuditingEvent ID 4698A scheduled task was created.
Security-AuditingEvent ID 4776The domain controller attempted to validate the credentials for an account.
Security-AuditingEvent ID 4799A security-enabled local group membership was enumerated.
Security-AuditingEvent ID 5140A network share object was accessed.
Security-AuditingEvent ID 5145A network share object was checked to see whether client can be granted desired access.
Security-AuditingEvent ID 5156The Windows Filtering Platform has permitted a connection.
Defender-DeviceEventsanyDefender event (any)
Defender-DeviceEventsPowerShellCommandPowerShell command executed
Defender-DeviceEventsAmsiScriptContentAMSI script content captured
Defender-DeviceEventsClrUnbackedModuleLoadedCLR unbacked module loaded
Defender-DeviceFileEventsanyFile activity (any)
Defender-DeviceImageLoadEventsanyImage load (any)
Defender-DeviceImageLoadEventsImageLoadedImage loaded
Defender-DeviceNetworkEventsConnectionSuccessConnection succeeded
Defender-DeviceProcessEventsanyProcess activity (any)
MSSQLSERVEREvent ID 8128Event ID 8128
AppLockerEvent ID 8004FilePathBuffer was prevented from running.
AppLockerEvent ID 8007FilePathBuffer was prevented from running.
AppLockerEvent ID 8022PackageBuffer was prevented from running.
AppLockerEvent ID 8025PackageBuffer was prevented from running.
DotNETRuntimeEvent ID 152ModuleID=ModuleID.
PowerShellEvent ID 4103Payload Context: ContextInfo User Data: UserData.
PowerShellEvent ID 4104Creating Scriptblock text (MessageNumber of MessageTotal).
Windows-DefenderEvent ID 1006ProductName has detected malware or other potentially unwanted software.
Windows-DefenderEvent ID 1015ProductName has detected a suspicious behavior.
Windows-DefenderEvent ID 1116Product Name has detected malware or other potentially unwanted software.
Windows-DefenderEvent ID 1117Product Name has taken action to protect this machine from malware or other potentially unwanted software.
Windows-DefenderEvent ID 1121Microsoft Defender Exploit Guard has blocked an operation that is not allowed by your IT administrator.
Windows-DefenderEvent ID 1122Microsoft Defender Exploit Guard audited an operation that is not allowed by your IT administrator.
Windows-DefenderEvent ID 1125Your IT administrator would have caused Microsoft Defender Exploit Guard to block a potentially dangerous network connection.
Windows-DefenderEvent ID 1126Your IT administrator has caused Microsoft Defender Exploit Guard to block a potentially dangerous network connection.
Windows-DefenderEvent ID 1129A user has allowed a blocked Microsoft Defender Exploit Guard operation.
Windows-DefenderEvent ID 1131ProductName has blocked an operation that your administrator doesn't allow.
Windows-DefenderEvent ID 1132ProductName has audited an operation.
Windows-DefenderEvent ID 1133ProductName has blocked an operation that your administrator doesn't allow.
Windows-DefenderEvent ID 1134ProductName has audited an operation.
Windows-DefenderEvent ID 5007Product Name Configuration has changed.
PowerShellEvent ID 400Event ID 400
PowerShellEvent ID 800Event ID 800
ScreenConnectEvent ID 200Executed command of length.
ScreenConnectEvent ID 201Transferred files with action 'Transfer'.
Service-Control-ManagerEvent ID 7045A service was installed in the system.

Authoring guide

Patterns shared across the 732 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 (148 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
CommandLine312contains 211, regex_match 64, match 46, ends_with 10, in 10, wildcard 8, eq 6, is_not_null 4, is_null 2, starts_with 2/c, /create, -e, .bat, -en
Image201ends_with 169, contains 16, wildcard 10, starts_with 8, eq 7, in 3, is_null 2, regex_match 2, ne 1\powershell.exe, \cmd.exe, \pwsh.exe, \cscript.exe, \mshta.exe
EventID197eq 194, in 34104, 4688, 1, 4103, 7
process_name128eq 92, regex_match 17, in 10, match 9, contains 2, ne 2, ends_with 1powershell.exe, cmd.exe, powershell_ise.exe, pwsh.exe, cscript.exe
OriginalFileName119eq 107, in 10, contains 2, wildcard 1powershell.exe, pwsh.dll, powershell_ise.exe, cmd.exe, cscript.exe
ScriptBlockText99contains 75, in 16, regex_match 9, eq 7, match 7, ends_with 2, starts_with 1adjusttokenprivileges, frombase64string, new-object, &&, (new-object...
parent_process_name92eq 55, regex_match 20, match 7, in 6, contains 2, starts_with 2, ends_with 1, wildcard 1explorer.exe, cmd.exe, mshta.exe, powershell.exe, cscript.exe
ParentImage80ends_with 63, contains 12, eq 12, starts_with 4, is_null 1, wildcard 1\powershell.exe, \cmd.exe, \explorer.exe, \cscript.exe, \node.exe
event.type63eq 63start, change, creation
Type44eq 44
ParentCommandLine36contains 31, ends_with 5, eq 1, in 1, match 1, regex_match 1, starts_with 1, wildcard 1--experimental-https, --experimental-next-config-strip-types, .bat, /c, confluence
process.args28eq 15, wildcard 11, starts_with 6, contains 3, ends_with 3, match 1/c, C:\Intel\, $*$*;set-alias, &&, &{'
TargetFilename24ends_with 14, contains 12, regex_match 4, starts_with 4, eq 2.pth, (?i)/lib/python3\.([5-9]|[0-9]{2})/site-packages/, .class, .java, .jsp
Payload17contains 10, regex_match 7, ends_with 1&&, $doit, (?i)&&set.*(\{\d\}){2,}\\"\s+?-f.*&&.*cmd.*/c, (?i)(set).*&&\s?set.*(environment|invoke|\$?\{?input).*&&.*", (?i)echo.*clip.*&&.*(Clipboard|i`?n`?v`?o`?k`?e`?)
EventType15eq 11, starts_with 3, contains 1start, Image loaded, AmsiScriptContent, ClrUnbackedModuleLoaded, ConnectionSuccess

Top indicator values (5372 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
EventIDeq
4104
75268
EventIDeq
4688
57312
EventIDeq
1
42232
EventIDeq
4103
28105
Imageends_with
\powershell.exe
63186
Imageends_with
\pwsh.exe
56172
Imageends_with
\cmd.exe
40134
Imageends_with
\cscript.exe
2276
Imageends_with
\wscript.exe
2278
Imageends_with
\mshta.exe
1869
Imageends_with
\powershell_ise.exe
1242
Imageends_with
\rundll32.exe
11103
Imageends_with
\certutil.exe
844
event.typeeq
start
59241
process_nameeq
powershell.exe
5499
process_nameeq
cmd.exe
4175
process_nameeq
pwsh.exe
3960
process_nameeq
powershell_ise.exe
3250
process_nameeq
wscript.exe
1826
process_nameeq
cscript.exe
1722
process_nameeq
rundll32.exe
1555
process_nameeq
mshta.exe
1428
process_nameeq
certutil.exe
922
OriginalFileNameeq
powershell.exe
46121
OriginalFileNameeq
pwsh.dll
43112
OriginalFileNameeq
cmd.exe
2265
OriginalFileNameeq
powershell_ise.exe
2251
Provider_Nameeq
Service Control Manager
1050
parent_process_nameeq
explorer.exe
1020
CommandLinecontains
powershell
825

Exclusions (719 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
process_nameeq
cmd.exe
10
process_nameeq
powershell.exe
6
process_nameeq
rundll32.exe
3
user.ideq
S-1-5-18
5
ParentImageeq
c:\windows\system32\msiexec.exe
4
ParentImageeq
c:\windows\syswow64\msiexec.exe
3
CommandLinematch
(?i)\x5c\?\?\x5cC:\x5cWindows\x5csystem32\x5cconhost\.exe\s+0xffffffff\s+-ForceV1
3
CommandLineregex_match
(?i)(^|\s|\;|\|)(iex|iwr)(\s|\;|\|)
3
Imageends_with
\cmd.exe
3
dest_ipcidr_match
127.0.0.0/8
3
CommandLinecontains
-noprofile -executionpolicy bypass -command
2
CommandLinecontains
appdata\local\temp\
2
CommandLinecontains
install-chocolatey.ps1
2
Datacontains
hostapplication=powershell
2
Imagecontains
\appdata\local\microsoft\windowsapps\microsoft.powershellpreview
2

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 370 rules

Elastic 82 rules

Splunk 247 rules

Kusto 28 rules

YARA-L 5 rules