You can't contain me: elevation-of-privilege vulnerability in Docker for Windows
A named pipe exposed by Docker for Windows deserialised untrusted .NET data, allowing a member of the docker-users group to run arbitrary commands as SYSTEM. The author exploited this with a BinaryFormatter gadget chain.
srcincite.io
Published on srcincite.io
I have been continuing my journey of searching for windows breakout vulnerabilities in popular applications and one that I discovered in March I found interesting enough to share. Whilst kernel vulnerabilities are fun to discover, there are many core windows and third party applications that are fundamentally broken…
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 service used BinaryFormatter.Deserialize on data read from a named pipe that low-privileged users could write to, without validating the content.
Impact
A low-privileged user in the docker-users group could execute arbitrary commands as SYSTEM, though the impact is lower than a regular local privilege escalation because group membership is required.
What the attacker needed
Member of docker-users group; local access to the Windows machine
The fix
Docker patched the vulnerability on 19 July 2018.
How it was found
- Find the com.docker.service process and its dockerBackend named pipe.
- Check the pipe permissions and note that the docker-users group can access it.
- Capture legitimate traffic to the pipe to see the .NET serialised format.
- Decompile the service and confirm it calls BinaryFormatter.Deserialize on the pipe data.
- Create a test user in the docker-users group and run a shell as that user.
- Generate a BinaryFormatter payload with the TypeConfuseDelegate gadget and send it to 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.
Docker for Windows runs a background service that listens on a named pipe, which is a way for programs on the same computer to talk to each other. That service took data from the pipe and turned it back into .NET objects without checking it was safe, so a low-privileged user in the docker-users group could send a crafted message that made the service run their commands with the highest Windows privileges.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.