PowerShell Module Payload Obfuscation Using COMPRESS OBFUSCATION

Identifies PowerShell module payloads containing ASCII encoding and compression/stream obfuscation strings.

FreeReviewedSigma · Medium · v2
Product
windows
Category
ps_module
Author
Timur Zinniatullin, oscd.community (SigmaHQ), DRL 1.1
Published
2020-10-18
Updated
2026-07-31
title: PowerShell Module Payload Obfuscation Using COMPRESS OBFUSCATION
id: 7b68704f-2484-45ea-92a9-10932bcc27af
related:
  - id: 20e5497e-331c-4cd5-8d36-935f6e2a9a07
    type: derived
  - id: 7034cbbb-cc55-4dc2-8dad-36c0b942e8f1
    type: derived
status: test
description: Identifies PowerShell module activity where the module payload contains obfuscation-like patterns. The rule matches payload text that includes object creation and ASCII encoding usage, along with .NET compression and stream reading constructs and a terminal read-to-end call. This matters because attackers often compress and encode scripts to evade inspection; the detection relies on PowerShell module payload telemetry containing these specific string fragments.
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_compress.yml
author: Timur Zinniatullin, oscd.community, Huntrule Team
date: 2020-10-18
modified: 2022-11-29
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|contains|all:
      - new-object
      - text.encoding]::ascii
    Payload|contains:
      - system.io.compression.deflatestream
      - system.io.streamreader
    Payload|endswith: readtoend
  condition: selection_4103
falsepositives:
  - Unknown
level: medium
license: DRL-1.1