PowerShell Suspicious Payload Encoded and Compressed

edit

PowerShell Suspicious Payload Encoded and Compressed

edit

Identifies the use of .NET functionality for decompression and base64 decoding combined in PowerShell scripts, which malware and security tools heavily use to deobfuscate payloads and load them directly in memory to bypass defenses.

Rule type: query

Rule indices:

  • winlogbeat-*
  • logs-windows.*

Severity: medium

Risk score: 47

Runs every: 5 minutes

Searches indices from: now-9m (Date Math format, see also Additional look-back time)

Maximum alerts per execution: 100

Tags:

  • Elastic
  • Host
  • Windows
  • Threat Detection
  • Defense Evasion

Version: 3 (version history)

Added (Elastic Stack release): 8.0.0

Last modified (Elastic Stack release): 8.2.0

Rule authors: Elastic

Rule license: Elastic License v2

Potential false positives

edit

Legitimate PowerShell Scripts which makes use of compression and encoding.

Rule query

edit
event.category:process and powershell.file.script_block_text : (
( "System.IO.Compression.DeflateStream" or
"System.IO.Compression.GzipStream" or
"IO.Compression.DeflateStream" or "IO.Compression.GzipStream"
) and FromBase64String )

Threat mapping

edit

Framework: MITRE ATT&CKTM

Rule version history

edit
Version 3 (8.2.0 release)
  • Updated query, changed from:

    event.category:process and powershell.file.script_block_text : (
    (System.IO.Compression.DeflateStream or
    System.IO.Compression.GzipStream or IO.Compression.DeflateStream or
    IO.Compression.GzipStream) and FromBase64String )
Version 2 (8.1.0 release)
  • Formatting only