Closed Bug 2031619 Opened 7 months ago Closed 7 months ago

Compromised renderer can forge origin in PBroadcastChannel constructor -> cross-origin message eavesdropping and spoofing

Categories

(Core :: DOM: postMessage, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 2016925

People

(Reporter: pakhunov.anton.n, Unassigned)

Details

(Keywords: ai-involved, reporter-external, Whiteboard: [client-bounty-form])

Attachments

(1 file)

Found by: manual code review of IPC principal validation at component boundaries
File: ipc/glue/BackgroundParentImpl.cpp ~line 786
dom/broadcastchannel/BroadcastChannelParent.cpp
dom/broadcastchannel/BroadcastChannelService.cpp
Firefox version: mozilla-central (trunk)
OS: all platforms

RecvPBroadcastChannelConstructor receives aPrincipalInfo and aOrigin from
the child process, then dispatches an async CheckPrincipalRunnable to the
main thread for validation. The BroadcastChannelParent actor is registered
in the shared BroadcastChannelService::mAgents hashmap in its constructor —
before the check fires.

The check (CheckPrincipalRunnable::Run) only verifies that aPrincipalInfo
and aOrigin are internally consistent with each other: it converts
aPrincipalInfo → principal, calls GetOrigin(), and compares to aOrigin.
Both values come from the attacker. There is no check that the sending
process is authorized for the claimed origin.

BroadcastChannelService is a single background-thread singleton shared
across all content process connections (sBackgroundThread is a
process-level static). All renderers' actors are in the same mAgents map.

Attack (compromised renderer for evil.com targeting bank.com):

  1. Send PBroadcastChannelConstructor with:
    aPrincipalInfo = ContentPrincipalInfo{ spec: "https://bank.com/", originNoSuffix: "https://bank.com" }
    aOrigin = "https://bank.com"
    aChannel = "sessionSync" (known or guessed channel name)
  2. AllocPBroadcastChannelParent builds key "sessionSync|https://bank.com"
    and registers the actor in mAgents.
  3. CheckPrincipalRunnable fires: both IPC values are consistently
    "https://bank.com" → check passes, process not killed.
  4. Malicious actor now permanently receives every BroadcastChannel message
    sent by legitimate https://bank.com tabs ("sessionSync"), and can inject
    messages that those tabs receive as same-origin.

Impact: cross-origin BroadcastChannel eavesdropping + message spoofing.
Breaks site isolation. Requires compromised renderer (not triggerable from
JavaScript alone).

The fix is to call ContentParent::ValidatePrincipal (which checks
ValidatePrincipalCouldPotentiallyBeLoadedBy against the process remote type)
on the IPC-supplied principal — as is done for clipboard, notifications, and
initial window initialization — but is absent here.

Flags: sec-bounty?
OS: Unspecified → All
Hardware: Unspecified → All
Version: unspecified → Trunk
Group: firefox-core-security → dom-core-security
Status: UNCONFIRMED → RESOLVED
Closed: 7 months ago
Component: Security → DOM: postMessage
Duplicate of bug: 2016925
Product: Firefox → Core
Resolution: --- → DUPLICATE
Flags: sec-bounty? → sec-bounty-
Group: dom-core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: