PowerShell AMSI Bypass Assembly GetType Pattern in Script Block Text

Flags PowerShell scripts containing a reflection-based AMSI bypass fragment with GetType and SetValue($null,$true).

FreeReviewedSigma · High · v2
Product
windows
Category
ps_script
Author
Florian Roth (Nextron Systems) (SigmaHQ), DRL 1.1
Published
2022-11-09
Updated
2026-07-31
title: PowerShell AMSI Bypass Assembly GetType Pattern in Script Block Text
id: 3c8a88db-dfa1-40b9-b962-552e92a06c4e
status: test
description: This rule matches PowerShell script block content containing a specific AMSI bypass pattern that references [Ref].Assembly.GetType along with additional obfuscation-related elements. Such behavior matters because attackers often use runtime reflection to locate and modify security-relevant types while evading inspection. The detection relies on Script Block Text content from PowerShell script logging to identify these exact string fragments.
references:
  - https://www.mdsec.co.uk/2018/06/exploring-powershell-amsi-and-logging-evasion/
  - https://twitter.com/cyb3rops/status/1588574518057979905?s=20&t=A7hh93ONM7ni1Rj1jO5OaA
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_amsi_bypass_pattern_nov22.yml
author: Florian Roth (Nextron Systems), Huntrule Team
date: 2022-11-09
tags:
  - attack.defense-impairment
  - attack.t1685
  - attack.execution
logsource:
  product: windows
  category: ps_script
  definition: "Requirements: Script Block Logging must be enabled"
detection:
  selection:
    ScriptBlockText|contains|all:
      - "[Ref].Assembly.GetType"
      - SetValue($null,$true)
      - NonPublic,Static
  condition: selection
falsepositives:
  - Unknown
level: high
license: DRL-1.1
related:
  - id: e0d6c087-2d1c-47fd-8799-3904103c5a98
    type: derived