On this pageWhat the endpoint mapper does
Every Windows machine listens on TCP port 135. It belongs to the RPC Endpoint Mapper, a directory for Microsoft's remote procedure calls: a client asks it where a service lives, then connects to the port it names. Administrators use it daily without noticing, through WMI, remote event logs, service consoles and Active Directory. Attackers have used it too: the Blaster worm of 2003 spread through a flaw in the DCOM RPC interface reached over this port. The rule that follows is short. Port 135 belongs on your management network and nowhere else. This guide explains what depends on it, how to see what you expose, and how to restrict it without breaking Windows.
What the endpoint mapper does
A remote call to most Windows services takes two connections:
- The client connects to TCP 135 on the server and asks for a service by its interface identifier, for example the event log service.
- The endpoint mapper replies with the port where that service is listening. Since Windows Vista and Windows Server 2008, those dynamic ports come from the range 49152 to 65535 by default.
- The client opens a second connection to that port and makes the actual calls.
A firewall that admits port 135 alone therefore breaks most remote management, and one that admits the whole dynamic range admits far more than you meant. Windows Firewall solves this with two special port keywords, RPCEPMap for the endpoint mapper and RPC for the ports RPC hands out, which is how its built-in management rules are written. Some RPC traffic takes a third path, through named pipes over SMB on port 445.
What depends on it, and what does not
| Uses RPC through port 135 | Works without it |
|---|---|
WMI over DCOM, used by Get-WmiObject and many monitoring agents |
Remote Desktop, TCP 3389 |
| Event Viewer, Services and Computer Management pointed at another machine | PowerShell remoting over WinRM, TCP 5985 and 5986 |
| Active Directory replication, domain joins and much of what domain controllers do | OpenSSH Server, TCP 22 |
| DCOM applications and some backup agents | Websites in IIS, SQL Server's default instance on TCP 1433 |
| Remote Task Scheduler, firewall and disk management consoles |
The right-hand column matters: the modern ways to manage a server do not need the endpoint mapper at all. Get-CimInstance talks to remote machines over WinRM by default and only uses DCOM when you create a session that asks for it.
See what you expose
Start on the server itself. These commands show the listener, the services behind it and the dynamic port range in use:
Get-NetTCPConnection -LocalPort 135 -State Listen | Select-Object LocalAddress, OwningProcess
Get-Service RpcSs, RpcEptMapper | Select-Object Name, Status, StartType
netsh int ipv4 show dynamicport tcp
Then list the enabled inbound rules that admit RPC. Rules written with the keywords never show 135 or a port range, so search for all three forms:
Get-NetFirewallPortFilter |
Where-Object { $_.Protocol -eq 'TCP' -and ($_.LocalPort -contains '135' -or $_.LocalPort -contains 'RPCEPMap' -or $_.LocalPort -contains 'RPC') } |
Get-NetFirewallRule |
Where-Object { $_.Enabled -eq 'True' -and $_.Direction -eq 'Inbound' -and $_.Action -eq 'Allow' } |
Format-Table DisplayName, Profile
Finally, test from a machine outside your network against your server's public address. Test-NetConnection 203.0.113.30 -Port 135 should report TcpTestSucceeded : False. If it reports True, something between the internet and Windows lets it through.
Do not turn RPC off
The Remote Procedure Call (RPC) service and the RPC Endpoint Mapper are core parts of Windows. Local programs depend on RPC constantly, even on a server that never accepts a remote call, and Windows does not let you disable the main RPC service in the Services console for that reason. Registry tricks that stop it leave a machine that barely runs. The control point is the firewall, never the service.
Fence it with firewalls
Before changing rules over Remote Desktop, leave the RDP rule untouched and keep a second session open while you test, as described in managing Windows Firewall with PowerShell.
At the network edge
Nothing on the internet needs to reach port 135 on your servers. Drop it at the edge, together with its relatives: 137 to 139 for NetBIOS, 445 for SMB, 593 for RPC over HTTP, and 5985 and 5986 for WinRM unless you deliberately publish them over a VPN. On CloudSat, the Windows preset for cloud firewalls admits Remote Desktop and ping only, so port 135 is dropped before traffic reaches the server even if a rule inside Windows is too broad.
Inside Windows
Scope the built-in rules to the networks that manage the server instead of writing broad new ones. This limits the WMI and remote event log rules to an admin subnet:
Get-NetFirewallRule -DisplayGroup 'Windows Management Instrumentation (WMI)', 'Remote Event Log Management' |
Set-NetFirewallRule -RemoteAddress 10.20.1.224/28
Scoping does not enable a rule. Turn on only the groups you use, for example with Enable-NetFirewallRule -DisplayGroup 'Remote Event Log Management', and leave the others disabled. On a standalone server managed only over Remote Desktop, WinRM or SSH, no inbound rule for RPC needs to be enabled at all.
Across internal firewalls
When domain controllers or managed servers sit behind an internal firewall, the full dynamic range is hard to justify. Microsoft documents two ways to narrow it. Many RPC services accept a fixed port of their own, configured in the registry, which is the preferred method; Active Directory replication and Netlogon are documented examples. Failing that, the values Ports, PortsInternetAvailable and UseInternetPorts under HKEY_LOCAL_MACHINE\Software\Microsoft\Rpc\Internet restrict the whole RPC runtime to a range you choose, after a restart. Microsoft advises opening at least 100 ports above 5000, and warns that a mistake there can stop core services, Netlogon among them, from starting. Test on one machine before you touch a domain controller.
Manage Windows without opening RPC to the world
The quieter alternative is to stop needing port 135 across networks at all:
- PowerShell remoting over WinRM, preferably HTTPS on port 5986, from a management host or a VPN address range.
- OpenSSH Server, an optional feature on current Windows Server releases, for command-line administration with keys.
- A VPN or jump host for the consoles that still need DCOM, so RPC only ever crosses a network you control.
These also keep directory traffic in one place, which helps when you harden it further, for example by moving LDAP to TLS.
FAQ
Can I close port 135 completely?
You can block it from the network on servers that nobody manages through RPC, and local programs keep working, because they do not use TCP for local calls. Do not try to stop the service or remove the listener.
Why does my server answer on port 135 from outside?
A rule lets it through: a firewall rule inside Windows, a permissive network firewall, or a port forward on a router in front of the server. Use the rule listing above, then check each layer in front of the server.
Is port 135 the same thing as SMB?
No. SMB uses port 445 and, on older setups, NetBIOS on 139. Some RPC traffic travels inside SMB through named pipes, which is one more reason to keep both off the internet.
Does Remote Desktop need port 135?
No. Remote Desktop uses TCP 3389 and, for better performance, UDP 3389. A server managed only through Remote Desktop needs neither 135 nor the dynamic RPC range open to the internet.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




