The Vulnerability
A local privilege escalation vulnerability in PsExec allows a non-admin attacker to hijack a named pipe created by the PSEXESVC service, causing it to run arbitrary code as Local System. An attacker with existing unprivileged access could elevate to full system control when an administrator uses PsExec on the affected machine.
blog.0patch.com
Published on blog.0patch.com
Last month, security researcher David Wells of Tenable published an analysis of a local privilege escalation vulnerability in PsExec, a powerful management tool from SysInternals (acquired by Microsoft) that allows launching executables on remote computers. It would be hard to find a Windows admin who hasn't used…
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
Likely the PSEXESVC service creates its named pipe without ensuring it is the first instance, so an attacker can pre-create a pipe with the same name and the service will reuse it with the attacker's permissions.
What the attacker needed
Attacker has non-admin code execution on target; PsExec is used by an admin on that target
The fix
The vulnerability was not officially fixed at the time of writing; a micropatch was made available that checks for the existence of the named pipe before the service creates it and terminates the service if the pipe already exists.
How it was found
- An attacker with non-admin access runs a malicious process on the target machine.
- The malicious process creates a named pipe with the same name that PSEXESVC.EXE will use.
- When an administrator uses PsExec to launch an executable on the target, PSEXESVC.EXE runs as Local System and tries to create the same named pipe.
- Because the pipe already exists, PSEXESVC.EXE re-opens it, keeping the attacker's permissions.
- The attacker connects to the pipe and instructs the service to run arbitrary code as Local System.
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.
PsExec is a tool that lets administrators run programs on other computers. When it does so, it creates a temporary service that listens on a named pipe (a way for programs to talk to each other). The problem is that a regular user can create a pipe with the same name first, and then the service will use that pipe, letting the attacker tell the service to run any program with high privileges.
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.