Overview
The WMIFilterBinding command enumerates WMI Filter-to-Consumer bindings. These bindings connect WMI Event Filters (triggers) to Event Consumers (actions), creating complete event-driven automation or persistence mechanisms. A binding is necessary for a WMI event to actually execute an action - the filter and consumer alone are not sufficient.Syntax
This command does not support remote execution.
Output
Returns WMI Filter Binding information:- Filter name (trigger condition)
- Consumer name (action to execute)
- Binding creation timestamp
- Creator SID
Use Cases
- Red Team
- Blue Team
- Identify active WMI persistence mechanisms
- Understand complete event-action chains
- Find orphaned filters or consumers
- Discover WMI-based automation
Example Output
Remote Execution
Detection Considerations
- WMI Namespace: Queries
root\subscriptionnamespace for__FilterToConsumerBindinginstances - Sysmon Events: Event ID 21 logs binding creation/modification
- Event Logs: WMI-Activity logs may capture binding activity
- Persistence: Bindings survive reboots and execute with SYSTEM privileges
Understanding the Binding Relationship
WMI Persistence Components
WMI Persistence Components
Three Required Components:
-
Event Filter (Trigger)
- Defines WHEN something happens
- WQL query monitoring system events
- Example: Process creation, system boot, time interval
-
Event Consumer (Action)
- Defines WHAT to execute
- Command, script, or other action
- Example: Run executable, execute script
-
Filter-to-Consumer Binding (Connection)
- Links filter to consumer
- Activates the persistence mechanism
- Without binding, filter and consumer are inactive
Detection Strategy
Hunting for WMI Persistence
Hunting for WMI Persistence
Step 1: Enumerate All ComponentsStep 2: Correlate Components
- Match binding filter/consumer names
- Verify all three components exist
- Check creation timestamps
- Validate creator SIDs
- Review filter WQL queries
- Examine consumer commands
- Check for obfuscation (Base64, encoding)
- Validate business justification
- Recently created bindings
- Boot/logon triggers
- PowerShell execution
- Encoded commands
- Non-standard paths
- SYSTEM privilege consumers
Removal Procedure
Removing WMI Persistence
Removing WMI Persistence
PowerShell Method:Note: Remove all three components (binding, filter, consumer) for complete cleanup.
Related Commands
- WMIEventFilter - WMI event filters (triggers)
- WMIEventConsumer - WMI event consumers (actions)
- WMI - Custom WMI queries
- AutoRuns - Auto-start programs
- Services - Windows services
- Sysmon - Sysmon event monitoring