Overview
DCOM (Distributed Component Object Model) is Microsoft’s technology for component-based object-oriented programming over the network. Impacket provides support for DCOM and its most common use case: Windows Management Instrumentation (WMI).DCOM Architecture
DCOM extends COM (Component Object Model) to support remote object creation and method invocation. Key concepts:- OBJREF: Object references that identify remote objects
- IPID: Interface Pointer Identifier
- OXID: Object Exporter Identifier
- IRemUnknown: Base interface for remote objects
DCOM Modules
Location:impacket/dcerpc/v5/dcom/
dcomrt.py- DCOM runtime and core interfaceswmi.py- WMI implementationoaut.py- OLE Automation typesvds.py- Virtual Disk Servicecomev.py- COM Event Systemscmp.py- DCOM System Configuration
Windows Management Instrumentation (WMI)
Basic WMI Query
Common WMI Queries
Remote Command Execution via WMI
Semi-Interactive Shell via WMI
Event Subscriptions (Persistence)
DCOM Direct Interface Access
ShellWindows Interface
MMC20.Application
Authentication Options
Error Handling
DCOM Port Requirements
- TCP 135: RPC Endpoint Mapper
- TCP 49152-65535: Dynamic RPC ports (Windows 2008+)
- TCP 1024-5000: Dynamic RPC ports (older Windows)
Security Considerations
- Authentication: DCOM requires valid credentials
- Privileges: WMI access requires local admin rights
- Firewall: DCOM uses dynamic ports that may be blocked
- Logging: WMI activity is logged in Windows Event Logs
- Detection: WMI process creation is commonly monitored by EDR
Best Practices
- Always disconnect DCOM connections properly
- Handle exceptions for network and authentication errors
- Use specific WQL queries instead of
SELECT *for performance - Clean up WMI event subscriptions after use
- Consider using
RemRelease()for interface cleanup
References
- [MS-DCOM]: Distributed Component Object Model (DCOM) Remote Protocol
- [MS-WMI]: Windows Management Instrumentation Remote Protocol
- [MS-WMIO]: Windows Management Instrumentation Encoding
- WQL (WMI Query Language) Documentation