Detection rules › Sigma

Invoke-Obfuscation COMPRESS OBFUSCATION - PowerShell

Status
test
Severity
medium
Log source
product windows, category ps_script
Author
Timur Zinniatullin, oscd.community
Source
github.com/SigmaHQ/sigma

Detects Obfuscated Powershell via COMPRESS OBFUSCATION

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Invoke-Obfuscation COMPRESS OBFUSCATION - PowerShell
id: 20e5497e-331c-4cd5-8d36-935f6e2a9a07
status: test
description: Detects Obfuscated Powershell via COMPRESS OBFUSCATION
references:
    - https://github.com/SigmaHQ/sigma/issues/1009 # (Task 19)
author: Timur Zinniatullin, oscd.community
date: 2020-10-18
modified: 2022-11-29
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|contains|all:
            - 'new-object'
            - 'text.encoding]::ascii'
        ScriptBlockText|contains:
            - 'system.io.compression.deflatestream'
            - 'system.io.streamreader'
        ScriptBlockText|endswith: 'readtoend'
    condition: selection_4104
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

selection_4104

Stage 1: selection_4104

selection_4104:
    ScriptBlockText|contains|all:
        - 'new-object'
        - 'text.encoding]::ascii'
    ScriptBlockText|contains:
        - 'system.io.compression.deflatestream'
        - 'system.io.streamreader'
    ScriptBlockText|endswith: 'readtoend'

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
ScriptBlockTextends_with
  • readtoend
ScriptBlockTextmatch
  • new-object corpus 8 (sigma 7, splunk 1)
  • system.io.compression.deflatestream
  • system.io.streamreader
  • text.encoding]::ascii