BadUSB LOLBIN execution via certutil (HID injection via Run dialog)
Description
Identifies certutil.exe or cmd.exe spawned by explorer.exe with download or decode flags, consistent with BadUSB HID injection payloads that use WIN+R to invoke certutil as a living-off-the-land binary. The explorer.exe parent distinguishes Run dialog execution from scripted or interactive certutil use. Covers urlcache download and base64 decode paths.
Query · kql
let timeframe = 1d;
let LolbinFlags = dynamic([
"urlcache",
"-decode",
"-decodehex",
"verifyctl"
]);
DeviceProcessEvents
| where TimeGenerated >= ago(timeframe)
| where (
FileName =~ "certutil.exe"
and InitiatingProcessFileName =~ "explorer.exe"
and ProcessCommandLine has_any (LolbinFlags)
)
or (
FileName =~ "cmd.exe"
and InitiatingProcessFileName =~ "explorer.exe"
and ProcessCommandLine has "certutil"
and ProcessCommandLine has_any (LolbinFlags)
)
| project
TimeGenerated,
DeviceName,
AccountName,
AccountDomain,
FileName,
ProcessCommandLine,
InitiatingProcessFileName,
InitiatingProcessCommandLine,
ReportId
| sort by TimeGenerated desc