But You Told Me You Were Safe: Attacking The Mozilla Firefox Sandbox (Part 2)
A prototype pollution vulnerability in Firefox's NotificationDB allowed a compromised renderer to pollute Object.prototype in the privileged parent process, leading to chrome-level XSS during tab restoration and sandbox escape. An attacker could then execute native code outside the sandbox.
zerodayinitiative.com
Published on zerodayinitiative.com
In the first part of this series, we reviewed how Pwn2Own contestant Manfred Paul was able to compromise the Mozilla Firefox renderer process via a prototype pollution vulnerability in the await implementation. In modern browser architecture design, compromising the renderer gets us just half the way there, since the…
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 NotificationDB message handler used attacker-controlled message data as an object property key without validation, allowing pollution of Object.prototype in the chrome process.
Impact
The exploit could achieve JavaScript execution in the chrome process and then native code execution outside the sandbox, but it required a separate renderer compromise first.
What the attacker needed
Renderer compromise (separate bug); Firefox 100.0.1 or earlier
The fix
Mozilla fixed this vulnerability along with the first one in Firefox 100.0.2.
How it was found
- Gain native code execution in the renderer and mark the JavaScript compartment as system.
- Patch CanCreateWrapper to always return NS_OK and call GetComponents to obtain the components object.
- Bypass the opaque proxy for ContentProcessMessageManager using a fakeObj and call NotificationDB.
- Send a Notification:Save message with origin set to "__proto__" to pollute Object.prototype.
- Open a background tab using services.ww.openWindow and crash the renderer to trigger tab restoration.
- The polluted prototype causes tab.setAttribute to set an onoverflow handler, achieving chrome-level XSS.
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.
Firefox uses a sandbox to keep a compromised web page from taking over the whole browser. This bug let a page that had already broken out of its own process trick the main browser process into running attacker code, because a message handler trusted data from the page without checking it.
What is Prototype pollution?
Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.