Command and Scripting Interpreter T1059

Tactic: Execution

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

103 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 24ClipboardChange (New content in the clipboard)
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 5152The Windows Filtering Platform blocked a packet.
Security-AuditingEvent ID 5154The Windows Filtering Platform has permitted an application or service to listen on a port for incoming connections.
Security-AuditingEvent ID 5155The Windows Filtering Platform has blocked an application or service from listening on a port for incoming connections.
Security-AuditingEvent ID 5156The Windows Filtering Platform has permitted a connection.
Security-AuditingEvent ID 5157The Windows Filtering Platform has blocked a connection.
Security-AuditingEvent ID 5158The Windows Filtering Platform has permitted a bind to a local port.
Security-AuditingEvent ID 5159The Windows Filtering Platform has blocked a bind to a local port.
Defender-AlertEvidenceanyAlert evidence
Defender-AlertInfoanyAlert information
Defender-DeviceEventsanyDefender event
Defender-DeviceEventsPowerShellCommandPowerShell command executed
Defender-DeviceEventsAmsiScriptContentAMSI script content captured
Defender-DeviceEventsClrUnbackedModuleLoadedCLR unbacked module loaded
Defender-DeviceEventsExploitGuardNonMicrosoftSignedBlockedExploit Guard non-Microsoft signed image (blocked)
Defender-DeviceFileEventsanyFile activity
Defender-DeviceImageLoadEventsanyImage load
Defender-DeviceImageLoadEventsImageLoadedImage loaded
Defender-DeviceLogonEventsanyLogon activity
Defender-DeviceNetworkEventsConnectionSuccessConnection succeeded
Defender-DeviceProcessEventsanyProcess activity
ESFexecProcess Execution
ESFforkProcess Fork
ESFsignalSignal Delivery
ESFopenFile Open
ESFcreateFile or Directory Create
ESFrenameFile Rename
ESFunlinkFile Unlink
ESFwriteFile Write
Linux-AuditdEvent ID 1101USER_ACCT
Linux-AuditdEvent ID 1103CRED_ACQ
Linux-AuditdEvent ID 1105USER_START
Linux-AuditdEvent ID 1106USER_END
Linux-AuditdEvent ID 1123USER_CMD
Linux-AuditdEvent ID 1300SYSCALL
Linux-AuditdEvent ID 1302PATH
Linux-AuditdEvent ID 1307CWD
Linux-AuditdEvent ID 1309EXECVE
Linux-AuditdEvent ID 1327PROCTITLE
MSSQLSERVEREvent ID 8128Event ID 8128
AppLockerEvent ID 8003RuleAndFileData.FilePath was allowed to run but would have been prevented from running if the AppLocker policy were enforced.
AppLockerEvent ID 8004FilePathBuffer was prevented from running.
AppLockerEvent ID 8006FilePathBuffer was allowed to run but would have been prevented from running if the AppLocker policy were enforced.
AppLockerEvent ID 8007FilePathBuffer was prevented from running.
AppLockerEvent ID 8021PackageBuffer was allowed to run but would have been prevented from running if the AppLocker policy were enforced.
AppLockerEvent ID 8022PackageBuffer was prevented from running.
AppLockerEvent ID 8024PackageBuffer was allowed to run but would have been prevented from running if the AppLocker policy were enforced.
AppLockerEvent ID 8025PackageBuffer was prevented from running.
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.
Sysmon-for-LinuxEvent ID 1Process Create
Sysmon-for-LinuxEvent ID 3Network connection
Sysmon-for-LinuxEvent ID 11File created

Authoring guide

These 1521 rules share fields, values, and exclusions.

Fields filtered most (370 distinct)

These fields appear most often in rule filters.

