Windows Containers Background
The researcher found that a non-administrator user inside a Windows Server Container could access the host's registry hives through relative opens, and that the ContainerUser account held SeImpersonatePrivilege, allowing escalation to SYSTEM. These flaws meant the proposed mitigation of running as ContainerUser did not eliminate the risk of container escape.
Published on googleprojectzero.blogspot.com
This is a short blog post about a research project I conducted on Windows Server Containers that resulted in four privilege escalations which Microsoft fixed in March 2021. In the post, I describe what led to this research, my research process, and insights into what to look for if you’re researching this area.
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 kernel's registry symbolic-link check allows all links when the current thread is in a server silo, and the container user account is created with SeImpersonatePrivilege, so isolation assumptions fail.
Impact
A non-administrator container user could read host registry keys and, by abusing SeImpersonatePrivilege, could gain administrator access and modify the host's registry hives.
What the attacker needed
Code execution in a Windows Server Container; container runs as ContainerUser; process isolation mode
The fix
The text does not state a fix; the issues were reported to Microsoft, which did not consider Windows Server Containers a security boundary, so the guidance to use ContainerUser was shown to be insufficient.
How it was found
- Build a Windows Server Core container image that runs PowerShell as ContainerUser.
- Run the container in process isolation mode.
- Dump the ContainerUser token and observe SeImpersonatePrivilege is enabled.
- List the registry using the module's object manager provider with relative opens and compare it with the built-in registry provider.
- Observe that the relative open shows host registry keys and host user SIDs instead of the container's own.
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.
A Windows container is meant to keep an application separate from the real computer it runs on, like a box inside a box. The researcher found that a normal user inside the box could still reach the real computer's settings database (the registry) and could also grab extra powers that let them act as the computer's administrator. This matters because people thought running as a limited user made the container safe, but it did not.
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.