Skip to content
WETNav

Lateral movement

WMI remote execution

wmicInvoke-WmiMethod / Invoke-CimMethodImpacket wmiexec.py

Running commands on a remote host through WMI over DCOM. The payload runs as a child of WmiPrvSE.exe on the destination.

Artifacts by host

Every place this technique leaves a trace. Collect all three sides; each one fills gaps the others leave.

Source

Where the operator ran the tool

  • Sysmon1

    wmic.exe, powershell.exe, or python.exe invoking Win32_Process Create against the target.

  • Sysmon3

    Outbound connection to the destination on port 135, then a dynamic RPC port.

  • Security4648

    Explicit-credential logon when alternate credentials are supplied to the WMI call.

Destination

The machine being accessed

  • Security4624

    Network logon, LogonType 3, for the account authenticating over DCOM.

  • Sysmon1

    The requested process as a child of WmiPrvSE.exe; with wmiexec, cmd.exe /Q /c running the command.

  • Security4688

    Same execution in the Security log, ParentProcessName WmiPrvSE.exe, with command line auditing on.

  • WMI5857

    WMI provider (often the provider hosting Win32_Process) loaded to service the request.

  • Security5145

    Detailed file share access to ADMIN$ for the wmiexec output file (__<epoch>).

  • Sysmon11

    wmiexec output file created under the ADMIN$ path (name begins with __ and an epoch timestamp).

  • Prefetch: C:\Windows\Prefetch\WMIPRVSE.EXE-*.pf and CMD.EXE-*.pf

    Execution evidence for the WMI provider host and the spawned command shell.

  • Amcache / ShimCache: any binary launched via Win32_Process Create

    Program execution evidence for tools run through WMI, persisting after cleanup.

Domain controller

Authentication records

  • Security4769

    Kerberos service ticket for the destination: ServiceName is the destination computer account (DEST$) for the HOST/<dest> or RPCSS/<dest> SPN, and IpAddress is the source host. The DC-side record that ties source, account and destination together.

  • Security4768

    TGT request for the account from the source IP, when it had no valid TGT yet (for example right after runas or an explicit-credential logon on the source).

  • Security4776

    NTLM credential validation with Workstation set to the source name, when NTLM was used instead of Kerberos (destination addressed by IP, or pass-the-hash). Domain accounts only; local accounts are validated on the destination.

Fingerprints

Strings and values specific enough to search for directly.

  • 01Parent process WmiPrvSE.exe spawning cmd.exe or powershell.exe
  • 02wmiexec command line cmd.exe /Q /c <cmd> 1> \\127.0.0.1\ADMIN$\__<epoch> 2>&1
  • 03Output file named __<epoch> on the ADMIN$ share
  • 04Win32_Process Create as the invoked WMI method
  • 05DCOM on port 135 followed by a dynamic RPC port from the same source

How it works

WMI lets an operator start a process on a remote host without dropping a service. wmic /node, PowerShell's Invoke-WmiMethod or Invoke-CimMethod with Win32_Process Create, and Impacket's wmiexec.py all invoke the Win32_Process.Create method over DCOM (RPC on port 135 and a dynamic high port). The remote WMI provider service, WmiPrvSE.exe, spawns the requested process, so the hallmark on the destination is a command process whose parent is WmiPrvSE.exe. Impacket's wmiexec.py builds a semi-interactive shell by running each command through cmd.exe and redirecting output to a file on the ADMIN$ share, which it then reads back over SMB. On the destination you see a network logon, the WmiPrvSE child process, and share access to the output file.

Hunt queries

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=1} |
  Where-Object { $_.Message -match 'ParentImage:.*WmiPrvSE.exe' }

Benign look-alikes

  • Legitimate remote management and monitoring that uses WMI (SCCM, inventory tools).
  • Administrative scripts that query or invoke WMI methods remotely.
  • Software that launches helper processes through the WMI provider host in normal operation.

References