PowerShell: FromBase64String Decoding of Gzip (H4sI) into MemoryStream

Identifies PowerShell script blocks that base64-decode and Gzip-unpack embedded content using in-memory streams.

FreeReviewedSigma · Medium · v2
Product
windows
Category
ps_script
Author
frack113 (SigmaHQ), DRL 1.1
Published
2022-12-23
Updated
2026-07-31

ATT&CK techniques

C2
  1. Recon

  2. Resource Dev

  3. Initial Access

  4. Execution

  5. Persistence

  6. Priv Esc

  7. Defense Evasion

  8. Cred Access

  9. Discovery

  10. Lateral Movement

  11. Collection

  12. Exfiltration

  13. Impact

What it detects

Identifies PowerShell script content that includes decoding from Base64 using FromBase64String, combined with in-memory handling via MemoryStream and a Gzip-like Base64 prefix ("H4sI"). This pattern is commonly used by attackers to package data as Base64 and then decompress/load it into memory for subsequent execution. Telemetry relies on Script Block Logging to capture the script block text containing these specific string fragments.

Related detections7 linkedT1132.001 — drag to rearrange
Malicious Project CAV3RN DNS Configuration Recovery via cloudlanecdn.com (via dns_query)
Malicious Credential Harvesting Request via All-in-1 PHP Endpoint (via proxy)
Suspicious Long Alphanumeric DNS Subdomain Indicative of DNS Tunneling
Suspicious DNS Tunneling With Hex Subdomain To info Domain (via dns_query)
PowerShell GzipStream Decompression Attempts on Windows
PowerShell FromBase64String Decoding of Base64 Gzip Content in Process Creation on Windows
Windows Execution of dnscat2 and iodine DNS Exfiltration/Tunneling Tools
PowerShell: FromBase64String Decoding of Gzip (H4sI) into MemoryStream
Pivot detection · T1132.001 · 7 related

Changelog

v2
  1. v2
    Candidate ingested via manual entry.2026-07-31
  2. v1
    No changelog recorded for this version.2026-07-30

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.