Remote procedure call (RPC) carries most Windows administration, which is exactly why intruders use it for remote execution, credential theft and authentication coercion. Services, scheduled tasks, the registry, the directory and WMI are all managed over RPC interfaces, so it cannot simply be blocked. This guide explains the RPC attack surface defensively: how endpoints and interfaces are reached, which abuse classes matter, how to reduce exposure with the firewall, RPC filters and protocol settings, and what to monitor. It is written for Windows security engineers and detection engineers. Coercion of domain controllers is covered in depth in the Authentication Coercion Defence guide, and directory-wide hardening in the Active Directory and Entra ID Hardening Guide; this page covers RPC as a whole. It contains no attack tooling or procedures.
Key takeaways
- RPC cannot be switched off, only shaped. CISA's eviction guidance states that RPC cannot be completely blocked but can be filtered and monitored; the goal is to limit who can call which interface from where.
- Two transports, two control points. RPC reaches a host over TCP (endpoint mapper on port 135 plus a dynamic port) or over SMB named pipes, so firewall rules alone miss half of it.
- RPC filters work at interface level. Windows Filtering Platform RPC filters can permit or block calls by interface UUID, operation number, authentication level and caller, which no port rule can do.
- Authentication settings close the anonymous gap. "Restrict Unauthenticated RPC clients" and packet privacy for sensitive interfaces raise the bar, but need testing because older software breaks.
- Detection rests on what RPC creates. Service installs, scheduled tasks, named pipe access and unusual server-to-server connections are more reliable signals than RPC traffic alone.
How Windows RPC works
An RPC server registers one or more interfaces, each identified by a UUID and version, and each exposing numbered operations (opnums). A client binds to an interface over a protocol sequence and calls operations on it. The protocol sequences that matter are:
| Protocol sequence | Transport | How a client finds the server | Firewall view |
|---|---|---|---|
| ncacn_ip_tcp | TCP | Asks the endpoint mapper (RpcSs) on TCP 135, which returns a dynamic port | TCP 135 then a port in the dynamic range (49152 to 65535 by default since Windows Vista and Server 2008) |
| ncacn_np | SMB named pipe | Opens a named pipe on the IPC$ share | TCP 445 only; the interface is invisible to port rules |
| ncacn_http | RPC over HTTP | Through an RPC proxy | HTTP or HTTPS |
| ncalrpc | Local only | Local procedure call on the same host | Not reachable remotely |
Authentication levels: RPC calls carry an authentication level, from RPC_C_AUTHN_LEVEL_NONE through CONNECT, CALL, PKT and PKT_INTEGRITY to PKT_PRIVACY. Microsoft documents that PKT_INTEGRITY verifies data has not been modified and PKT_PRIVACY additionally encrypts the arguments of each remote call; CALL is mapped up to PKT on connection-based (ncacn) protocol sequences, and ncalrpc always uses PKT_PRIVACY. Interfaces that accept low authentication levels are the ones most exposed to relay and tampering.
DCOM and WMI ride on RPC too: DCOM activation uses the endpoint mapper, and remote WMI uses DCOM unless WinRM is configured. Hardening RPC therefore also affects remote WMI and DCOM management tools.
Attack surface: interfaces, endpoints and named pipes
Every role and feature adds interfaces. A domain controller exposes directory replication, Netlogon, SAM and LSA interfaces; a print server exposes the spooler; most servers expose service control, task scheduling and remote registry. The attack surface of a host is the set of interfaces it registers, multiplied by the network paths that can reach them and the identities allowed to call them.
- Endpoint mapper enumeration: by default the endpoint mapper answers queries about which interfaces are registered on which ports, which helps administrators and attackers alike. Restricting unauthenticated clients makes the endpoint mapper unavailable to anonymous callers.
- Named pipes: interfaces reachable over ncacn_np are exposed wherever SMB is reachable. Microsoft notes that named pipe calls are exempt from the "Restrict Unauthenticated RPC clients" setting for backward compatibility, so SMB exposure and RPC filters must cover them.
- Selective binding:
netsh rpccan limit which subnets RPC listens on, useful for multi-homed servers with a management network. - Roles and services: removing an unneeded role (print spooler on a domain controller, for example) removes its interfaces entirely, which is stronger than any filter.
Known abuse classes (coercion, remote service and task creation)
The table maps the main abuse classes to MITRE ATT&CK and to the first defensive control. It describes what happens, not how; techniques are named only as context.
| Abuse class | RPC interface family | ATT&CK | First defence |
|---|---|---|---|
| Remote service creation and execution | Service Control Manager Remote Protocol (MS-SCMR) | T1569.002 Service Execution; T1543.003 Windows Service | Restrict admin rights per tier; RPC filter limiting service creation to admin hosts |
| Remote scheduled task creation | Task Scheduler Service Remoting Protocol (MS-TSCH) | T1053.005 Scheduled Task | RPC filter limiting remote task creation; alert on task creation from the network |
| Remote WMI and DCOM execution | DCOM and WMI interfaces | T1047 Windows Management Instrumentation; T1021.003 Distributed Component Object Model | Restrict remote WMI and DCOM to management hosts; firewall dynamic ports by source |
| Remote registry modification | Windows Remote Registry Protocol (MS-RRP) | T1021 Remote Services | Disable Remote Registry where unused; RPC filter by caller host |
| Directory replication abuse | Directory Replication Service Remote Protocol (MS-DRSR) | T1003.006 DCSync | Limit replication rights; filter replication calls to domain controller sources |
| Authentication coercion | Print spooler (MS-RPRN), EFSRPC (MS-EFSR), DFS namespace management (MS-DFSNM) and others | T1187 Forced Authentication | Disable unneeded services; RPC filters; relay protections. See the Authentication Coercion Defence guide |
Most of these require valid credentials with administrative rights on the target, which is why RPC hardening and tiered administration go together. See the Lateral Movement Guide and the Tiered Administration and Enterprise Access Model Guide.
Where identity fits
Service accounts used by deployment, backup and monitoring tools often hold local administrator rights across hundreds of servers and use exactly these RPC interfaces. A stolen service account password becomes remote execution everywhere it is admin. Scope these accounts to the hosts they manage, prefer group managed service accounts, and include them in RPC filter allow conditions by identity rather than granting broad network reach. See the Non-Human Identity (NHI) Guide.
Hardening: firewall, RPC filters and protocol settings
Host firewall
- Scope by source: allow TCP 135, the dynamic RPC range and TCP 445 into servers only from management hosts, other servers that genuinely need them and domain controllers. Workstation-to-workstation RPC and SMB is rarely needed. See the Host-Based Firewall Guide.
- Dynamic ports: Microsoft recommends either allowing ports 49152 to 65535 between servers across internal firewalls or narrowing the dynamic range per server with
netsh int ipv4 set dynamicport(minimum 255 ports, start no lower than 1025). Narrowing the range makes network firewall rules practical but must be sized for the host's outbound connection load. - Windows Defender Firewall RPC options: inbound rules can target the RPC endpoint mapper and RPC dynamic ports as local port types rather than fixed numbers, so rules follow the service.
RPC filters
RPC filters are Windows Filtering Platform rules evaluated by the RPC runtime, configured with netsh rpc filter or the WFP API. Microsoft's documentation describes three building blocks: conditions (what to match), rules (layer and action) and filters (rules combined with conditions). Key concepts:
- Layers: user mode (um), endpoint mapper (epmap), endpoint address (ep_add), proxy connection (proxy_conn) and proxy interface (proxy_if).
- Actions: permit, block or continue to the next filter.
- Conditions: interface UUID (if_uuid), operation number (opnum, user mode only), authentication type and level (auth_type, auth_level), the caller's token (remote_user_token), named pipe, protocol and addresses. Conditions in one filter must all match.
- Audit: audit is supported only on permit filters and not at the ep_add layer; parameter buffer auditing is available at the user mode layer.
- Persistence and backup: filters persist across reboots by default. Microsoft cautions that filters can block traffic Windows services depend on, and recommends testing and backing up configuration with
dumpfirst.
CISA's eviction guidance suggests, at a minimum, filtering remote service creation to specific privileged users, remote registry modification to specific hosts, remote scheduled task creation, access to sensitive endpoints to Kerberos authentication only, and connections over specific named pipes. A practical pattern is "permit with audit for the expected callers, block for everyone else" on each sensitive interface.
Protocol settings
| Setting (Group Policy) | Values | Effect and caveats |
|---|---|---|
| Restrictions for Unauthenticated RPC Clients (Computer Configuration, Administrative Templates, System, Remote Procedure Call) | Disabled (default on server SKUs), Authenticated, Authenticated without exceptions | Authenticated rejects anonymous calls except interfaces registered to allow them; without exceptions blocks all anonymous remote calls and needs significant testing. Named pipe calls are exempt; connectionless protocols fail. Reboot required |
| Enable RPC Endpoint Mapper Client Authentication | Disabled (default), Enabled | Clients authenticate to the endpoint mapper using NTLM. Cannot be combined with Restrict NTLM policies set to deny all; Microsoft recommends restricting NTLM instead where you must choose |
| Interface authentication level (application or protocol setting) | Up to RPC_C_AUTHN_LEVEL_PKT_PRIVACY | Require packet integrity or privacy for sensitive interfaces where the product supports it; follow vendor hardening updates that raise minimum levels |
Pair these with NTLM reduction and relay protections, since many RPC abuse chains end in NTLM relay. See the NTLM Relay Guide and the NTLM Deprecation and Elimination Guide.
Rollout
- Baseline: enable RPC auditing and network logging on a pilot set of servers to learn which interfaces are called, by whom and from where.
- Remove: disable services and roles that expose interfaces nobody uses.
- Scope the firewall: restrict 135, dynamic ports and 445 by source, starting with Tier 0 and Tier 1 servers.
- Filter in audit-first mode: deploy permit-with-audit filters for expected callers, review for a full business cycle, then add block filters.
- Raise authentication: set Restrict Unauthenticated RPC clients to Authenticated on a pilot ring, then widen.
- Roll back: keep the
netsh rpc filterdump and the previous Group Policy object so a failed change can be reverted quickly; remember that the protocol settings need a reboot.
Monitoring and detection
RPC auditing is controlled by the Audit RPC Events subcategory, which is off by default. Microsoft's event reference documents event 5712 (A Remote Procedure Call (RPC) was attempted) in that subcategory, with interface UUID, protocol sequence, authentication service and authentication level fields; the same page notes that the event appears never to occur in normal operation. Confirm in a lab that your audited RPC filters produce it before you build detections on it.
| Data source | What it shows | Use |
|---|---|---|
| Security event 5712 (Audit RPC Events) | Audited RPC calls with interface and authentication level | Verify RPC filter audit; find callers of sensitive interfaces |
| Security 4697 and System 7045 | A service was installed | Remote service creation, especially from unexpected accounts |
| Security 4698 | A scheduled task was created | Remote task creation |
| Security 5145 (detailed file share) | Access to IPC$ and named pipes | Which pipes are opened by which clients |
| Security 5156 (filtering platform connection) | Allowed connections, including to 135 and dynamic ports | Unusual server-to-server or workstation-to-server RPC |
| EDR and network sensors | Process lineage, RPC interface parsing where supported | Child processes of services, coercion and replication calls |
MITRE D3FEND catalogues this as RPC Traffic Analysis (D3-RTA); see the D3-RTA RPC Traffic Analysis page. For audit policy and forwarding, see the Windows Event Log Guide and the Sysmon Guide.
Metrics:
- Percentage of Tier 0 and Tier 1 servers with RPC, dynamic port and SMB access restricted by source.
- Number of sensitive interfaces covered by RPC filters, and blocked calls per week after rollout.
- Percentage of servers with Restrict Unauthenticated RPC clients set to Authenticated.
- Remote service and task creations from non-management hosts (target: zero, each investigated).
- Time from an unexpected remote service creation to analyst triage.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev. 5 | CM-7 Least Functionality | Remove unused services and interfaces |
| NIST SP 800-53 Rev. 5 | SC-7 Boundary Protection | Host and network firewall scoping of RPC |
| NIST SP 800-53 Rev. 5 | AU-12 Audit Record Generation | RPC, service and task auditing |
| CIS Controls v8.1 | Control 4 Secure Configuration of Enterprise Assets and Software | Host firewall and protocol settings |
| MITRE D3FEND | D3-RTA RPC Traffic Analysis | Monitoring RPC calls |
Common failure patterns
- Port rules only: blocking 135 and the dynamic range while leaving 445 open, so the same interfaces stay reachable over named pipes.
- Block before baseline: deploying block filters or "Authenticated without exceptions" without an audit period, breaking backup, monitoring or DCOM applications and leading to a full rollback.
- Flat workstation networks: allowing RPC and SMB between workstations, so one compromised laptop can reach every other.
- Over-privileged tool accounts: management service accounts with admin rights on every server, turning one credential into domain-wide remote execution.
- Unverified auditing: assuming RPC audit events are being produced and forwarded without testing, leaving detections silent.
- Unneeded roles left on Tier 0: print spooler and similar services running on domain controllers, exposing coercible interfaces.
Practitioner checklist
- Inventory RPC exposure on Tier 0 and Tier 1 servers: listening ports, named pipes and registered interfaces.
- Disable services and roles that expose unused interfaces, starting with domain controllers.
- Restrict TCP 135, the dynamic RPC range and TCP 445 by source on servers and workstations.
- Deploy RPC filters in permit-with-audit mode for service creation, task creation, remote registry and replication interfaces, then add blocks.
- Set Restrict Unauthenticated RPC clients to Authenticated on a pilot ring, then widen.
- Scope management service accounts to the hosts they manage.
- Enable and test Audit RPC Events, service install, task creation and detailed file share auditing; forward to the SIEM.
- Back up RPC filter configuration and Group Policy before each change and document the rollback.
Standards and references
- Microsoft Learn: netsh rpc
- Microsoft Learn: RPC Interface Restriction
- Microsoft Learn: Authentication-Level Constants (RPC)
- Microsoft Learn: 5712(S) A Remote Procedure Call (RPC) was attempted
- Microsoft Learn: The default dynamic port range for TCP/IP has changed
- CISA: Restrict and Monitor Remote Procedure Calls (RPC), CM0100
- MITRE ATT&CK: T1187 Forced Authentication
- MITRE D3FEND: RPC Traffic Analysis
Related NHI Mgmt Group resources: Authentication Coercion Defence · Active Directory and Entra ID Hardening Guide · SMB Protocol Security and Signing Guide · Kerberos Security Guide