Skip to content
Threat Feed
high advisory

WMI Permanent Event Subscription Abuse for Persistence

Attackers use WMI permanent event subscriptions to execute malicious scripts or binaries for persistence by creating event consumers other than the default NTEventLogEventConsumer.

Attackers are increasingly leveraging Windows Management Instrumentation (WMI) permanent event subscriptions to establish persistence on compromised systems. This technique involves creating WMI event consumers that trigger malicious actions in response to specific system events. Unlike legitimate uses of WMI subscriptions for system administration, attackers create non-standard consumers to execute arbitrary code. By monitoring for deviations from expected WMI consumer behavior, defenders can identify and disrupt this persistence mechanism. This activity is significant because it allows attackers to maintain a foothold on the system, potentially leading to data theft, ransomware deployment, or other malicious activities.

Attack Chain

  1. An attacker gains initial access to a Windows system, often through phishing or exploiting a vulnerability.
  2. The attacker uses a tool like PowerShell to interact with the WMI service.
  3. The attacker creates a WMI filter to define specific events that will trigger the malicious action, using __EventFilter WMI class.
  4. The attacker creates a WMI consumer to execute a malicious script or binary, using __CommandLineEventConsumer or __ScriptingEventConsumer WMI classes.
  5. The attacker binds the filter and consumer together using __FilterToConsumerBinding WMI class, creating a permanent event subscription.
  6. The system event defined in the filter occurs (e.g., system startup, process creation).
  7. The WMI service executes the malicious script or binary defined in the consumer.
  8. The attacker maintains persistence, with the malicious code executing automatically whenever the specified event occurs.

Impact

Successful exploitation via WMI permanent event subscriptions can lead to long-term persistence on a compromised system. This can enable attackers to steal sensitive data, deploy ransomware, or perform other malicious activities undetected. The number of potential victims is broad, as this technique can be used against any Windows system where the attacker has sufficient privileges. The impact includes data breaches, financial losses, and reputational damage.

Recommendation

  • Enable Windows WMI activity logs by configuring the input stanza [WinEventLog://Microsoft-Windows-WMI-Activity/Operational] in inputs.conf.
  • Deploy the Sigma rule "Detect Suspicious WMI Event Consumer" to identify deviations from expected WMI consumer behavior.
  • Investigate any alerts generated by the Sigma rule "Detect WMI FilterToConsumerBinding Creation" to determine if the activity is malicious.
  • Monitor process creation events for unexpected processes spawned by WmiPrvSE.exe, as this is the WMI Provider Host process.

Detection coverage 2

Detect Suspicious WMI Event Consumer

high

Detects WMI event consumers other than the default NTEventLogEventConsumer, indicating potential malicious persistence.

sigma tactics: persistence techniques: T1047 sources: process_creation, windows

Detect WMI FilterToConsumerBinding Creation

medium

Detects the creation of WMI FilterToConsumerBinding objects, which link event filters to consumers.

sigma tactics: persistence techniques: T1047 sources: process_creation, windows

Detection queries are available on the platform. Get full rules →