Potential Antimalware Scan Interface Bypass via PowerShell

Last updated 8 days ago on 2026-01-26
Created 3 years ago on 2023-01-17

About

Detects PowerShell scripts that references Antimalware Scan Interface (AMSI) bypass classes, methods, or known bypass strings. Attackers attempt AMSI bypass to disable scanning and run malicious PowerShell content undetected.
Tags
Domain: EndpointOS: WindowsUse Case: Threat DetectionTactic: Defense EvasionData Source: PowerShell LogsLanguage: kuery
Severity
high
Risk Score
73
MITRE ATT&CK™

Defense Evasion (TA0005)(external, opens in a new tab or window)

Execution (TA0002)(external, opens in a new tab or window)

License
Elastic License v2(external, opens in a new tab or window)

Definition

Rule Type
Query (Kibana Query Language)
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
winlogbeat-*logs-windows.powershell*
Related Integrations

windows(external, opens in a new tab or window)

Query
text code block:
event.category:"process" and host.os.type:windows and ( powershell.file.script_block_text : ( "System.Management.Automation.AmsiUtils" or amsiInitFailed or "Invoke-AmsiBypass" or "Bypass.AMSI" or "amsi.dll" or AntimalwareProvider or amsiSession or amsiContext or AmsiInitialize or unloadobfuscated or unloadsilent or AmsiX64 or AmsiX32 or FindAmsiFun or "AllocHGlobal((9076" or "[cHAr](65)+[cHaR]([byTe]0x6d)+[ChaR]([ByTe]0x73)+[CHaR]([BYte]0x69" ) or powershell.file.script_block_text:("[Ref].Assembly.GetType(('System.Management.Automation" and ".SetValue(") or powershell.file.script_block_text:("::AllocHGlobal((" and ".SetValue(" and "-replace" and ".NoRMALiZe(") ) and not powershell.file.script_block_text : ( "sentinelbreakpoints" and "Set-PSBreakpoint" )

Install detection rules in Elastic Security

Detect Potential Antimalware Scan Interface Bypass via PowerShell in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).