Persistence via WMI Event Subscription
Adversaries leverage Windows Management Instrumentation (WMI) to establish persistence by creating event subscriptions that trigger malicious code execution when specific events occur, often utilizing `wmic.exe` to create event consumers.
Triage facts
Revision 2- Evidence
- Unknown
- Severity
- Medium
- Sources
- 3 public sources
- Freshness
- Revision 2Jan 3, 14:27 UTC
- Detection
- 2 rules
Revision history 1 entry · Revision 2
- Revision 2
Repaired a legacy canonical identity collision
Changed: slug
Attackers can abuse Windows Management Instrumentation (WMI), a powerful Windows management framework, to maintain persistent access to systems. This involves creating WMI event filters, providers, consumers, and bindings that execute code upon specific event triggers. This technique allows threat actors to subscribe to events and execute arbitrary code when those events transpire, ensuring a persistent foothold on the targeted system. The detection focuses on the use of wmic.exe with specific arguments used to set up malicious WMI event subscriptions, a common method for attackers seeking to establish persistence. This activity can be difficult to detect without specific monitoring rules, making it a valuable technique for attackers targeting a wide range of Windows environments.
Attack Chain
- Initial Access: The attacker gains initial access to the system through various methods (not specified in source).
- Privilege Escalation: The attacker may attempt to elevate privileges to perform WMI tasks.
- Discovery: The attacker uses reconnaissance commands to explore the WMI environment.
- WMI Event Filter Creation: The attacker uses
wmic.exeto create a WMI event filter that defines the event to monitor. - WMI Event Consumer Creation: The attacker uses
wmic.exeto create an event consumer, such asActiveScriptEventConsumerorCommandLineEventConsumer, which specifies the action to take when the event occurs. This action is often malicious code execution. - WMI Binding Creation: The attacker creates a binding between the event filter and the event consumer, linking the trigger to the action.
- Persistence: The WMI event subscription ensures that the malicious code is executed whenever the defined event occurs, providing persistence.
- Execution: When the defined event occurs, the configured consumer executes the malicious payload.
Impact
Successful exploitation allows attackers to maintain persistent access to compromised systems. This can lead to data theft, system disruption, or further malicious activities within the network. Due to the nature of WMI, this persistence mechanism can be difficult to detect and remove, potentially granting long-term access to the attacker. This technique impacts all Windows systems where WMI is enabled.
Recommendation
- Monitor process execution for
wmic.exewith arguments "create", "ActiveScriptEventConsumer", or "CommandLineEventConsumer" to detect potential WMI event subscription abuse, as highlighted in the rule description. - Implement the provided Sigma rule to detect suspicious usage of
wmic.exerelated to WMI event subscription for persistence. - Investigate parent processes of
wmic.exefor unexpected or unauthorized activity. - Regularly review WMI event filters, consumers, and bindings for any unauthorized or suspicious entries using tools like
wevtutilor PowerShell.
Detection coverage 2
Detect WMI Event Subscription Creation via WMIC
mediumDetects the creation of WMI event subscriptions using wmic.exe with suspicious arguments.
Detect WMIC process spawning with persistence keywords
mediumDetects wmic.exe being used to create an ActiveScriptEventConsumer or CommandLineEventConsumer, often used for persistence.
Detection queries are available on the platform. Get full rules →