🖥️
Windows DFIR
  • Introduction
  • Windows Artifacts
    • Windows Quick Tips
      • Windows Command Line
      • Workstation File/Folder Locations
      • Server File/Folder Locations
    • Account Usage
      • Authentications SAM Artifacts
        • Last Login
        • Last Failed Login
        • Last Password Change
      • Authentications (Windows Event Log)
        • Logon ID
      • Group Membership
        • Event ID: 4798
        • Event ID: 4799
      • RDP
        • Source System Artifacts - Quick Reference
        • Destination System Artifacts - Quick Reference
      • SSH
      • Rouge Local Accounts
      • CrowdStrike Searches
        • Event Name - UserLogon
        • Event Name - UserLogonFailed
        • Event Name - UserLogonFailed2
        • Event Name - SsoApplicationAccess
    • Browser Usage
      • History & Downloads
        • Viewing History Files - DB Browser
        • Transition Types
      • Auto-Complete Data
      • Bookmarks
      • Browser Preferences
      • Cache
      • Cookies
      • Extensions
      • Super Cookies (HTML5 Web Storage)
      • Media History
      • Private Browsing
      • Session Restore
      • Stored Credentials
      • Suggested/Frequent Sites
      • DB Browser Queries
        • Firefox
        • Chrome
        • Media History
      • PowerShell Scripts
        • Browser Extension Finder
        • Browser History Finder
    • Processes
      • at.exe
      • explorer.exe
      • lsass.exe
      • lsaiso.exe
      • PuTTy.exe
        • X11 Forwarding
      • runtimebroker.exe
      • services.exe
      • smss.exe
      • System
      • svchost.exe
        • Services
      • winlogon.exe
      • wininit.exe
    • Cloud Storage
    • Deleted File or File Knowledge
      • WordWheelQuery (Win 7+)
      • ACMRU (Win XP)
      • Internet Explorer file:///
      • Last Visited MRU
      • Thumbs.db (Win XP)
      • Thumbcache
      • Recycle Bin
      • User Typed Paths
      • Windows Search Database
    • File Download
      • Zone.Identifer
      • Open/Save Most Recently Used (MRU)
      • Email
      • Drive By Downloads
        • Malvertising
      • Web Browsing
        • Cache Files
      • CrowdStrike Searches
        • MoTW
    • Folder/File Opening/Creation
      • Recent Files
      • Office Recent Files
      • Shell Bags
      • .lnk Files
      • Jump Lists
        • AppIDs
      • Prefetch
      • Index.dat file://
      • PowerShell Scripts
        • .lnk Files
    • Persistence
      • Registry
        • NTUSER.DAT & HKU\SID
        • Run and Run Once
        • Shell Folders and UserInit Key
        • Services
        • Logon Scripts
        • Office Add-ins
        • Winlogon Shell
        • Image File Execution Options (IFEO)
        • AppInit_DLLs
        • Scheduled Tasks
      • Scheduled Tasks
        • Scheduled Task Destination System Artifacts
        • Scheduled Task Source System Artifacts
      • Startup
      • Tool: AutoRuns
      • Accounts
      • WMI Event Consumers
        • WMI: Source System Artifacts
        • WMI: Destination System Artifacts
        • WMI: PowerShell Analysis
      • PowerShell Scripts
        • Startup Programs
      • CrowdStrike Searches
        • Files Written to Startup Folder
        • Files Written to Startup Folder from the Internet
        • Local Account Creation/Deletion
        • Azure Account Creation/Deletion
        • Scheduled Tasks
    • Physical Location
      • Time zone
      • Wireless SSID
      • Network History (Vista/Win7–11)
      • Cookies
      • Browser Search Terms
    • Program Execution
      • Prefetch
        • Decoding Prefetch Files with Eric Zimmerman's PECmd Tool
      • BAM/DAM
      • CapabilityAccessManager
      • UserAssist
      • Last Visited MRU
      • RunMRU
      • MUI Cache
      • ShimCache
      • Amcache
      • Jump Lists
    • Shadow Copies
      • VSC Permissions
      • Event ID 8193: Volume Shadow Copy Service Error
    • USB Usage
      • Key Identification
      • Drive Letter and Volume Name
      • Connection Timestamps
      • User
      • Volume Name
      • Plug & Play Event Log
    • Windows Services
      • DoSvc (Delivery Optimization)
    • System Information
    • Event IDs
      • Authentication / Account
        • 4624 - Authentication Success
          • Logon Types
        • 4625 - Authentication Failure
          • SubStatus Codes
        • 4634 - Account Logoff
        • 4648 - Explicit Credentials Success
        • 4672 - Special Privileges
        • 4720 - Account Creation
        • 4722 - Account Enabled
        • 4732 - Addition to Local Group
        • 4738 - Account Changed
        • 4776 - Kerberos Authentication Attempt
          • Substatus Codes
        • 4771 - Kerberos Failure
        • 4768
      • File System
        • 1006
        • 4688 - Process Created
        • 4663
        • 4656
        • 6416
        • 20001
        • 20003
  • Windows DFIR & MITTR
    • Initial Access
      • Content Injection
      • Drive-by Compromise
        • Watering Hole Attack
        • Microsoft Files (Payload Execution)
        • Exploit Delivery
        • Viewing Browser History Files
      • Phishing
    • Execution
    • Persistence
    • Privilege Escalation
    • Defense Evasion
    • Credential Access
      • Logon ID
    • Discovery
    • Lateral Movement
    • Collection
    • Command and Control
    • Exfiltration
    • Impact
  • SOC Related
    • Cached Credentials
    • Domain Controller Password Spraying