FieldRulesHowSample values
process_basename563eq 340, in 212, starts_with 80, wildcard 60, ends_with 4, contains 2, is_not_null 2, regex_match 2, ne 1bash, csh, powershell.exe, dash, cmd.exe
CommandLine527contains 342, regex_match 102, wildcard 82, match 27, in 18, ends_with 16, is_not_null 15, is_null 8, length_compare 8, eq 7, starts_with 4, gt 2, -e , */dev/tcp/*, event0.file.name, */dev/udp/*
EventType507eq 421, in 94, ne 17, starts_with 4exec, start, connection_attempted, exec_event, ProcessRollup2
event.type451eq 436, in 15, ne 1start, creation, change, process_started, deletion
Image329ends_with 200, starts_with 58, wildcard 36, contains 24, eq 17, is_not_null 12, in 5, regex_match 5, is_null 2, ne 1\powershell.exe, \cmd.exe, \pwsh.exe, /dev/shm/*, /boot/*
process.args297eq 178, in 79, wildcard 78, starts_with 64, contains 36, ends_with 13, regex_match 4, is_not_null 1, match 1-c, -e, -cl, -i, /bin/bash
parent_process_basename266eq 180, in 66, starts_with 36, wildcard 23, ends_with 3, contains 2, is_not_null 2, regex_match 1bash, explorer.exe, csh, node, osascript
EventID199eq 194, in 54104, 4688, 1, 4103, 7
OriginalFileName169eq 153, in 16, wildcard 3, contains 2PowerShell.EXE, pwsh.dll, Cmd.Exe, powershell_ise.EXE, cscript.exe
ParentImage164ends_with 73, is_not_null 29, starts_with 25, eq 19, wildcard 15, contains 14, in 2, is_null 1, regex_match 1, /dev/shm/*, /boot/*, ./*, \powershell.exe
ScriptBlockText132contains 75, in 45, eq 23, regex_match 10, match 6, ends_with 3AdjustTokenPrivileges, &&, (New-Object..., *-dumpcr*, *Get-WmiObject*
process.args_count99eq 57, ge 26, le 18, gt 42, 3, 1, 4, 5
TargetFilename83starts_with 31, wildcard 19, contains 18, ends_with 17, eq 7, regex_match 4, in 3/dev/shm/*, /private/tmp/*, /tmp/*, /Users/Shared/*, /private/var/tmp/*
ParentCommandLine77contains 53, wildcard 10, regex_match 7, eq 6, ends_with 5, is_not_null 5, in 2, length_compare 2, starts_with 1, *app.py*, *asgi.py*, *django*, *--experimental-https*
event.category76eq 73, in 3process, library, file, network, driver

Top indicator values (13680 distinct)

These values appear most often in rule predicates.

FieldKindValueRules (here)Corpus reach
event.typeeq
start
3971036
EventTypeeq
exec
263547
EventTypeeq
start
94388
EventTypeeq
connection_attempted
4172
process_basenamein
bash
114181
process_basenamein
sh
114180
process_basenamein
zsh
114180
process_basenamein
dash
96150
process_basenamein
csh
95148
process_basenamein
fish
94151
process_basenamein
ksh
94149
process_basenamein
tcsh
94145
process_basenameeq
powershell.exe
104187
process_basenameeq
CMD.EXE
68122
process_basenameeq
pwsh.exe
5278
process_basenameeq
WScript.exe
4884
process_basenameeq
MSHTA.EXE
4084
process_basenameeq
cscript.exe
3968
EventIDeq
4104
76269
EventIDeq
4688
49284
EventIDeq
1
43226
process.argseq
-c
6491
Imageends_with
*\powershell.exe
62181
Imageends_with
\pwsh.exe
54166
Imageends_with
*\cmd.exe
41132
EventTypein
exec
57180
EventTypein
start
45157
event.categoryeq
process
57105
OriginalFileNameeq
PowerShell.EXE
53134
OriginalFileNameeq
pwsh.dll
44115

Exclusions (6508 distinct)

These values appear most often in top-level exclusions.

FieldKindValueRules excluding
dest_ipcidr_match
127.0.0.0/8
57
dest_ipcidr_match
169.254.0.0/16
56
dest_ipcidr_match
224.0.0.0/4
55
dest_ipcidr_match
::1
55
dest_ipcidr_match
10.0.0.0/8
49
dest_ipcidr_match
172.16.0.0/12
49
dest_ipcidr_match
192.0.0.0/24
48
dest_ipcidr_match
192.0.2.0/24
48
dest_ipcidr_match
192.88.99.0/24
48
dest_ipcidr_match
240.0.0.0/4
48
dest_ipcidr_match
FE80::/10
48
dest_ipcidr_match
FF00::/8
48
dest_ipcidr_match
100.64.0.0/10
47
dest_ipcidr_match
192.175.48.0/24
47
dest_ipcidr_match
192.31.196.0/24
47

Rules under this technique

These vendors publish rules tagged with this technique.

Platform (all)
Domain (all)

Sigma 432 rules

Elastic 697 rules

Splunk 305 rules

Kusto 68 rules

YARA-L 7 rules

Panther 12 rules