Operator On The Wire
Join
← Back to Knowledge Base
BLUE TEAM / THREAT HUNT / WINDOWS / PERSISTENCE

WMI Event Subscription

This note documents detection patterns related to WMI Event Subscription within Windows environments.


Direct Indicators

LogEvent IDMeaningForensic ValueNotes
Sysmon19WMI Event Filter createdCriticalPrimary detection point. Captures creation of __EventFilter. Review filter name, namespace, query, creator process, and user context.
Sysmon20WMI Event Consumer createdCriticalCaptures creation of CommandLineEventConsumer, ActiveScriptEventConsumer, etc. Review payload command, script body, destination paths.
Sysmon21WMI Filter-to-Consumer binding createdCriticalConfirms full persistence chain completed. Review filter + consumer linkage.
Security4688Process creationHighUseful when attacker uses wmic.exe, powershell.exe, mofcomp.exe, scrcons.exe, or custom tooling to register subscription.
Sysmon1Process creationCriticalBest host-level execution evidence. Hunt for suspicious WMI-related commands and unusual parent-child chains.
Microsoft-Windows-WMI-Activity/Operational5857WMI provider startedMediumHelps identify provider load context. Often noisy but valuable when correlated.
Microsoft-Windows-WMI-Activity/Operational5858WMI operation failedMediumSometimes reveals malformed attacker queries or namespace abuse.
Microsoft-Windows-WMI-Activity/Operational5860 / 5861WMI consumer activityHighUseful for consumer execution tracking depending on OS version and logging state.
Security4624Successful logonHighCorrelate attacker logon before persistence creation. Review LogonType, source host, account.
Security4672Special privileges assignedHighElevated token often precedes subscription registration.
Sysmon11File createMediumConsumers may drop scripts, payloads, temp files, staging artifacts.
Sysmon7Image loadedMediumUseful when script engines or uncommon DLLs load during consumer execution.
PowerShell4104Script block loggingCriticalIf PowerShell creates WMI subscription, often captures exact Set-WmiInstance, Register-WmiEvent, or CIM calls.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Persistent WMI repository changesNew objects under root\subscriptionCriticalCore persistence footprint. Rare in normal endpoints outside management software.
Consumer executes unexpected commandHidden PowerShell, cmd, rundll32, regsvr32CriticalStrong malicious signal.
Suspicious timer queriesWITHIN 5 WHERE TargetInstance ISA...HighAttackers often use polling intervals for trigger conditions.
Event subscription on workstationNew subscription outside enterprise management baselineHighWorkstations usually have few legitimate custom subscriptions.
Encoded PowerShell in consumerBase64 command stringsCriticalStrong malicious persistence indicator.
Unusual creator processOffice, browser, archive tool spawning WMI registrationHighVery abnormal chain.
Follow-on lateral movementRemote WMI execution after subscription creationHighWMI persistence often coexists with remote admin abuse.
Delayed beacon after triggerConsumer fires minutes/hours laterHighAttackers use delayed execution to avoid immediate detection.
Namespace abuse outside root\subscriptionCustom namespacesMediumLess common but important for stealth cases.

Common Tools

ToolUsage
PowerShellSet-WmiInstance, Register-WmiEvent, CIM cmdlets for filter/consumer creation
WMICLegacy creation and interaction with WMI objects
mofcomp.exeCompile MOF files into repository
PowerSploitOffensive WMI persistence modules
EmpireCommon WMI persistence module
Cobalt StrikeWMI persistence available through operator scripts
ImpacketWMI execution tooling adjacent to persistence
Custom COM / VBScriptDirect COM interaction with repository

Relevant Artifacts

  • Sysmon Event IDs 19, 20, 21 (highest-value evidence)
  • WMI repository: C:\Windows\System32\wbem\Repository\
  • WMI namespace: root\subscription
  • PowerShell logs: 4103 / 4104
  • Security logs: 4688, 4624, 4672
  • WMI Operational log: Microsoft-Windows-WMI-Activity/Operational
  • Prefetch: WMIC.EXE, POWERSHELL.EXE, MOFCOMP.EXE, SCRCONS.EXE
  • Amcache / ShimCache for tool execution
  • MFT / USN Journal for MOF or payload file creation
  • Registry persistence cross-check: WMI often coexists with Run Keys / Tasks
  • EDR process trees showing delayed consumer execution

MITRE ATT&CK References

  • T1546.003 WMI Event Subscription
  • T1047 Windows Management Instrumentation
  • T1059 PowerShell
  • T1546 Event Triggered Execution

Decision Tree

  1. Is suspicious WMI subscription present?

    • Check Sysmon 19/20/21
    • Enumerate root\subscription
  2. What created it?

    • Pivot to 4688 / Sysmon 1
    • Identify parent process and command line
  3. Is consumer malicious?

    • Inspect payload:
      • PowerShell
      • cmd.exe
      • rundll32
      • script body
  4. When does it trigger?

    • Timer
    • Process creation
    • Logon event
    • System event
  5. Pivot:

    • User logon context
    • Network beacon
    • Additional persistence
  6. Scope:

    • Single host?
    • Lateral deployment?
    • Management software false positive?

Example Detection Templates

KQL

Sysmon
| where EventID in (19,20,21)
| project TimeGenerated, Computer, EventID, User, EventData
| order by TimeGenerated desc
Sysmon
| where EventID == 20
| where EventData has_any ("powershell", "cmd.exe", "rundll32", "regsvr32")
| project TimeGenerated, Computer, User, EventData
SecurityEvent
| where EventID == 4688
| where CommandLine has_any ("wmic", "Set-WmiInstance", "Register-WmiEvent", "mofcomp")
| project TimeGenerated, Computer, Account, CommandLine, ParentProcessName

EQL

process where process.command_line like "*wmic*" or process.command_line like "*Set-WmiInstance*" or process.command_line like "*Register-WmiEvent*"
sequence by host.name with maxspan=5m
  [ process where process.command_line like "*wmic*" ]
  [ any where event.code in ("19","20","21") ]

Sigma

title: Suspicious WMI Event Subscription Creation
id: 4b7d2c88-wmi-subscription
status: experimental
description: Detects WMI event subscription creation often associated with persistence
references:
  - https://attack.mitre.org/techniques/T1546/003/
author: Vergil
date: 2026-03-07
logsource:
  product: windows
  service: sysmon
detection:
  selection:
    EventID:
      - 19
      - 20
      - 21
  condition: selection
fields:
  - EventID
  - User
  - EventData
falsepositives:
  - SCCM
  - Enterprise monitoring tools
level: high
tags:
  - attack.persistence
  - attack.t1546.003

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Sysmon coverageEnable 19/20/21 everywhereCriticalCore visibility
Namespace auditingRegularly enumerate root\subscriptionHighDetect persistence drift
PowerShell loggingEnable 4104HighCaptures script-based creation
WMI ACL hardeningRestrict who can write subscriptionsHighReduces abuse surface
Baseline management toolsKnow legitimate subscriptionsCriticalAvoid false positives