Powered by GitBook
On this page

Was this helpful?

  1. Windows Artifacts
  2. Persistence

WMI Event Consumers

WMI (Windows Management Instrumentation) Event Consumers represent a powerful and flexible feature within the Windows operating system, enabling automation and response to a wide array of system events. However, their capabilities also open avenues for both legitimate uses and potential abuse by threat actors.

How WMI Event Consumers Work

WMI Event Consumers are part of the WMI eventing system, which allows for actions to be taken in response to specific events within the system. This mechanism is based on three main components:

  1. Event Filters: Define the specific events to be monitored.

  2. Event Consumers: Specify the actions to take when the specified events occur.

  3. Binding: Links an Event Filter to an Event Consumer, determining that a particular action (Consumer) should occur in response to a particular event (Filter).

When a defined event occurs, WMI triggers the associated Event Consumer to perform its predefined action, such as executing a script or launching a program.

Legitimate Uses for WMI Event Consumers

  • System Monitoring and Management: Automating responses to system events (e.g., low disk space, high CPU usage) to maintain system health.

  • Software Deployment and Updates: Triggering software installation or updates in response to specific system states or schedules.

  • Security and Compliance: Implementing security policies, such as logging off users after a period of inactivity or enforcing system configurations.

Malicious Uses for WMI Event Consumers

  • Persistence: Malicious Event Consumers can be created to execute malware at system startup or in response to other events, ensuring the persistence of the threat.

  • Lateral Movement and Remote Execution: Event Consumers can be used to execute commands or payloads in response to triggers, facilitating lateral movement within a network.

  • Evasion: Malicious actors may leverage WMI Event Consumers to execute payloads indirectly, making detection and analysis more challenging.

Detection of Suspicious WMI Event Consumers

Detecting malicious use of WMI Event Consumers involves monitoring for unusual or unauthorized creation and use of these components. Key strategies include:

  • Monitoring WMI Namespaces for New or Modified Consumers: Regularly review registered Event Consumers, Filters, and Bindings for unexpected entries.

  • Analyzing Event Logs: The Microsoft-Windows-WMIActivity/Operational log provides evidence of WMI operations, including remote activity.

  • Command Line and PowerShell Logging: Enable command line and PowerShell logging to capture the execution of commands that may interact with WMI, including the creation or invocation of Event Consumers.

Investigation Techniques Using PowerShell

PowerShell provides several cmdlets for interacting with and investigating WMI, such as:

# List Registered Event Consumers
Get-WmiObject -Namespace root\subscription -Class __EventConsumer | Select-Object Name, CommandLineTemplate, ScriptText

# Investigate Specific Event Consumers
Get-WmiObject -Namespace root\subscription -Class ActiveScriptEventConsumer | Select-Object Name, ScriptText

# Query Event Filters and Bindings
$eventConsumerName = 'YourConsumerNameHere'
Get-WmiObject -Namespace root\subscription -Query "ASSOCIATORS OF {__EventConsumer.Name='$eventConsumerName'} WHERE AssocClass=__FilterToConsumerBinding"

# Investigate Event Filters
Get-WmiObject -Namespace root\subscription -Class __EventFilter | Select-Object Name, Query

Network Forensics for WMI Activity

  • Network monitoring can detect WMI traffic patterns, especially when commands are executed remotely. While WMI itself may not encrypt traffic, the use of WinRM for remote management (which includes WMI commands) does provide encryption, potentially hiding malicious commands.

Challenges in Tracking WMI Activity

  • Limited Logging: By default, Windows does not log detailed information about WMI activity, making detection and analysis difficult without enabling specific audit policies.

  • Complexity and Legitimacy: WMI is used extensively for legitimate administration tasks, complicating the differentiation between benign and malicious use.

  • Evasion Techniques: Malicious use of WMI can be designed to evade detection, such as by executing payloads directly in memory.

PreviousAccountsNextWMI: Source System Artifacts

Last updated 1 year ago

Was this helpful?