skip to content

In SMB, how does DCE/RPC use the ncacn_np protocol sequence, and what do the IPC$ share and a pipe such as srvsvc contribute?

level: middleimportance: should knowfreq 24%

answer

  1. RPC with no TCP port of its own
  2. the endpoint is a name, not a number
  3. one share is reserved for pipes
  4. ShareType 0x02 in the TREE_CONNECT reply
  5. srvsvc lists the shares

basics

~20 s

With ncacn_np, RPC runs directly over SMB: the endpoint is a named pipe opened on the IPC$ pipe share, and each RPC message is a pipe write or read. A pipe such as srvsvc is one interface's endpoint, used for share administration.

solid answer

~40 s

`ncacn_np` is the RPC protocol sequence "RPC over SMB": there is no intermediate protocol, the endpoint is a named-pipe name, and RPC messages are sent as named-pipe writes and read back as named-pipe reads. The client connects to the pipe share `IPC$` (a `TREE_CONNECT` whose response carries `ShareType` `0x02`) and opens the pipe by name. `srvsvc` is the pipe for the Server Service interface (MS-SRVS), which can list shares, and it is available only over named pipes. `svcctl` is the Service Control Manager's pipe (MS-SCMR), and that interface may also be reached over `ncacn_ip_tcp`. So what you restrict, audit or firewall depends on which pipe and which transport is in play.

go deeper

for a junior

Recall that IPC$ is the share for named pipes and that RPC can travel over SMB through those pipes.

for a middle

Explain ncacn_np (RPC directly over SMB, endpoint a pipe name, writes and reads), ShareType 0x02, and what srvsvc serves.

for a senior

Decide what to restrict, audit or filter per pipe and transport, remembering that some interfaces can also use ncacn_ip_tcp.

for a principal

Judge which pipe-level controls are worth owning against the operational cost, given that file and RPC traffic share one SMB connection.

## RPC without a port of its own DCE/RPC can be carried over several transports. The one that matters for SMB is the **`ncacn_np`** protocol sequence, specified in MS-RPCE as "SMB (NCACN_NP)". Per that document: - It is RPC **directly over SMB**, with no intermediate protocols. - The **endpoint** is a **named-pipe name**. The network address and endpoint are not transmitted by these extensions; they are used to set up the SMB connection. - All RPC messages are sent as **named-pipe writes**, and responses are received as **named-pipe reads**. - RPC over SMB uses the endpoint mapper's well-known endpoint `\pipe\epmapper`, whereas RPC over TCP uses the endpoint mapper's well-known port 135. ## IPC$ and the pipe share A client reaches a named pipe through a **pipe share**. MS-SMB2 says a pipe share always has the name `IPC$` and may be used only for named-pipe operations and referral requests to itself. In the `TREE_CONNECT` response the server reports `ShareType` `0x02` (`SMB2_SHARE_TYPE_PIPE`). In the audit events the same share appears as `\\*\IPC$`, and Microsoft's event pages note its `Share Path` can be empty, since a pipe share has no directory behind it. The sequence for a Windows administrator tool listing shares on `files01.example.internal` is therefore: connect to `IPC$`, open the `srvsvc` pipe, then make RPC calls over it. ## Pipes you will see named | Pipe | Specification | What it serves | |---|---|---| | `\PIPE\srvsvc` | MS-SRVS | The Server Service interface: server and share administration, including share listing through `NetrShareEnum`. Available only over named pipes. | | `\PIPE\svcctl` | MS-SCMR | The Service Control Manager interface. The server may use `ncacn_np` or `ncacn_ip_tcp`. | | `\pipe\epmapper` | MS-RPCE | The well-known endpoint of the endpoint mapper for RPC over SMB. | | `netlogon`, `samr`, `lsarpc` | listed in Microsoft's anonymous-pipe policy pages | Names that appear in the lists of pipes a policy may allow anonymous sessions to open. Their own specifications are outside this material. | Other pipe names such as `wkssvc` appear in the specification's historical list of pipes that earlier Windows versions let anonymous users open, but this material does not describe their purpose. ## What this means for the administrator 1. **Restricting.** The list of pipes an anonymous session may open is the `NullSessionPipes` entry, and `RestrictNullSessAccess` makes it effective (the anonymous-access question covers both). 2. **Auditing.** Event 5145 is written for pipe access with `Share Name` `\\*\IPC$`. Its `Relative Target Name` field is the target relative to the share, which is where a pipe name would be read. The page gives no pipe example, so confirm the exact field contents against a real event on your own server. 3. **Firewalling.** Named-pipe RPC rides on the same SMB connection as file access, so it is not a port of its own. Microsoft's firewall-template page lists three inbound rules whose names end in `NP-In` (Netlogon Service, Remote Event Log Management and Remote Service Management), each shown with `Enabled: No`. The page does not explain the suffix, so read each rule's own port and program fields before building anything from the name. The port rules themselves belong with the transports and ports question. 4. **Not every RPC uses SMB.** The Service Control Manager interface may be carried over `ncacn_ip_tcp` instead, so a control that only watches `IPC$` does not see all of its traffic. ## Reading a capture In a capture of an administration tool talking to `files01.example.internal`, the sequence looks like this: 1. The client opens a TCP connection to the SMB port and negotiates a dialect and a session. 2. It sends `TREE_CONNECT` to `\\files01.example.internal\IPC$`; the response reports `ShareType` `0x02`. 3. It opens a pipe by name on that share. 4. RPC bind, request and response messages follow as writes and reads on the pipe. Nothing in step 2 looks like a file share. What distinguishes the traffic is the share type and the pipe name, which are exactly the two things a log or a restriction can name. ## Quick distinctions - `ncacn_np` is the SMB-carried sequence; `ncacn_ip_tcp` is RPC over TCP. - The disk shares carry files; `IPC$` carries pipes. - The endpoint on `ncacn_np` is a pipe name, not a port.

  • A capture shows an SMB2 CREATE on IPC$ followed by writes and reads. What is it carrying?
    A named-pipe RPC conversation. Under `ncacn_np` each RPC message is a named-pipe write and each reply a named-pipe read, so file-looking traffic to the pipe share is the RPC itself. Which interface it is depends on the pipe name opened, such as `srvsvc`.
  • Why does watching only IPC$ not give you every Service Control Manager RPC?
    MS-SCMR lets the interface be reached over `ncacn_np` (SMB, through IPC$) or `ncacn_ip_tcp` (RPC over TCP). Only the first appears as IPC$ pipe access, so the controls and the audit trail must account for both transports.
  • Which field of event 5145 would you read to see what was opened on IPC$, and what is the caveat?
    `Relative Target Name`, the target relative to the share, with `Share Name` `\\*\IPC$`. The caveat is that Microsoft's page shows no pipe example, so verify what a pipe open looks like in your own log before you write a detection or an audit procedure around it.

  • Named pipes over SMB need their own TCP port
  • IPC$ is a disk share holding temporary files
  • ShareType 0x03 means the pipe share because STYPE_IPC is 3
  • All MS-SCMR RPC traffic travels over IPC$
  • The ncacn_np endpoint is a port number