Suspicious Child Process via Azure VM CustomScript Extension

Last updated a month ago on 2026-06-17
Created a month ago on 2026-06-17

About

Identifies a suspicious process executing as a descendant of the Azure VM CustomScript extension handler (CustomScriptHandler.exe) on a Windows host. The Azure CustomScript extension runs an attacker-supplied script with high privilege (SYSTEM) via the guest agent, and is a common cloud-to-host code-execution and persistence primitive. Because the extension's resource name is attacker-controlled and absent from on-host telemetry, this rule anchors on the type-bearing handler binary ('Microsoft.Compute.CustomScriptExtension\...\CustomScriptHandler.exe') rather than the spoofable extension name, making it resistant to renaming. CustomScript legitimately launches PowerShell and cmd, so the rule fires only when the descendant is an execution-proxy, download, or discovery LOLBin, or PowerShell exhibiting suspicious tradecraft.
Tags
Domain: EndpointOS: WindowsUse Case: Threat DetectionTactic: ExecutionTactic: Defense EvasionData Source: Elastic DefendLanguage: eql
Severity
medium
Risk Score
47
MITRE ATT&CK™

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

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

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

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
logs-endpoint.events.process-*
Related Integrations

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

Query
text code block:
sequence by host.id with maxspan=1m /* Azure CustomScript extension handler */ [process where host.os.type == "windows" and event.type == "start" and (process.name : "CustomScriptHandler.exe" or process.executable : "?:\\Packages\\Plugins\\*CustomScript*\\*\\CustomScriptHandler.exe")] by process.entity_id /* Abused LOLBin / suspicious PowerShell anywhere in its tree */ [process where host.os.type == "windows" and event.type == "start" and ( process.name : ("mshta.exe", "regsvr32.exe", "rundll32.exe", "installutil.exe", "msbuild.exe", "regasm.exe", "regsvcs.exe", "wscript.exe", "cscript.exe", "bitsadmin.exe", "nltest.exe", "whoami.exe", "net.exe", "net1.exe", "wmic.exe", "systeminfo.exe", "quser.exe", "arp.exe", "tasklist.exe") or (process.name : "certutil.exe" and process.args : ("*urlcache*", "*-decode*", "*-encode*")) or (process.name : ("powershell.exe", "pwsh.exe") and process.command_line : ("*-enc*", "*EncodedCommand*", "*FromBase64String*", "*DownloadString*", "*DownloadFile*", "*Invoke-Expression*", "*IEX *", "*IEX(*", "*|IEX*", "*-w hidden*", "*WindowStyle Hidden*", "*Net.WebClient*", "*Invoke-WebRequest*", "*Start-BitsTransfer*")) )] by process.Ext.ancestry

Install detection rules in Elastic Security

Detect Suspicious Child Process via Azure VM CustomScript Extension 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).