COM and DCOM Architecture
COM object model, CLSID/ProgID registration, in-process vs. out-of-process servers, DCOM remote activation, and why COM is a reliable lateral movement primitive.
An EDR alert fires: mmc.exe spawning cmd.exe on a remote host, initiated from a workstation. No PSRemoting. No RDP. The attacker used DCOM — specifically the MMC20.Application COM object, which has an ExecuteShellCommand method callable remotely. This is a DCOM lateral movement technique documented in the wild since at least 2017. It requires only a valid credential, creates no scheduled task or service, and leaves minimal trace. Understanding it requires understanding how COM works.
COM Object Model
COM (Component Object Model) is the Windows binary interface standard for inter-process and inter-language communication. Every COM object:
- Has a CLSID (Class ID) — a GUID uniquely identifying the class
- Implements one or more interfaces — each with an IID (Interface ID)
- Is created by a class factory via
CoCreateInstance(clsid) - Is registered in the registry under
HKCR\CLSID\{GUID}orHKCU\Software\Classes\CLSID\{GUID}
COM Object Lifecycle
══════════════════════════════════════════════════════════════════
Registry (HKCR\CLSID\{12345...})
├── InprocServer32: C:\Windows\System32\foo.dll (in-process)
└── LocalServer32: C:\Program Files\bar\bar.exe (out-of-process)
Client code:
CoCreateInstance({12345...}, ...)
│
▼ COM runtime consults SCM (Service Control Manager of COM)
┌─────────────────────────────────────────────────────────────┐
│ COM SCM (combase.dll → rpcss.dll → svchost) │
│ Looks up CLSID → finds InprocServer32 or LocalServer32 │
│ Loads DLL into client (in-proc) OR │
│ Spawns separate server process (out-of-proc) │
└──────────────┬──────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Object created, interface returned │
│ In-proc: object lives in client process memory │
│ Out-of-proc: object lives in server process, IPC via RPC │
└─────────────────────────────────────────────────────────────┘
COM Registration Hierarchy
| Registry Location | Scope | Priority |
|---|---|---|
| HKCU\Software\Classes\CLSID\{GUID} | Current user only | Checked first (highest priority) |
| HKCR\CLSID\{GUID} | All users (merged from HKLM + HKCU) | Fallback |
| HKLM\SOFTWARE\Classes\CLSID\{GUID} | Machine-wide | Lowest priority |
Standard users can write to HKCU without admin rights. If a CLSID exists in HKLM (system-registered) but the attacker plants a different server path in HKCU for the same CLSID, the HKCU registration wins. Any process running as that user that calls CoCreateInstance for that CLSID loads the attacker's DLL instead of the system one. This is COM object hijacking — a privilege escalation and persistence technique that requires only user-level write access. Covered in depth in Ch56.
DCOM — Distributed COM
DCOM extends COM across the network. A client on machine A can instantiate a COM object on machine B and call its methods via RPC. The network protocol uses OXID (Object Exporter ID) resolution on port 135 plus dynamic RPC ports.
DCOM Remote Activation
══════════════════════════════════════════════════════════════════
Attacker (10.0.1.100) Target (10.0.1.200)
───────────────────── ───────────────────
$com = [Activator]::CreateInstance(
[Type]::GetTypeFromProgID(
"MMC20.Application",
"10.0.1.200" ─────────► TCP 135 (endpoint mapper)
) │ OXID resolution
) ▼
┌──────────────────┐
│ RPCSS (svchost) │
◄──────────────────────────────────── │ Creates COM obj │
Returns IDispatch proxy │ in dllhost.exe │
└──────────────────┘
$com.ExecuteShellCommand("cmd.exe") ────────────────────────────►
(calls method on remote object) dllhost.exe spawns cmd.exe
DCOM lateral movement
DCOM Lateral Movement Objects
| COM Object | CLSID / ProgID | Method used | Spawned process parent |
|---|---|---|---|
| MMC20.Application | {49B2791A-B1AE-4C90-9B8E-E860BA07F889} | Document.ActiveView.ExecuteShellCommand | mmc.exe |
| ShellWindows | {9BA05972-F6A8-11CF-A442-00A0C90A8F39} | Item().Document.Application.ShellExecute | explorer.exe |
| ShellBrowserWindow | {C08AFD90-F2A1-11D1-8455-00A0C91F3880} | Document.Application.ShellExecute | explorer.exe |
| Excel.Application | {00024500-0000-0000-C000-000000000046} | DDEInitiate + macro exec | excel.exe |
| Visio.InvisibleApp | {EA664206-C3CA-11D1-8F00-0000F87734E7} | Documents.Open (malicious document) | visio.exe |
DCOM Detection
Key indicators for DCOM lateral movement:
- Sysmon Event 3: Network connection to target port 135 from workstation
- Sysmon Event 1: Process creation on target with parent = dllhost.exe, mmc.exe, or explorer.exe (unusual parent for child cmd/powershell)
- Event 4624: Logon type 3 (network) on target — DCOM requires network auth
- Event 4688: cmd.exe or powershell.exe spawned from mmc.exe (suspicious parent)
title: DCOM Lateral Movement via MMC20
status: stable
logsource:
product: windows
category: process_creation
detection:
selection:
ParentImage|endswith: '\mmc.exe'
Image|endswith:
- '\cmd.exe'
- '\powershell.exe'
- '\wscript.exe'
- '\cscript.exe'
condition: selection
falsepositives:
- Legitimate MMC snap-in operations (rare)
level: high
tags:
- attack.lateral_movement
- attack.t1021.003
Q & A
Q: Why does DCOM lateral movement require local admin rights on the target, even though COM is available to standard users?
Local COM objects can be created by any user whose account has permission to load that class. DCOM remote activation adds a second permission check: the DCOM security descriptor for the class (configured in Component Services / registry DCOMCNFG). Most system COM objects have launch/activation permissions that require local admin on the remote machine. Additionally, network authentication succeeds but the remote COM object is created in a security context — if it needs to spawn a process as SYSTEM or a privileged user, local admin rights determine whether that's allowed. Practically: an attacker needs credentials for a local admin account on the target to use DCOM for code execution.