Detection of Suspicious PowerShell Invocation Patterns
This brief documents detection logic for common PowerShell obfuscation and execution patterns frequently leveraged by attackers to maintain persistence, bypass security policies, and download secondary payloads.
This intelligence highlights specific PowerShell invocation patterns that are indicative of malicious activity, including encoded command execution, unauthorized persistence via registry modifications, and remote file retrieval using the .NET WebClient class. These patterns are frequently observed in post-exploitation scenarios where adversaries attempt to minimize their footprint by utilizing hidden windows, bypassing execution policies, and loading scripts directly into memory.
Defenders should focus on monitoring PowerShell Script Block Logging (Event ID 4104) to capture the full command structure before obfuscation or execution occurs. While these techniques are standard in many offensive toolkits, they are also associated with various automated downloaders and persistence mechanisms. Organizations must ensure that Script Block Logging is enabled across the environment to provide the visibility required to identify these specific command-line combinations.
Impact
Successful exploitation using these PowerShell patterns enables attackers to establish long-term persistence, execute fileless malware in memory, and exfiltrate or download additional tooling within compromised environments. If left undetected, these techniques facilitate lateral movement and provide broad control over the host operating system.
Recommendation
- Enable PowerShell Script Block Logging (Event ID 4104) across all Windows endpoints to support the visibility required for the provided detection rules.
- Deploy the provided Sigma rule to your SIEM to identify common obfuscated execution patterns and tune out legitimate administrative scripting activity.
- Investigate any hits against the WebClient download patterns to identify unauthorized script execution or potentially malicious payload retrieval.
Immediate actions
Enable PowerShell Script Block Logging (Event ID 4104) via GPO.
Threat Hunt
Search for existing Event ID 4104 logs matching the detection patterns.
Data: Event ID 4104
Detection coverage 1
Detect Suspicious PowerShell Invocation Patterns
highDetects various suspicious PowerShell invocation patterns including encoded commands, registry-based persistence, and remote payload downloads via WebClient.
Detection queries are available on the platform. Get full rules →