Safeguard
Application Security•

Detecting and Mitigating WMI Event Subscriptions (T1546.003)

WMI event filters, consumers and bindings can run code on a clock or logon, as SYSTEM. See how to list subscriptions and which logs to collect.

Safeguard Security Team
3 min read

WMI Event Subscription abuse (MITRE ATT&CK T1546.003) is a Windows persistence and privilege escalation technique. Windows Management Instrumentation (WMI) can install event filters, providers, consumers and bindings that run code when a defined event occurs. Events that can be subscribed to include the wall clock time, user login and the computer's uptime.

How attackers use it

An adversary subscribes to an event and sets code to run when it happens. That gives persistence with no startup folder entry, no run key and no service.

MITRE adds two details. Adversaries may compile WMI scripts into Managed Object Format (MOF) files, with the .mof extension, using mofcomp.exe, and use them to create a malicious subscription. And WMI subscription execution is proxied by the WMI Provider Host process, WmiPrvSe.exe, so the code may run with SYSTEM privileges.

A permanent subscription has three parts that work together:

  • An event filter, which describes what event to wait for.
  • An event consumer, which describes what to do.
  • A binding, which links a filter to a consumer.

All three need to exist, so finding one without its partners is rarely the full picture.

How to detect it

MITRE's strategy covers creation and execution:

  • Creation of EventFilter, EventConsumer and FilterToConsumerBinding objects, whether through WMI itself or through MOF file execution.
  • Command line use of mofcomp.exe.
  • Use of Register-WmiEvent in PowerShell.
  • Anomalous child processes of WmiPrvSe.exe, which show a triggered execution.
  • Odd process lineage and entries in WMI logging channels.

Sysmon helps directly. Its event IDs 19, 20 and 21 record WMI event filter, consumer and binding activity. The operational log under Microsoft-Windows-WMI-Activity is another source.

How to reduce the risk

MITRE lists three mitigations:

  1. Restrict remote WMI. By default only administrators can connect remotely using WMI. Restrict which other users can connect, or disallow all remote WMI connections.
  2. Avoid credential overlap. Keep administrator and privileged account credentials separate across systems, so one compromised host does not open others.
  3. Enable ASR rules. On Windows 10, Attack Surface Reduction rules can prevent malware from abusing WMI to gain persistence.

Check your own environment

In PowerShell, read-only:

Get-CimInstance -Namespace root\subscription -ClassName __EventFilter
Get-CimInstance -Namespace root\subscription -ClassName __EventConsumer
Get-CimInstance -Namespace root\subscription -ClassName __FilterToConsumerBinding

On most clean systems, these return little or nothing, apart from a few entries that come with Windows or well known management tools. For each result, record who owns it and what the consumer runs. If you see a CommandLineEventConsumer or ActiveScriptEventConsumer you cannot explain, escalate.

A short checklist:

  1. Are Sysmon WMI events 19, 20 and 21 sent to your log platform?
  2. Do you know which management products legitimately register subscriptions?
  3. Is remote WMI limited to the accounts and networks that need it?
  4. Is mofcomp.exe execution outside admin tooling alerting?

Quick check

Why does WMI persistence often run as SYSTEM?

Subscription execution is proxied by the WMI Provider Host process, WmiPrvSe.exe, which can run with SYSTEM privileges.

What three objects make up a permanent subscription?

An event filter, an event consumer and a binding that links them.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.