Skip to main content

Overview

impacket-wmiexec executes commands on a remote host using Windows Management Instrumentation (WMI) over DCOM (port 135 + dynamic high ports). It provides a semi-interactive shell without uploading any binary or creating a service. Output is retrieved by writing to a temp file on a writable share.

Authentication Methods


Basic Usage — Interactive Shell

Local admin (no domain):

Execute Specific Command

Run a PowerShell command:

How It Works

  1. Authenticates to the target via DCOM/RPC (port 135).
  2. Negotiates a dynamic high port for WMI communication.
  3. Creates a Win32_Process via WMI to execute cmd.exe /Q /c <command>.
  4. Command output is redirected to a temp file at the root of the ADMIN$ share (e.g., C:\Windows\__<timestamp>, since ADMIN$ maps to C:\Windows) — not under \Temp.
  5. Reads the output file over SMB (port 445) and returns it to the attacker.
  6. Deletes the temp output file after reading.
The shell runs as the authenticated user (not SYSTEM, unless authenticating as SYSTEM-equivalent).

OPSEC Considerations

Artifacts to expect:
  • Security Event ID 4624 (network logon type 3)
  • Security Event ID 4688 (process creation for cmd.exe)
  • WMI Operational Event IDs 5857, 5860, 5861
  • Temp files briefly written to the root of the share (default ADMIN$C:\Windows\__<timestamp>)

Pass-the-Hash

With both LM and NT hash:

Kerberos Authentication

Requires a valid ccache file or keytab.
With explicit DC IP:
Using AES key directly:

Specify Output Share

By default, output goes to ADMIN$. Use a different share:
Use a custom share (useful when ADMIN$ is restricted):
Disable output file (blind execution, no output returned):

Common Errors and Fixes


Quick Reference