Skip to content
Access control Write-up Advanced

Windows Exploitation Tricks: Spoofing Named Pipe Client PID

The named pipe client PID, used by some applications for security checks, can be spoofed by a local attacker. This allows bypassing security checks that rely on the PID to identify the client process.

googleprojectzero.blogspot.com

Published on googleprojectzero.blogspot.com

While researching the Access Mode Mismatch in IO Manager bug class I came across an interesting feature in named pipes which allows a server to query the connected clients PID. This feature was introduced in Vista and is exposed to servers through the GetNamedPipeClientProcessId API, pass the API a handle to the pipe…

The author, on googleprojectzero.blogspot.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The named pipe file system driver sets the client PID from the connecting process, but this value can be influenced by the client through various techniques, and the driver's protection against spoofing can be bypassed.

What the attacker needed

Local access to the machine; ability to create a mount point (for one technique); access to local SMB server (for some techniques); ability to create processes and cycle PIDs

The fix

Developers should not use the named pipe client PID for security enforcement, as it can be spoofed.

How it was found

  1. Create a mount point that redirects to the named pipe device.
  2. Open the named pipe through the local SMB server using a crafted extended attribute buffer that specifies a fake PID.
  3. Alternatively, open the pipe via local SMB and rely on the fixed PID value, then cycle processes until one matches the expected PID.
  4. Or, open the pipe in one process, duplicate the handle to a child process, terminate the parent, and recycle the PID before the child uses the pipe.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Named pipes are a way for programs on Windows to talk to each other. Some programs check the process ID (PID) of the program connecting to them to decide if it is trusted. This article shows that an attacker can make the pipe server think the connection comes from a different process, so the check can be fooled.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.