Execution (TA0002)(external, opens in a new tab or window)
Defense Evasion (TA0005)(external, opens in a new tab or window)
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).