Detecting Persistence Through WMI Event Subscriptions

· Original article ↗

Summary

Explains how attackers abuse permanent Windows WMI event subscriptions for reboot-persistent execution and provides SIEM/Sysmon detections, relevant telemetry, and hardening advice.

Key points

  • Permanent WMI event subscriptions persist across reboots through linked filters, consumers, and bindings in the WMI repository.
  • Creating subscriptions requires local administrator privileges or SYSTEM access; CommandLineEventConsumer can launch processes, while ActiveScriptEventConsumer runs VBScript or JScript.
  • Command-line payloads may appear as children of WmiPrvSE.exe; script consumers run through scrcons.exe, providing process relationships for investigation.
  • Mandiant reported that APT29’s POSHSPY stored an encrypted, Base64-encoded PowerShell backdoor in a custom WMI class and used a timed subscription; the observed installation left no payload files outside the repository.
  • The article recommends collecting process-creation command lines, WMI-Activity events, and Sysmon Events 1, 11, and 19–21 to investigate subscription creation and execution.
  • Provided SIEM rules identify suspicious WMI bindings, WmiPrvSE.exe child processes, scrcons.exe activity, and related file writes; legitimate administration can produce similar activity.
  • Recommended steps include limiting local administrator access, protecting privileged credentials, reviewing permanent subscriptions, and validating logs and alerts in the environment.

Article Details

Defense Focus
Detect and investigate persistence through permanent WMI event subscriptions, including suspicious consumers and processes launched by WMI scripting hosts.
Detection Methods
  • Alert on newly created Sysmon Event 21 bindings that reference CommandLineEventConsumer or ActiveScriptEventConsumer; correlate with WMI-Activity Event 5861 and review Events 19 and 20 for filter and consumer context.
  • Identify suspicious child processes launched directly by WmiPrvSE.exe, and correlate them with suspicious permanent subscriptions.
  • Detect scrcons.exe running from its standard WMI path with svchost.exe as parent, then investigate its child processes.
  • Monitor Sysmon Event 11 for file creation or overwriting attributed to scrcons.exe.
  • Review permanent subscriptions in the root\subscription namespace and verify that their filters, consumers, and bindings are legitimate.
Data Sources
  • Windows Security Event ID 4688 with command-line details
  • Microsoft-Windows-WMI-Activity ETW provider and WMI-Activity/Operational Events 5857–5861
  • Sysmon Events 1, 11, 19, 20, and 21
Rule Types
  • GuardSix SIEM detection and hunt queries using process, parent-process, event-ID, consumer, and command-line fields
  • WQL queries used in WMI event filters
Platforms
  • Windows
  • Sysmon
  • GuardSix SIEM
Defensive Actions
  • Limit local administrator access and protect privileged credentials.
  • Review permanent WMI subscriptions and remove or investigate those without a legitimate purpose.
  • Ensure the required process-creation, WMI-Activity, and Sysmon logs reach the SIEM.
  • Validate the detection rules in the local environment and confirm that alerts fire as expected.
  • Investigate WmiPrvSE.exe and scrcons.exe child processes in the context of any suspicious subscription.

MITRE ATT&CK

T1027 · Obfuscated Files or InformationThe POSHSPY example stores an encrypted, Base64-encoded PowerShell backdoor in a custom WMI class.T1047 · Windows Management InstrumentationThe article describes attackers using WMI, including wmic or Impacket's wmiexec, to execute commands remotely.T1059.001 · PowerShellThe POSHSPY example uses a CommandLineEventConsumer to launch an encoded PowerShell command that retrieves, decrypts, and executes a stored backdoor.T1059.003 · Windows Command ShellThe detection examples identify command shells launched by WmiPrvSE.exe or scrcons.exe as suspicious WMI-related execution.T1059.005 · Visual BasicActiveScriptEventConsumer can execute VBScript payloads through scrcons.exe.T1059.007 · JavaScriptActiveScriptEventConsumer can execute JScript payloads through scrcons.exe.T1069.002 · Domain GroupsThe article says attackers use WMI to gather group membership and domain details.T1082 · System Information DiscoveryThe article says attackers use WMI to gather system and environment information.T1140 · Deobfuscate/Decode Files or InformationIn the POSHSPY example, the launched command retrieves and decrypts the backdoor stored in WMI before executing it in memory.T1490 · Inhibit System RecoveryThe article describes ransomware operators deleting volume shadow copies through WMI to weaken recovery.T1518.001 · Security Software DiscoveryThe article says attackers use WMI to discover installed antivirus products.T1546.003 · Windows Management Instrumentation Event SubscriptionAttackers can use permanent WMI event subscriptions, including linked filters, consumers, and bindings, to persist across reboots.T1562.004 · Disable or Modify System FirewallThe article says some actors use WMI to stop the firewall service.

Threat Actors

Malware

Vendors

Products

Tools

Related Articles