PowerShell Obfuscated stdin launcher using cmd /c or cmd /r patterns

Detects PowerShell script blocks that use obfuscated STDIN-driven cmd/powershell execution patterns.

FreeReviewedSigma · High · v2
Product
windows
Category
ps_script
Author
Jonathan Cheong, oscd.community (SigmaHQ), DRL 1.1
Published
2020-10-15
Updated
2026-07-31
title: PowerShell Obfuscated stdin launcher using cmd /c or cmd /r patterns
id: d8e8f341-b49c-4711-9f76-a47cea95b3f9
status: test
description: This rule flags PowerShell script block content that matches obfuscated execution patterns involving cmd /c or cmd /r and PowerShell invocation that references stdin (input) with variations such as {input} or noexit. Attackers may use stdin-based launching and command-line indirection to conceal execution and evade simpler detections. It relies on PowerShell Script Block Logging telemetry capturing the script block text for pattern matches.
references:
  - https://github.com/SigmaHQ/sigma/issues/1009
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_invoke_obfuscation_stdin.yml
author: Jonathan Cheong, oscd.community, Huntrule Team
date: 2020-10-15
modified: 2024-04-05
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|re: cmd.{0,5}(?:/c|/r).+powershell.+(?:\$?\{?input\}?|noexit).+"
  condition: selection_4104
falsepositives:
  - Unknown
level: high
license: DRL-1.1
related:
  - id: 779c8c12-0eb1-11eb-adc1-0242ac120002
    type: derived