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
Execute Specific Command
How It Works
- Authenticates to the target via DCOM/RPC (port 135).
- Negotiates a dynamic high port for WMI communication.
- Creates a
Win32_Processvia WMI to executecmd.exe /Q /c <command>. - Command output is redirected to a temp file at the root of the
ADMIN$share (e.g.,C:\Windows\__<timestamp>, sinceADMIN$maps toC:\Windows) — not under\Temp. - Reads the output file over SMB (port 445) and returns it to the attacker.
- Deletes the temp output file after reading.
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
Kerberos Authentication
Requires a valid ccache file or keytab.Specify Output Share
By default, output goes toADMIN$. Use a different share:
ADMIN$ is restricted):