Overview
The WMIEventConsumer command enumerates WMI Event Consumers configured on the system. WMI Event Consumers are actions that execute when specific WMI events occur. They are commonly abused for persistence, as they can execute commands or scripts based on system events without requiring traditional startup locations.Syntax
This command does not support remote execution.
Output
Returns WMI Event Consumer information:- Consumer name
- Consumer type (CommandLineEventConsumer, ActiveScriptEventConsumer, etc.)
- Command or script to execute
- Consumer creation timestamp
- Associated filter (if bound)
Use Cases
- Red Team
- Blue Team
- Identify existing WMI persistence mechanisms
- Find opportunities for WMI-based persistence
- Discover legitimate consumers to blend with
- Understand WMI event infrastructure
Example Output
Remote Execution
Detection Considerations
- WMI Namespace: Queries
root\subscriptionnamespace - Sysmon Events: Event ID 20 logs WMI consumer creation/modification
- Event Logs: WMI-Activity logs may capture consumer activity
- Persistence: Consumers survive reboots
Consumer Types
WMI Event Consumer Types
WMI Event Consumer Types
CommandLineEventConsumer:
- Executes command-line programs
- Most common for malicious use
- Runs with SYSTEM privileges
- Executes VBScript or JScript
- Can run encoded/obfuscated scripts
- High abuse potential
- Writes to log files
- Lower risk, monitoring/audit use
- Sends email notifications
- Can exfiltrate data
- Writes to Windows Event Log
- Legitimate administrative use
Defensive Recommendations
Detection and Response
Detection and Response
Detection:
- Enable Sysmon Event ID 19-21 (WMI events)
- Monitor
root\subscriptionnamespace - Alert on new consumer creation
- Baseline legitimate consumers
- Check consumer creation timestamps
- Validate consumer legitimacy
- Review associated filters and bindings
- Correlate with other persistence indicators
- Restrict WMI namespace permissions
- Monitor GPO for WMI filters
- Implement application whitelisting
- Use attack surface reduction rules
Related Commands
- WMIEventFilter - WMI event filters
- WMIFilterBinding - Filter-consumer bindings
- WMI - Custom WMI queries
- AutoRuns - Auto-start programs
- Services - Windows services