WMI Permanent Event Subscription
Description
The following analytic detects the creation of permanent event subscriptions using Windows Management Instrumentation (WMI). It leverages Sysmon EventID 5 data to identify instances where the event consumers are not the expected "NTEventLogEventConsumer." This activity is significant because it suggests an attacker is attempting to achieve persistence by running malicious scripts or binaries in response to specific system events. If confirmed malicious, this could lead to severe impacts such as data theft, ransomware deployment, or other damaging outcomes. Investigate the associated scripts or binaries to identify the source of the attack.
Query · spl
`wmi`
EventCode=5861
Binding
| rex field=Message "Consumer =\s+(?<consumer>[^;|^$]+)"
| search consumer!="NTEventLogEventConsumer=\"SCM Event Log Consumer\""
| stats count min(_time) as firstTime
max(_time) as lastTime
by ComputerName, consumer, Message
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| rename ComputerName as dest
| `wmi_permanent_event_subscription_filter`
Implementation guide
To successfully implement this search, you must be ingesting the Windows WMI activity logs. This can be done by adding a stanza to inputs.conf on the system generating logs with a title of [WinEventLog://Microsoft-Windows-WMI-Activity/Operational].
Known false positives
- Although unlikely, administrators may use event subscriptions for legitimate purposes.
Analyst notes
Known false positives: Although unlikely, administrators may use event subscriptions for legitimate purposes.