Introduction
Impacket’s DCE/RPC (Distributed Computing Environment / Remote Procedure Call) implementation provides comprehensive support for Microsoft’s RPC protocol suite. This enables interaction with Windows remote services over various transport protocols.Architecture
The DCE/RPC implementation is organized into several layers:Transport Layer
Provides protocol-independent RPC communication over multiple transports:- Named Pipes (SMB) -
ncacn_np - TCP/IP -
ncacn_ip_tcp - HTTP -
ncacn_http - UDP -
ncadg_ip_udp - Local pipes -
ncalocal
RPC Runtime
Core protocol implementation (rpcrt.py):
- PDU (Protocol Data Unit) handling
- BIND/BIND_ACK negotiation
- Authentication (NTLM, Kerberos, SCHANNEL)
- Fragmentation and reassembly
- Context management
Interface Layer
Protocol-specific implementations indcerpc/v5/:
- Service Control Manager (SCMR)
- Security Account Manager (SAMR)
- Local Security Authority (LSAD)
- Directory Replication Service (DRSUAPI)
- Windows Management Instrumentation (WMI/DCOM)
- Many more…
Basic Usage
Creating a Connection
String Binding Format
RPC endpoints are specified using DCE string bindings:Authentication
NTLM Authentication
Kerberos Authentication
Authentication Levels
Fromrpcrt.py:112-118:
Error Handling
Common Status Codes
Fromrpcrt.py:149-200:
| Code | Description |
|---|---|
0x1C010002 | nca_s_op_rng_error - Bad operation number |
0x1C010003 | nca_s_unk_if - Unknown interface |
0x1C01000B | nca_s_proto_error - Protocol error |
0x00000005 | rpc_s_access_denied - Access denied |
0x000006D8 | rpc_fault_cant_perform - Cannot perform operation |
PDU Types
Fromrpcrt.py:40-60:
Best Practices
Connection Management
Reusing Connections
See Also
- Transport Layer - Detailed transport options
- V5 Interfaces - Available RPC interfaces
- DCOM/WMI - Distributed COM and WMI