Command and Scripting Interpreter: PowerShell T1059.001

Tactic: Execution

Adversaries may abuse PowerShell commands and scripts for execution. PowerShell is a powerful interactive command-line interface and scripting environment included in the Windows operating system. Adversaries can use PowerShell to perform a number of actions, including discovery of information and execution of code. Examples include the Start-Process cmdlet which can be used to run an executable and the Invoke-Command cmdlet which runs a command locally or on a remote computer (though administrator permissions are required to use PowerShell to connect to remote systems).

Events covered

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

ProviderEventTitle
SysmonEvent ID 1Process creation
SysmonEvent ID 3Network connection
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)
Security-AuditingEvent ID 4625An account failed to log on.
Security-AuditingEvent ID 4688A new process has been created.
Security-AuditingEvent ID 4697A service was installed in the system.
Security-AuditingEvent ID 4799A security-enabled local group membership was enumerated.
Security-AuditingEvent ID 5140A network share object was accessed.
Security-AuditingEvent ID 5156The Windows Filtering Platform has permitted a connection.
Defender-DeviceImageLoadEventsanyImage load (any)
Defender-DeviceImageLoadEventsImageLoadedImage loaded
Defender-DeviceProcessEventsanyProcess activity (any)
ESFexecProcess Execution (Notify)
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.
PowerShellEvent ID 4103Payload Context: ContextInfo User Data: UserData.
PowerShellEvent ID 4104Creating Scriptblock text (MessageNumber of MessageTotal).
PowerShellEvent ID 400Event ID 400
PowerShellEvent ID 800Event ID 800
Service-Control-ManagerEvent ID 7045A service was installed in the system.

Authoring guide

Patterns shared across the 471 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 (133 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
CommandLine152contains 107, regex_match 30, match 22, in 6, is_not_null 6, ends_with 4, wildcard 4, eq 3, is_null 1/create, -en , (?i)CreateDecryptor, (?i)System\.Net\.WebClient.+\.Download(file|string), (?i)\s(-|\/)(win?d?o?w?s?t?y?l?\s+hi?d?d?e?|windowstyle\s...
ScriptBlockText126contains 72, in 42, eq 27, regex_match 9, match 7, ends_with 1, starts_with 1adjusttokenprivileges, frombase64string, new-object, &&, (new-object...
EventID101eq 100, in 14104, 4103, 4688, 1, 4625
Image84ends_with 71, starts_with 6, eq 5, contains 4, wildcard 4, is_null 2, regex_match 2\powershell.exe, \pwsh.exe, \cmd.exe, \powershell_ise.exe, \bitsadmin.exe
process_name84eq 65, regex_match 9, in 7, wildcard 5, match 3, contains 2, ne 1, starts_with 1powershell.exe, powershell_ise.exe, cmd.exe, pwsh.exe, cscript.exe
OriginalFileName57eq 49, in 8powershell.exe, pwsh.dll, powershell_ise.exe, cmd.exe, cscript.exe
parent_process_name55eq 36, in 9, regex_match 9, wildcard 3, contains 1cmd.exe, powershell.exe, explorer.exe, bash, mshta.exe
event.type54eq 50, in 4start, process_started, change, creation
event.category44eq 44process, library, driver
ParentImage40ends_with 26, contains 8, eq 8, regex_match 1, wildcard 1\powershell.exe, \pwsh.exe, \\explorer.exe, \cscript.exe, \gc_worker.exe
ParentCommandLine22contains 14, wildcard 3, eq 2, is_not_null 2, ends_with 1, in 1, match 1powershell -ExecutionPolicy Unrestricted -File script?.ps1, --ms-enable-electron-run-as-node , localcommand=, permitlocalcommand=yes, server.js
process.args19eq 9, wildcard 6, contains 5, starts_with 5, in 1, is_not_null 1, match 1C:\Intel\, $*$*;set-alias, &{', */bin/*sh*, *Reflection.Assembly*
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`?)
EventType16eq 8, in 5, starts_with 2, ne 1exec, exec_event, Image loaded, ProcessRollup2, executed
Type15eq 15

Top indicator values (5097 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
59268
EventIDeq
4103
19105
EventIDeq
4688
19313
EventIDeq
1
17237
process_nameeq
powershell.exe
52104
process_nameeq
pwsh.exe
3762
process_nameeq
powershell_ise.exe
3050
process_nameeq
cmd.exe
2877
process_nameeq
rundll32.exe
1360
process_nameeq
wscript.exe
1329
process_nameeq
cscript.exe
1225
process_nameeq
mshta.exe
1231
process_nameeq
certutil.exe
822
process_nameeq
msiexec.exe
722
process_nameeq
regsvr32.exe
725
event.typeeq
start
48606
Imageends_with
\powershell.exe
43182
Imageends_with
\pwsh.exe
42168
Imageends_with
\cmd.exe
11130
Imageends_with
\powershell_ise.exe
841
Imageends_with
\schtasks.exe
756
Imageends_with
\mshta.exe
667
event.categoryeq
process
43128
OriginalFileNameeq
powershell.exe
37120
OriginalFileNameeq
pwsh.dll
37112
OriginalFileNameeq
powershell_ise.exe
1851
Provider_Nameeq
Service Control Manager
1050
OriginalFileNamein
powershell.exe
817
Esql.script_block_lengthgt
500
66
Esql.script_block_pattern_countge
1
66

Exclusions (554 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
user.ideq
S-1-5-18
16
ScriptBlockTexteq
sentinelbreakpoints
9
ScriptBlockTexteq
set-psbreakpoint
8
ScriptBlockTexteq
powersploitindicators
5
process_nameeq
cmd.exe
6
process_nameeq
powershell.exe
5
process_nameeq
rundll32.exe
3
CommandLineregex_match
(?i)(^|\s|\;|\|)(iex|iwr)(\s|\;|\|)
3
ParentImageeq
c:\windows\system32\msiexec.exe
3
user.idin
S-1-5-18
3
user.idin
S-1-5-19
3
Datacontains
hostapplication=powershell
2
Imagecontains
\appdata\local\microsoft\windowsapps\microsoft.powershellpreview
2
Imagecontains
c:\program files\windowsapps\microsoft.powershellpreview
2
Imageends_with
\mscorsvw.exe
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.

Platform (all)
Domain (all)

Sigma 222 rules

Elastic 112 rules

Splunk 125 rules

Kusto 7 rules

YARA-L 5 rules