Overview
impacket-dcomexec executes commands on a remote Windows host by abusing legitimate DCOM (Distributed Component Object Model) objects. It provides a semi-interactive shell without creating services or scheduled tasks.
Three DCOM objects are supported, each with different execution characteristics and detection profiles.
Authentication
Basic Usage
Interactive semi-shell (default object is MMC20.Application):Available DCOM Objects
MMC20.Application (default)
MMC20.Application COM object and calls Document.ActiveView.ExecuteShellCommand(). Process spawns under mmc.exe.
ShellWindows
ShellWindows COM object (Shell.Explorer). Leverages an existing explorer.exe instance. Process spawns under explorer.exe.
ShellBrowserWindow
explorer.exe.
Specify Object with -object
How It Works
- Authenticates to the target via RPC (port 135)
- Requests instantiation of the specified DCOM object
- The DCOM runtime negotiates a dynamic high port (49152+) for the object
- Calls a method on the object to execute
cmd.exe /C <command> - Output is redirected to a temp file and read back over SMB (port 445)
- Temp file is deleted after reading
OPSEC
DCOM execution is harder to detect than PsExec/smbexec because it uses legitimate COM objects. The unusual parent-child process relationship (e.g.,
mmc.exe spawning cmd.exe) is the primary detection vector.