Origin Spoofing in WebRTCParent/Child's unused PeerConnectionBlocker mechanism
Categories
(Core :: WebRTC, defect, P3)
Tracking
()
People
(Reporter: define.ctf, Unassigned)
References
Details
(Keywords: ai-involved, good-first-bug, reporter-external)
SECURITY VULNERABILITY REPORT - ORIGIN SPOOFING
=== SUMMARY ===
WebRTCParent uses Object.assign() with trusted origin placed FIRST and child-controlled
data SECOND, allowing compromised renderers to overwrite the trusted origin field. This
bypasses all WebRTC policy blockers including enterprise policies and WebExtension
blocking rules.
=== COMPONENT ===
File: resource:///actors/WebRTCParent.sys.mjs
Lines: 40-56 (approximate)
Source: https://searchfox.org/mozilla-central/source/browser/actors/WebRTCParent.sys.mjs
=== AFFECTED VERSIONS ===
Firefox Desktop (all recent versions with WebRTC)
Platforms: Windows, macOS, Linux
=== VULNERABILITY DETAILS ===
The rtcpeer:Request handler incorrectly uses Object.assign():
case "rtcpeer:Request": {
let params = Object.freeze(
Object.assign(
{ origin: this.manager.documentPrincipal.origin }, // ⚠️ FIRST (trusted)
aMessage.data // ⚠️ SECOND (child-controlled) → OVERWRITES origin!
)
);
for (let blocker of lazy.webrtcUI.peerConnectionBlockers) {
let result = await blocker(params); // ⚠️ Receives SPOOFED origin
}
}
JavaScript Object.assign() Behavior:
- Copies properties from right to left
- Later properties OVERWRITE earlier ones
- Child-controlled data overwrites trusted origin
Critical Issues:
❌ Trusted origin placed FIRST in Object.assign
❌ Child data placed SECOND (overwrites trusted data)
❌ No validation that origin matches documentPrincipal
❌ All peerConnectionBlockers receive spoofed origin
❌ Enterprise policies bypassed
❌ WebExtension blocking bypassed
=== ATTACK MECHANISM ===
Normal Flow (Safe):
- evil.com wants to use WebRTC
- Browser sends { origin: "https://evil.com" } to blockers
- Enterprise policy blocks evil.com
- WebRTC connection denied
Attack Flow (Spoofed):
- Compromised renderer on evil.com
- Sends rtcpeer:Request with: { origin: "https://accounts.google.com", callID: "...", secure: true }
- Object.assign overwrites trusted origin
- params = { origin: "https://accounts.google.com", ... }
- Blockers see accounts.google.com instead of evil.com
- WebRTC connection ALLOWED (bypass successful)
=== PROOF OF CONCEPT ===
From compromised content process:
// Normal WebRTC request (would be blocked)
// origin: evil.com → blocked by policy
// Malicious WebRTC request (spoofed origin)
const actor = windowGlobalChild.getActor("WebRTC");
actor.sendAsyncMe
Comment 1•8 months ago
|
||
This was originally filed as an open bug, rather than security sensitive.
Comment 2•8 months ago
|
||
AFAICT nothing uses the blocker mechanism so this doesn't actually achieve anything. It looks like it was added in bug 1310355 for use by add-ons, but isn't exposed to add-ons in any meaningful way anymore.
Updated•8 months ago
|
Comment 3•8 months ago
•
|
||
Feels like a front-end bug, I don't think the webrtc platform team works on this code. However, Jib r+'d that old patch, so I'm going to ni him for a look -
https://hg-edge.mozilla.org/mozilla-central/rev/eba5bc9fc212
Updated•8 months ago
|
Comment 4•8 months ago
|
||
As comment 2 suggests, this is not a sec bug. No parent resource is protected by this origin.
Long ago this mechanism was for add-ons to add additional permission prompts over and above those already present in Firefox.
It has been overtaken by architecture changes, and would need work to bring back as a feature.
Otherwise, it's a valid report that the code is careless. Instead of this:
let params = Object.freeze(Object.assign({
origin: aMessage.target.contentPrincipal.origin
}, aMessage.data));
...the intent was likely to match this related use of freeze:
let params = Object.freeze({
origin: aMessage.target.contentPrincipal.origin,
callID: aMessage.data
});
Updated•8 months ago
|
Updated•8 months ago
|
Description
•