PowerShell ScriptBlock uses rundll32 with shell32.dll and obfuscated invoke/comspec/iex
Flags PowerShell script blocks containing rundll32/shell32.dll execution strings alongside invoke/iex/comspec patterns.
- Product
- windows
- Category
- ps_script
- Author
- Nikita Nazarov, oscd.community (SigmaHQ), DRL 1.1
- Published
- 2019-10-08
- Updated
- 2026-07-31
ATT&CK techniques
Execution → Defense EvasionRecon
Resource Dev
Initial Access
Execution
Persistence
Priv Esc
Defense Evasion
Cred Access
Discovery
Lateral Movement
Collection
C2
Exfiltration
Impact
What it detects
This rule matches PowerShell script block content that includes multiple indicators of rundll32-based obfuscation, specifically references to rundll32, shell32.dll, and shellexec_rundll along with command-composition markers. It further requires additional keywords consistent with execution and payload staging (value, invoke, comspec, and iex). Attackers may use this pattern to obscure process launch and execution flow; the detection relies on Script Block Logging telemetry that captures ScriptBlockText.
Reporting behind it
Changelog
v2- v2Candidate ingested via manual entry.2026-07-31
- v1No changelog recorded for this version.2026-07-30
Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.
title: PowerShell ScriptBlock uses rundll32 with shell32.dll and obfuscated invoke/comspec/iex
id: e1c3d2a0-fbb7-4c0e-be21-90a4d30bb48a
status: test
description: This rule matches PowerShell script block content that includes multiple indicators of rundll32-based obfuscation, specifically references to rundll32, shell32.dll, and shellexec_rundll along with command-composition markers. It further requires additional keywords consistent with execution and payload staging (value, invoke, comspec, and iex). Attackers may use this pattern to obscure process launch and execution flow; the detection relies on Script Block Logging telemetry that captures ScriptBlockText.
references:
- https://github.com/SigmaHQ/sigma/issues/1009
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_invoke_obfuscation_via_use_rundll32.yml
author: Nikita Nazarov, oscd.community, Huntrule Team
date: 2019-10-08
modified: 2022-11-29
tags:
- attack.stealth
- attack.t1027
- attack.execution
- attack.t1059.001
logsource:
product: windows
category: ps_script
definition: "Requirements: Script Block Logging must be enabled"
detection:
selection_4104:
ScriptBlockText|contains|all:
- "&&"
- rundll32
- shell32.dll
- shellexec_rundll
ScriptBlockText|contains:
- value
- invoke
- comspec
- iex
condition: selection_4104
falsepositives:
- Unknown
level: high
license: DRL-1.1
related:
- id: a5a30a6e-75ca-4233-8b8c-42e0f2037d3b
type: derived