---
description: 'ID: T1175 Tactic: Lateral Movement, Execution'
---

# Component Object Model and Distributed COM

Adversaries may use the Windows Component Object Model (COM) and Distributed Component Object Model (DCOM) for local code execution or to execute on remote systems as part of lateral movement.

Permissions to interact with local and remote server COM objects are specified by access control lists (ACL) in the Registry. By default, only Administrators may remotely activate and launch COM Objects through DCOM.

Adversaries may abuse COM for local command and/or payload execution. Various COM interfaces are exposed that can be abused to invoke arbitrary execution via variety of programming languages such as C, C++, Java and VBScript. Specific COM Objects also exists to directly perform functions beyond code execution, such as creating a Scheduled Task, file less download/execution, and other adversary behaviors such as Privilege Escalation and Persistence.

Adversaries may use DCOM for Lateral Movement. Through DCOM, adversaries operating in the context of an appropriately privileged user can remotely obtain arbitrary and even direct shellcode execution through Office applications as well as other Windows Objects that contain insecure methods. DCOM can also execute macros in existing documents and may also invoke Dynamic Data Exchange (DDE) execution directly through a COM created instance of a Microsoft Office application, bypassing the need for a malicious document.

### DCOM

Component Object Model (COM) is a protocol used by processes with different applications and languages so they communicate with one another. COM objects cannot be used over a network, which introduced the Distributed COM (DCOM) protocol Matt Nelson discovered a lateral movement technique via DCOM, using the ExecuteShellCommand Method in the Microsoft Management Console (MMC) 2.0 scripting object model which is used for System Management Server administrative functions.

COM is a component of the native Windows application programming interface (API) that enables interaction between software objects, or executable code that implements one or more interfaces. Through COM, a client object can call methods of server objects, which are typically Dynamic Link Libraries (DLL) or executables (EXE). DCOM is transparent middle ware that extends the functionality of Component Object Model (COM) beyond a local computer using remote procedure call (RPC) technology.

So let's work on a quick technique, I will execute the calculator on the remote host using DCOM.The user will need Admin privileges on the Host machine to access the MMC 2.0 method and also Admin privileges on the Remote machine to execute.



```
$com = [activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.Application","TARGET IP"))
$com.Document.ActiveView.ExecuteShellCommand("C:\Windows\System32\Calc.exe",$null,$null,"7")
```

Demo:

![](https://244509215-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lx2b2zLkTKHrsGfxMoR%2F-M-GJSTsHefOrtnyw8xr%2F-M-GMZw_CrAKMKaEZHLX%2FDCOM.gif?alt=media\&token=e01f376c-d6eb-4460-8511-629b9206e52b)
