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).
- Product
- windows
- Category
- ps_script
- Author
- Florian Roth (Nextron Systems) (SigmaHQ), DRL 1.1
- Published
- 2022-11-09
- Updated
- 2026-07-31
ATT&CK techniques
Recon
Resource Dev
Initial Access
Execution
Persistence
Priv Esc
Defense Evasion
Cred Access
Discovery
Lateral Movement
Collection
C2
Exfiltration
Impact
What it detects
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.
Reporting behind it
- mdsec.co.ukhttps://www.mdsec.co.uk/2018/06/exploring-powershell-amsi-and-logging-evasion/
- twitter.comhttps://twitter.com/cyb3rops/status/1588574518057979905?s=20&t=A7hh93ONM7ni1Rj1jO5OaA
- github.comhttps://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_amsi_bypass_pattern_nov22.yml
Changelog
v2- v2Candidate ingested via manual entry.2026-07-31
- v1No 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.
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