PowerShell Module: Obfuscated Script Execution via Stdin Pattern
Detects obfuscated PowerShell module payloads using chained set and stdin/input invoke patterns.
- Product
- windows
- Category
- ps_module
- Author
- Nikita Nazarov, oscd.community (SigmaHQ), DRL 1.1
- Published
- 2020-10-12
- 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 flags PowerShell module activity containing a string pattern consistent with obfuscated script execution that chains operations using "set" and then references environment/input execution constructs. Attackers often use this style to hinder static analysis and execute payloads indirectly through stdin-related input handling. The detection relies on telemetry fields that capture the PowerShell payload content and match it against the specified case-insensitive regular expression.
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 Module: Obfuscated Script Execution via Stdin Pattern"
id: 2981abae-a6ca-49ad-ab24-adac93d5ba50
related:
- id: 86b896ba-ffa1-4fea-83e3-ee28a4c915c7
type: derived
- id: c72aca44-8d52-45ad-8f81-f96c4d3c755e
type: derived
status: test
description: This rule flags PowerShell module activity containing a string pattern consistent with obfuscated script execution that chains operations using "set" and then references environment/input execution constructs. Attackers often use this style to hinder static analysis and execute payloads indirectly through stdin-related input handling. The detection relies on telemetry fields that capture the PowerShell payload content and match it against the specified case-insensitive regular expression.
references:
- https://github.com/SigmaHQ/sigma/issues/1009
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_module/posh_pm_invoke_obfuscation_via_stdin.yml
author: Nikita Nazarov, oscd.community, Huntrule Team
date: 2020-10-12
modified: 2024-04-05
tags:
- attack.stealth
- attack.t1027
- attack.execution
- attack.t1059.001
logsource:
product: windows
category: ps_module
definition: 0ad03ef1-f21b-4a79-8ce8-e6900c54b65b
detection:
selection_4103:
Payload|re: (?i)(set).*&&\s?set.*(environment|invoke|\$?\{?input).*&&.*"
condition: selection_4103
falsepositives:
- Unknown
level: high
license: DRL-1.1