Closed Bug 2026468 Opened 7 months ago Closed 7 months ago

RecvStoreAndBroadcastBlobURLRegistration allows blob URL registration under any origin

Categories

(Core :: DOM: Content Processes, defect)

Firefox 151
defect

Tracking

()

RESOLVED DUPLICATE of bug 2014103

People

(Reporter: syd9363, Unassigned)

Details

(Keywords: ai-involved, reporter-external)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36

Steps to reproduce:

Built Firefox locally from source tag FIREFOX_BETA_149_BASE-4581-gc1e060fc9eab (mozilla-unified) using the following configuration:

mozconfig:

ac_add_options --enable-debug
ac_add_options --disable-optimize
ac_add_options --enable-tests
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../firefox-research/build/obj-debug
mk_add_options MOZ_MAKE_FLAGS=-j8

Build command:

cd targets/firefox
export MOZCONFIG=$(pwd)/../firefox-research/build/mozconfig-debug
./mach build

Reproduces in a new Firefox profile. Two browser tabs are needed for the full attack: one controlled by the attacker, one with the victim origin open.

  1. Open Firefox with two tabs: https://victim.com (target) and any attacker-controlled page.
  2. From the compromised renderer process, send a forged StoreAndBroadcastBlobURLRegistration IPC message with a ContentPrincipal for victim.com:
// Compromised renderer (debug build or post-RCE):
ContentChild::GetSingleton()->SendStoreAndBroadcastBlobURLRegistration(
    "blob:https://victim.com/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"_ns,
    attackerBlob,
    ContentPrincipalInfo{ /* origin: https://victim.com */ },
    ""_ns
);
  1. From the victim.com tab, fetch the forged blob URL:
fetch("blob:https://victim.com/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
  .then(r => r.text())
  .then(t => console.log("Got:", t));

The relevant source is at dom/ipc/ContentParent.cpp:5836. Principal validation failure is log-only (ContentParent.cpp:1326–1337) — execution always reaches BlobURLProtocolHandler::AddDataEntry and BroadcastBlobURLRegistration.

Actual results:

The parent-side handler RecvStoreAndBroadcastBlobURLRegistration registered the blob under the forged victim.com principal and broadcast the registration to all content processes. Any code running in a victim.com context that fetches the blob URL receives attacker-controlled content, with the browser treating the response as same-origin to victim.com.

This is caused by ContentParent.cpp:5836 where validation failure has no return:

if (!ValidatePrincipal(aPrincipal, {ValidatePrincipalOptions::AllowSystem})) {
    LogAndAssertFailedPrincipalValidationInfo(aPrincipal, __func__);
    // NO return — registration proceeds regardless
}
BlobURLProtocolHandler::AddDataEntry(aURI, aPrincipal, ...);   // stored under forged principal
BroadcastBlobURLRegistration(aURI, blobImpl, aPrincipal, ...); // broadcast to all processes

A compromised renderer can inject attacker-controlled content into any origin's blob URL namespace. A victim.com page that fetches the blob URL receives attacker data while believing it came from its own origin — same-origin checks pass. If a victim.com service worker caches the response, the cache is poisoned. The registration is broadcast to all open tabs.

Expected results:

RecvStoreAndBroadcastBlobURLRegistration should return IPC_FAIL when validation fails rather than continuing. It should also verify that the supplied principal's origin matches the origin of the sending content process. A renderer at evil.com should not be able to register a blob URL under victim.com. The blob should not be stored or broadcast if the principal does not match the process.

Group: firefox-core-security → dom-core-security
Status: UNCONFIRMED → RESOLVED
Closed: 7 months ago
Component: Untriaged → DOM: Content Processes
Duplicate of bug: 2014103
Product: Firefox → Core
Resolution: --- → DUPLICATE
Group: dom-core-security
You need to log in before you can comment on or make changes to this bug.