Persistence via WMI Event Subscription
Adversaries can leverage Windows Management Instrumentation (WMI) to establish persistence by creating event subscriptions that trigger malicious code execution when specific events occur, using tools like wmic.exe to create event consumers.
Windows Management Instrumentation (WMI) provides a powerful framework for managing Windows systems, but adversaries can abuse its capabilities to establish persistence. By creating WMI event subscriptions, attackers can execute arbitrary code in response to defined system events. This technique involves creating event filters, providers, consumers, and bindings that automatically run malicious code. This can be achieved through tools like wmic.exe, which allows the creation of event consumers such as ActiveScriptEventConsumer or CommandLineEventConsumer. Successful exploitation of WMI for persistence allows attackers to maintain unauthorized access to a compromised system, even after reboots or other system changes. This activity has been observed across various environments, highlighting the need for robust detection mechanisms to identify and prevent WMI-based persistence.
Attack Chain
- An attacker gains initial access to a Windows system through unspecified means.
- The attacker uses
wmic.exeto create a WMI event filter that defines a specific event to monitor. - A WMI event consumer, such as
ActiveScriptEventConsumerorCommandLineEventConsumer, is created usingwmic.exespecifying the malicious code or script to execute when the event occurs. - A WMI binding is established between the event filter and the event consumer using
wmic.exe, linking the event to the action. - The malicious WMI event subscription is activated, monitoring for the defined event.
- When the specified event occurs, the WMI service triggers the execution of the associated malicious code or script through the event consumer.
- The attacker gains persistent access to the system, as the WMI event subscription will re-activate after reboots.
- The attacker can then perform additional malicious activities, such as lateral movement or data exfiltration.
Impact
Successful exploitation of WMI for persistence can allow an attacker to maintain long-term, unauthorized access to a compromised system. This can result in data theft, system compromise, and further malicious activities. While the exact number of victims is not specified in the source, the broad applicability of this technique means that many Windows systems are potentially at risk. If the attack succeeds, the attacker gains a foothold on the system that is difficult to detect and remove, which can lead to significant operational disruption and financial loss.
Recommendation
- Enable process creation logging and monitor for
wmic.exewith command-line arguments related to creating event consumers, specificallyActiveScriptEventConsumerorCommandLineEventConsumer, to trigger the Sigma rule “Detect Suspicious WMIC Process”. - Deploy the provided Sigma rule to your SIEM to detect suspicious WMI event subscription creation.
- Review the investigation steps outlined in the provided documentation to triage and analyze potential WMI persistence attempts.
- Monitor Windows Security Event Logs and Sysmon for events related to WMI activity for broader coverage.
Detection coverage 2
Detect Suspicious WMIC Process
mediumDetects suspicious wmic.exe process executions with arguments indicative of WMI event subscription abuse.
Detect WMI Event Consumer Creation via Command Line
mediumDetects the creation of WMI event consumers using command-line tools, indicative of potential persistence mechanisms.
Detection queries are kept inside the platform. Get full rules →