Detect Obfuscated PowerShell Command Invocation via Stdin on Windows

Flags PowerShell-like command-line patterns indicating obfuscated execution using stdin or input substitution.

FreeReviewedSigma · High · v2
Product
windows
Category
process_creation
Author
Nikita Nazarov, oscd.community (SigmaHQ), DRL 1.1
Published
2020-10-12
Updated
2026-07-31
title: Detect Obfuscated PowerShell Command Invocation via Stdin on Windows
id: 929d2e2b-2f52-49cc-ba21-bc2426bd4a6b
status: test
description: This rule flags process creation events where the command line matches patterns indicative of PowerShell obfuscation involving stdin-style input handling and chained commands. Attackers use obfuscation to hinder analysis and increase the likelihood of successful execution while maintaining stealth. The detection relies on Windows process creation telemetry, specifically the PowerShell command line content matching the configured regular expression.
references:
  - https://github.com/SigmaHQ/sigma/issues/1009
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_hktl_invoke_obfuscation_via_stdin.yml
author: Nikita Nazarov, oscd.community, Huntrule Team
date: 2020-10-12
modified: 2026-03-16
tags:
  - attack.stealth
  - attack.t1027
  - attack.execution
  - attack.t1059.001
logsource:
  category: process_creation
  product: windows
detection:
  selection:
    CommandLine|re: (?i)(?:set).*&&\s?set.*(?:environment|invoke|\$\{?input).*&&.*"
  condition: selection
falsepositives:
  - Unknown
level: high
license: DRL-1.1
related:
  - id: 9c14c9fa-1a63-4a64-8e57-d19280559490
    type: derived