PowerShell Module: Obfuscated STDIN Execution via cmd /c or cmd /r

Alerts when an obfuscated cmd->PowerShell payload uses stdin-style input and noexit/no-execution patterns.

FreeReviewedSigma · High · v2
Product
windows
Category
ps_module
Author
Jonathan Cheong, oscd.community (SigmaHQ), DRL 1.1
Published
2020-10-15
Updated
2026-07-31
title: "PowerShell Module: Obfuscated STDIN Execution via cmd /c or cmd /r"
id: 1852384a-6cbb-4a77-895a-ebdf4b5c4eff
related:
  - id: 779c8c12-0eb1-11eb-adc1-0242ac120002
    type: derived
  - id: 9ac8b09b-45de-4a07-9da1-0de8c09304a3
    type: derived
status: test
description: This rule identifies PowerShell module activity where an obfuscated command line uses cmd with /c or /r and includes PowerShell invocation that reads input from stdin (e.g., ${input} or $input) or related no-exit patterns. Attackers may use this technique to hide payload intent and deliver commands through stdin, complicating analysis and filtering. The detection relies on telemetry capturing the PowerShell module payload or command text and matching it against the specified obfuscation and stdin-based execution pattern.
references:
  - https://github.com/SigmaHQ/sigma/issues/1009
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_module/posh_pm_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_module
  definition: 0ad03ef1-f21b-4a79-8ce8-e6900c54b65b
detection:
  selection_4103:
    Payload|re: cmd.{0,5}(?:/c|/r).+powershell.+(?:\$\{?input\}?|noexit).+"
  condition: selection_4103
falsepositives:
  - Unknown
level: high
license: DRL-1.1