Windows sandbox: renderer processes can open each and unrelated Chromium processes
Firefox's Windows content-process sandbox set a delayed integrity level of low rather than untrusted, unlike Chromium. This let one renderer process open and write to other renderer processes and to unrelated low-integrity Chromium-based processes such as GPU processes.
Originally disclosed on Mozilla
- Fixed in 10 months
- Paid in 8 months
- Disclosed after 10 months
Chromium uses the following code to prevent access between renderers, and from renderers to other low integrity processes: https://cs.chromium.org/chromium/src/services/service_manager/sandbox/win/sandbox_win.cc?l=430
result = policy->SetTokenLevel(sandbox::USER_RESTRICTED_SAME_ACCESS,
sandbox::USER_LOCKDOWN);
if (result != sandbox::SBOX_ALL_OK)
return result;
// Prevents the renderers from manipulating low-integrity processes.
result = policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_UNTRUSTED);
In SandboxBroker::SetSecurityLevelForContentProcess of Firefox with aSandboxLevel < 20 however, the delayed integrity level is set to INTEGRITY_LEVEL_LOW: https://dxr.mozilla.org/mozilla-central/source/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp#432
This means that content processes can open and manipulate each other, and also to some other Chromium-based processes such as the Chrome or Electron GPU process (an example is the Slack desktop application). I verified this in Firefox 67 by attaching to a renderer process with WinDbg and calling OpenProcess(PROCESS_VM_WRITE, 0, <PID>) to check if the result is non-zero. The steps for doing so are as follows (on Windows 10):
bp kernel32!ReadFile
g
# wait for breakpoint to hit
eq KERNEL32!_imp_ReadFile kernel32!OpenProcessStub
eq @rsp deadbeef
r @rcx=0x20
r @rdx=0
r @r8=0n<PID>
g
# will crash at 0xdeadbeef because we changed the return address
r @rax # non-zero if opening was successfully
One direct consequence of this within Firefox itself is that a web renderer process can escalate privileges to file and web extension processes which are potentially more trusted. See also bug 1538028, file processes can read the entire filesystem.
Another consequence is that we can get control of a process before it calls LowerToken(). This clearly goes against the idea of the sandbox, even though it probably only means a minor increase of kernel attack surface in the case of Firefox. If a Chromium-like win32k lockdown mechanism will ever be introduced in the future, this would be a bypass.
Also, I could imagine that this could affect site isolation in the future.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Firefox sandbox broker set the delayed integrity level to low instead of untrusted for content processes below sandbox level 20, so the sandbox did not block access to other low-integrity processes.
Impact
A web renderer could escalate to more trusted file and extension processes, and could control other processes before they lower their token, which the author says probably only slightly increases kernel attack surface for Firefox but would bypass a future win32k lockdown and could affect site isolation.
What the attacker needed
Windows 10; Firefox 67 with sandbox level below 20; Debugger access to a renderer process
How it was found
- Attach a debugger to a Firefox renderer process on Windows 10.
- Set a breakpoint on the file read function and continue until it is hit.
- Redirect the read function's import to an OpenProcess stub and change the return address.
- Set the requested access rights, a null handle, and the target process ID as arguments.
- Continue; the process crashes at the altered return address, and the return value shows whether the open succeeded.
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 report has not been written yet. The Original tab links to the source.
A sandbox is meant to keep a program's parts, and other programs, from touching each other's memory. Firefox's Windows sandbox gave its web page processes a weaker protection level than Chromium does, so one page process could reach into another process's memory. The researcher proved this by attaching a debugger and asking Windows to open another process for writing, which succeeded.
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.