← Back to SOC feed Coverage →

BadUSB LOLBIN execution via certutil (HID injection via Run dialog)

kql MEDIUM Azure-Sentinel
T1200T1027T1105
DeviceProcessEvents
huntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-07-03T11:00:00Z · Confidence: medium

Hunt Hypothesis

This hunt targets adversaries leveraging BadUSB devices to inject malicious commands via the Windows Run dialog, utilizing legitimate binaries like certutil.exe and cmd.exe to download or decode payloads while evading traditional signature-based detection. Proactively hunting for this specific execution chain in Azure Sentinel is critical to identify early-stage lateral movement and data exfiltration attempts that exploit trusted system processes to bypass standard endpoint security controls.

KQL Query

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

Analytic Rule Definition

id: d71e736b-f6e7-4acb-86f5-3696041868d7
name: 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.
requiredDataConnectors:
  - connectorId: MicrosoftThreatProtection
    dataTypes:
      - DeviceProcessEvents
tactics:
  - InitialAccess
  - DefenseEvasion
  - CommandAndControl
relevantTechniques:
  - T1200
  - T1027
  - T1105
query: |
  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
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: Name
        columnName: AccountName
      - identifier: NTDomain
        columnName: AccountDomain
  - entityType: Host
    fieldMappings:
      - identifier: HostName
        columnName: DeviceName

Required Data Sources

Sentinel TableNotes
DeviceProcessEventsEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Here are 4 specific false positive scenarios for the BadUSB LOLBIN execution via certutil detection rule, including suggested filters and exclusions:

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/MultipleDataSources/BadUSBCertutilLOLBIN.yaml