Skip to main content

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):
Execute a single command:
Without interactive shell (command only):

Available DCOM Objects

MMC20.Application (default)

Uses MMC20.Application COM object and calls Document.ActiveView.ExecuteShellCommand(). Process spawns under mmc.exe.

ShellWindows

Uses ShellWindows COM object (Shell.Explorer). Leverages an existing explorer.exe instance. Process spawns under explorer.exe.

ShellBrowserWindow

Similar to ShellWindows but uses a different COM class. Process spawns under explorer.exe.

Specify Object with -object


How It Works

  1. Authenticates to the target via RPC (port 135)
  2. Requests instantiation of the specified DCOM object
  3. The DCOM runtime negotiates a dynamic high port (49152+) for the object
  4. Calls a method on the object to execute cmd.exe /C <command>
  5. Output is redirected to a temp file and read back over SMB (port 445)
  6. Temp file is deleted after reading
Requires ports 135 (RPC) and 445 (SMB) plus dynamic high ports (49152-65535).

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.

Pass-the-Hash

With specific object:

Kerberos Authentication

With explicit DC IP:
Target must be specified by hostname (FQDN) when using Kerberos, not by IP.

Quick Reference