| Technique | Windows Management Instrumentation (T1047) |
| Tactic | Execution |
| Platforms | Windows |
Overview
Windows Management Instrumentation (WMI) is a built-in Windows administration framework that allows querying system state, executing commands, and managing configuration both locally and remotely. Attackers abuse WMI to run arbitrary payloads, perform reconnaissance, delete shadow copies, and move laterally — all through a legitimate, pre-installed Windows component that many environments do not actively monitor.
Because WMI is native to Windows and used by countless legitimate management tools, malicious WMI activity blends into normal operational noise. Every security team needs WMI detection coverage because it appears in ransomware pre-deployment stages, advanced persistent threat lateral movement, and living-off-the-land (LotL) attack chains — often as the execution mechanism that delivers the final payload.
Attacker Perspective
Attackers leverage WMI because it provides a powerful, signed, built-in execution engine that bypasses application whitelisting controls and leaves a minimal footprint compared to dropping standalone executables.
- Remote command execution via wmic.exe: Adversaries run commands on remote hosts using
wmic.exe /node:192.168.1.50 process call create "cmd.exe /c whoami > C:\output.txt", authenticating with stolen credentials and avoiding the need to transfer any tools. - WMI event subscription persistence: Attackers create permanent WMI event subscriptions using PowerShell or mofcomp.exe to execute a payload every time a system boots or a user logs on, using classes such as
__EventFilter,__EventConsumer, and__FilterToConsumerBinding. - Ransomware shadow copy deletion: Ransomware families (e.g., Conti, LockBit) routinely execute
wmic.exe shadowcopy deleteor invoke the equivalent WMI COM API call via PowerShell to destroy volume shadow copies before encrypting files. - Lateral movement via WMI over DCOM: Frameworks such as Impacket’s
wmiexec.pyand CrackMapExec use WMI over DCOM (TCP port 135) to spawn semi-interactive shells on remote hosts, with command output written to a temporary share rather than a persistent file on disk.
WMI is attractive to attackers because it is signed by Microsoft, present on every Windows system, difficult to disable in enterprise environments, and frequently excluded from security tooling that focuses on suspicious executable drops rather than in-memory or API-based execution.
Detection Strategy
Required Telemetry
- Windows Security Event Log — Process Creation (Event ID 4688): Enable via GPO at Computer Configuration → Windows Settings → Security Settings → Advanced Audit Policy Configuration → Detailed Tracking → Audit Process Creation. Also enable command-line logging via GPO:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit → ProcessCreationIncludeCmdLine_Enabled = 1. This is mandatory — without command-line arguments, WMI detection is nearly impossible. - Sysmon Event ID 1 (Process Create): Provides richer telemetry than 4688, including
ParentImage,ParentCommandLine,Hashes, andUserfields. Deploy via Sysmon with a configuration that includes WMI-related process rules (e.g., SwiftOnSecurity or Florian Roth’s sysmon-config). Sysmon is strongly preferred over 4688 alone. - Sysmon Event ID 3 (Network Connection): Captures outbound network connections from
WmiPrvSE.exeandwmic.exe. Essential for detecting remote WMI usage and C2 callbacks spawned through WMI execution. - Sysmon Event ID 19, 20, 21 (WMI Event Activity): Specifically designed for WMI persistence detection. Event ID 19 logs
__EventFiltercreation, Event ID 20 logs__EventConsumercreation, and Event ID 21 logs__FilterToConsumerBinding. These three together are the primary signal for WMI subscription-based persistence. No additional GPO configuration is needed beyond deploying Sysmon. - Windows Security Event Log — Object Access (Event ID 4656/4663): Enable auditing on the WMI repository directory
C:\Windows\System32\wbem\Repository\to detect modifications that indicate new MOF file registration or persistence implantation. Enable via Advanced Audit Policy → Object Access → Audit File System and set a SACL on the directory. - Microsoft-Windows-WMI-Activity/Operational Log (Event IDs 5857, 5858, 5859, 5860, 5861): Found at
Applications and Services Logs\Microsoft\Windows\WMI-Activity\Operational. Event ID 5861 specifically logs new permanent WMI event consumer registrations and is a high-fidelity persistence signal. Enable via Event Viewer or GPO log forwarding. Forward this log to your SIEM explicitly — it is not included in default Windows Event Forwarding subscriptions. - Windows Security Event Log — Logon Events (Event ID 4624/4625): For remote WMI, look for Type 3 (network) logons preceding WMI activity. Correlate with WMI execution events to identify credential-based lateral movement.
- PowerShell Script Block Logging (Event ID 4104): Enable via GPO:
HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging → EnableScriptBlockLogging = 1. Attackers increasingly use PowerShell’s WMI COM interface (Invoke-WmiMethod,Get-WmiObject,[wmiclass]) instead of wmic.exe, and this log captures the full script content. - EDR Telemetry: If available (CrowdStrike, Defender for Endpoint, SentinelOne), EDR process trees and WMI provider host activity provide the highest-fidelity signal. EDR telemetry should be your first pivot point before falling back to event logs.
Key Indicators
- Suspicious parent-child process relationship — WmiPrvSE.exe spawning shells: In log source Sysmon Event ID 1 or Security Event ID 4688, check
ParentImage=C:\Windows\System32\wbem\WmiPrvSE.exewithImageequal tocmd.exe,powershell.exe,mshta.exe,wscript.exe,cscript.exe,regsvr32.exe, orrundll32.exe. This is one of the highest-fidelity WMI execution indicators available. - wmic.exe process creation invocation: In Sysmon Event ID 1, check
Imagecontainswmic.exeandCommandLinecontainsprocess call create. This pattern is almost exclusively used for offensive or administrative automation and warrants investigation every time. - Shadow copy deletion command: In Sysmon Event ID 1 or 4688, check
CommandLinecontainsshadowcopy deleteorshadowcopy whereor the PowerShell equivalentWin32_ShadowCopywith aDelete()method call. This is a near-certain ransomware pre-detonation indicator. - Remote WMI execution pattern: In Sysmon Event ID 1, check
CommandLinecontains/node:combined withprocess call create. In network logs or Sysmon Event ID 3, check for outbound connections fromwmic.exeorWmiPrvSE.exeonDestinationPort=135to non-infrastructure remote hosts. - WMI persistence via event subscription: In Sysmon Event IDs 19/20/21, any creation event for
__EventFilter,__EventConsumer, or__FilterToConsumerBindingoutside of known management software (e.g., SCCM, antivirus) should be investigated. In WMI-Activity/Operational Event ID 5861, any newActiveScriptEventConsumerorCommandLineEventConsumerregistration is high-fidelity malicious activity. - Encoded or obfuscated PowerShell launched via WMI: In Event ID 4104 (Script Block Logging), look for blocks containing
Invoke-WmiMethodorGet-WmiObjectcombined with-EncodedCommand,[Convert]::FromBase64String, orIEX. In Sysmon Event ID 1, checkParentImage=WmiPrvSE.exeandCommandLinecontains-encor-EncodedCommand. - WMI repository modification: In Sysmon Event ID 11 (File Create) or Security Event ID 4663, check
TargetFilenameorObjectNamepath contains\wbem\Repository\or\wbem\with a.moffile extension, especially from unexpected parent processes. MOF file compilation viamofcomp.exeis a classic WMI persistence installation method. - Lateral movement indicator — WMI activity following a new network logon: Correlate Security Event ID 4624 with
LogonType = 3from a remote source IP, followed within 60 seconds by Sysmon Event ID 1 showingParentImage = WmiPrvSE.exeon the same host. This sequence is a strong indicator of remote WMI-based lateral movement.
Detection Logic
Rule 1 — WmiPrvSE Spawning Interactive Shell or Scripting Engine (High Sensitivity):
IF EventID = 1 (Sysmon) OR EventID = 4688 (Security) AND ParentImage ENDSWITH "WmiPrvSE.exe" AND Image IN ["cmd.exe", "powershell.exe", "mshta.exe", "wscript.exe", "cscript.exe", "rundll32.exe", "regsvr32.exe", "msiexec.exe"] THEN alert HIGH
This catches the most common post-WMI-execution pattern: a shell or script interpreter being spawned by the WMI provider host. Volume will be moderate in environments with WMI-based management tools; tune by excluding known-good parent-child pairs tied to SCCM, monitoring agents, or antivirus. This is your broadest and most important rule — enable it first.
Rule 2 — wmic.exe Remote Process Creation (Medium Precision):
IF EventID = 1 (Sysmon) AND Image ENDSWITH "wmic.exe" AND CommandLine CONTAINS "/node:" AND CommandLine CONTAINS "process call create" AND NOT User IN [approved_admin_accounts] THEN alert HIGH
This targets explicit remote WMI process invocation. False positive volume is low because process call create with a remote node is rarely legitimate outside of specific admin workflows. Maintain an approved admin account allowlist and review it quarterly.
Rule 3 — WMI Permanent Event Subscription Created (High Precision):
IF (EventID IN [19, 20, 21] (Sysmon)) OR (EventID = 5861 (WMI-Activity/Operational)) AND NOT Image IN [approved_management_processes] AND NOT User IN [SYSTEM, approved_service_accounts] THEN alert CRITICAL
Permanent WMI event subscriptions are almost never created by end users or standard applications. This rule has very low false positive rates and catches both direct attacker activity and malware-installed persistence. Expect near-zero volume in a healthy environment — any alert here should be treated as confirmed malicious until proven otherwise.
Rule 4 — Shadow Copy Deletion via WMI (High Precision, Ransomware Pre-Detonation):
IF EventID = 1 (Sysmon) AND (CommandLine CONTAINS "shadowcopy delete" OR CommandLine CONTAINS "Win32_ShadowCopy" AND CommandLine CONTAINS "Delete") AND Image IN ["wmic.exe", "powershell.exe", "cmd.exe"] THEN alert CRITICAL — escalate immediately
Shadow copy deletion is a pre-ransomware indicator with virtually no legitimate use case outside of approved backup management scripts. Alert volume should be zero in normal operations. Any firing of this rule during an incident should trigger your ransomware response playbook immediately, as encryption may be imminent or already in progress.
Tuning Guidance
- Microsoft System Center Configuration Manager (SCCM/MECM): SCCM heavily uses WMI for inventory, software deployment, and compliance checks, and will generate substantial WmiPrvSE.exe child process activity. Identify the SCCM client process (
CcmExec.exe) and the SCCM server IP range, then add exclusions such asParentImage = "CcmExec.exe"orSourceIP IN [sccm_server_range]to Rule 1. - Antivirus and EDR agents: Security products such as CrowdStrike Falcon, Carbon Black, and Symantec Endpoint Protection interact with WMI for system telemetry. Exclude their known process names (e.g.,
CSFalconService.exe,cb.exe) from WmiPrvSE child process rules after confirming hashes match vendor-signed binaries. - Monitoring and observability tools: Products like SolarWinds, Nagios, PRTG, and Datadog use WMI to collect Windows performance counters and system metrics remotely. Exclude their service account names (e.g.,
User IN [solarwinds_svc, prtg_svc]) and source IP ranges from remote WMI detection rules. - Windows Remote Management and PowerShell remoting: Legitimate administrative use of
Invoke-Commandor Enter-PSSession can trigger WMI-adjacent telemetry. Scope exclusions tightly by user (named admin accounts only, not generic service accounts) and by source workstation (admin jump hosts only). - Software deployment and patch management tools: Ivanti, Tanium, and similar endpoint management platforms use WMI extensively. Build a baseline of their normal WMI activity patterns before deploying these rules in production, and use a time-boxed allowlist that requires periodic re-approval.
When the Alert Fires: Investigation Steps
- Verify the alert is real by confirming the raw event: Locate the original event in your SIEM using the host name, timestamp, and Event ID from the alert. Pull the raw event and confirm the
CommandLine,ParentImage,User, andProcessIdfields are populated and match the alert exactly — rule out data parsing errors before proceeding. - Identify the affected host and user, and flag privilege level: Determine whether the account that executed the WMI activity is a standard user, local administrator, or domain administrator by checking Active Directory group memberships via your IdP or SIEM identity enrichment. A privileged account executing suspicious WMI commands is an immediate escalation trigger requiring senior analyst review.
- Reconstruct the full process ancestry chain: Using Sysmon Event ID 1 or EDR process tree data, trace the parent chain from the suspicious process back to its origin — specifically look for whether the chain leads to a user-launched application, a phishing document (Word, Excel, PDF), a browser, or an already-compromised service. In Splunk, pivot on
ParentProcessIditeratively; in Defender for Endpoint, use the Process Tree view in the alert. - Check for network connections and files written to disk around the same timeframe: Query Sysmon Event ID 3 for network connections from the identified process or
WmiPrvSE.exewithin ±5 minutes of the alert timestamp, paying attention to external or unusual internal IP addresses. Also query Sysmon Event ID 11 (File Create) for any new executables, scripts, or DLLs dropped by the process or its children, particularly in%TEMP%,C:\ProgramData\, orC:\Windows\Temp\. - Look for lateral movement originating from this host: Search Windows Security Event ID 4624 with
LogonType = 3andIpAddress= the affected host’s IP to identify remote authentication attempts to other systems. Also check for Sysmon Event ID 3 fromwmic.exeorWmiPrvSE.execonnecting to other internal hosts on port 135 (DCOM) or 5985/5986 (WinRM) — this directly indicates active lateral movement. - Search for persistence mechanisms installed on the host: Query Sysmon Event IDs 19, 20, and 21 and WMI-Activity/Operational Event ID 5861 for any WMI subscriptions created around the time of the alert. Additionally, check Sysmon Event ID 13 (Registry Value Set) for new
Run/RunOncekeys and Sysmon Event ID 1 forschtasks.exeorsc.exeexecutions — attackers often combine WMI execution with a secondary persistence mechanism. - Make the escalation decision based on specifics, not just the alert: Escalate to a confirmed incident if you observe any of the following: WmiPrvSE.exe spawning a shell that connects to an external IP, shadow copy deletion commands, WMI event subscriptions created by non-system accounts, or the same WMI pattern replicated across multiple hosts. Classify as likely benign and document for tuning if the activity matches a known management tool, the user is a named IT administrator operating during business hours, and no network connections or dropped files were observed.
Response Playbook
Containment
- Isolate the host from the network immediately, but leave it powered on: Use your EDR console (CrowdStrike Network Containment, Defender for Endpoint Isolate Device, or SentinelOne Network Quarantine) to cut off network access while preserving volatile memory (running processes, network sockets, open handles) for forensic acquisition. Do not power off the machine until memory has been captured if the compromise is confirmed.
- Disable the affected user account without deleting it: In Active Directory, disable the account via
Disable-ADAccount -Identity <username>or the ADUC console. If the account is a service account, coordinate with the application owner before disabling. Preserve the account object for forensic review of logon history and group memberships. - Block identified C2 IPs and domains at the perimeter and DNS layer: Submit any external IPs or domains observed in network connections from the WMI execution to your firewall team for immediate block, and add them to your DNS sinkhole or Protective DNS blocklist. Create a time-bounded block rule rather than a permanent one so it can be reviewed after the investigation concludes.
- Kill the malicious process and any identified child processes: If EDR isolation is not immediately available, use the EDR console’s remote kill capability or PsExec to terminate the malicious process by PID. Document the PID and process name before termination. Do not attempt to kill WmiPrvSE.exe itself — terminate only the malicious child processes it spawned.
- Invalidate active sessions and Kerberos tickets for the compromised account: Run
Invoke-ADAsreproastto check for existing ticket exposure, then useGet-ADUser -Identity <user> | Set-ADUser -Replace @{msDS-SupportedEncryptionTypes=0}combined with a password reset to force Kerberos ticket invalidation. If Azure AD/Entra ID is in scope, revoke all refresh tokens viaRevoke-AzureADUserAllRefreshToken.
Eradication
- Remove all identified WMI event subscriptions: On the affected host, run
Get-WMIObject -Namespace root\subscription -Class __EventFilter | Remove-WmiObject, and repeat for__EventConsumerand__FilterToConsumerBinding. Verify removal and document all subscription names, query strings, and consumer scripts before deletion — these are critical IOCs. - Delete all dropped payloads and tools identified during investigation: Remove every file identified in the Sysmon Event ID 11 review, including any files in
%TEMP%,C:\ProgramData\, or\wbem\that were created by malicious processes. Calculate SHA256 hashes before deletion and submit them to your threat intel platform and VirusTotal for enrichment. - Remove additional persistence mechanisms identified during investigation: Delete any malicious scheduled tasks (
schtasks /delete /tn "<taskname>" /f), registry Run keys, or malicious services (sc delete <servicename>) discovered during the investigation step. Re-run a Sysmon and Autoruns baseline scan after removal to confirm no secondary persistence remains. - Reset credentials for every account that executed or was used in the attack chain: This includes the primary compromised account, any service accounts whose credentials may have been harvested, and local administrator accounts on the affected host. If the KRBTGT account was in scope or a DCSync was suspected, perform a double KRBTGT password reset per Microsoft’s documented procedure.
- Audit and clean lateral movement targets: For every host the attacker touched (identified in Step 5 of the investigation), repeat the WMI subscription check, persistence scan, and dropped file review. Do not assume only the initially compromised host was impacted — treat each lateral movement target as a potentially full compromise requiring its own eradication sweep.
Recovery
- Verify the host is clean before reconnecting it to the network: Run a full EDR scan and review Autoruns output on the isolated host. If confidence in cleanliness is below 100% — particularly if the attacker had extended dwell time, if memory forensics showed in-memory-only implants, or if EDR was tampered with — re-image the host from a known-good baseline rather than attempting further remediation in place.
- Re-enable the affected user account only after confirming no persistence remains: Before re-enabling, require the user to change their password on a clean device and confirm MFA enrollment. Brief the user on the attack vector (e.g., phishing document that led to WMI execution) so they can recognize similar attempts in the future.
- Implement enhanced monitoring on the recovered host and user account for at least 72 hours post-remediation: Create a temporary, high-sensitivity detection rule scoped to that specific host and user that alerts on any WMI execution, new process creation from WmiPrvSE.exe, or outbound connections on port 135. Review alerts from this rule manually during the 72-hour window.
- Document the complete incident timeline and conduct a lessons-learned review: Capture the full attack chain from initial access through execution, lateral movement, and persistence in your ticketing system. Identify which detections fired, which ones missed the activity, and what log gaps (if any) were exposed during the investigation. Share findings with the broader detection engineering team.
- Update detection rules and threat intelligence based on new IOCs discovered: Add any new file hashes, C2 IPs, domains, WMI consumer names, or script patterns identified during the investigation to your SIEM detection rules, EDR custom IOC feeds, and threat intelligence platform. Close the feedback loop by tagging the new IOCs with the incident ticket number for future traceability.
Stay Ahead
Get daily threat intelligence and detection playbooks.
Free. No account. No email. Follow in Feedly, Inoreader, or any RSS reader.