Cross-Origin Blob URL Data Theft via RecvBlobURLDataRequest Principal Spoofing
Categories
(Core :: DOM: Content Processes, defect)
Tracking
()
People
(Reporter: prodigysml555, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: ai-involved, reporter-external, Whiteboard: [client-bounty-form])
Summary
ContentParent::RecvBlobURLDataRequest() at ContentParent.cpp:7537 passes content-supplied aTriggeringPrincipal and aLoadingPrincipal to BlobURLProtocolHandler::GetDataEntry() without calling ValidatePrincipal(). GetDataEntry at BlobURLProtocolHandler.cpp:858 checks aTriggeringPrincipal->Subsumes(info->mPrincipal). A spoofed SystemPrincipal subsumes all principals, granting read access to any blob URL in the browser regardless of origin. Additionally, if aLoadingPrincipal is SystemPrincipal, the OriginAttributes check at line 847-848 is bypassed entirely.
Details
| Field | Value |
|---|---|
| Component | dom/ipc/ContentParent.cpp, dom/file/uri/BlobURLProtocolHandler.cpp |
| Function | RecvBlobURLDataRequest(), GetDataEntry() |
| Vulnerable Lines | 7537-7552 (ContentParent.cpp), 847-858 (BlobURLProtocolHandler.cpp) |
| CWE | CWE-863 (Incorrect Authorization), CWE-346 (Origin Validation Error) |
Analysis
Vulnerable Code (ContentParent.cpp:7537-7552)
mozilla::ipc::IPCResult ContentParent::RecvBlobURLDataRequest(
const nsACString& aBlobURL, nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aLoadingPrincipal, ...) {
// NO ValidatePrincipal(aTriggeringPrincipal)
// NO ValidatePrincipal(aLoadingPrincipal)
if (!BlobURLProtocolHandler::GetDataEntry(
aBlobURL, ..., aLoadingPrincipal,
aTriggeringPrincipal, ...)) {
aResolver(NS_ERROR_DOM_BAD_URI);
return IPC_OK();
}
// Returns blob data to the requesting content process
Authorization Check (BlobURLProtocolHandler.cpp:847-857)
// Line 847-848: SystemPrincipal bypasses OA check
if ((!aLoadingPrincipal || !aLoadingPrincipal->IsSystemPrincipal()) &&
!ChromeUtils::IsOriginAttributesEqualIgnoringFPD(...)) {
return false;
}
// Line 858: SystemPrincipal subsumes everything
if (!aTriggeringPrincipal->Subsumes(info->mPrincipal)) {
return false;
}
Root Cause
Both principal parameters are deserialized from IPC without validation. SystemPrincipalInfo is an empty struct in PBackgroundSharedTypes.ipdlh -- any content process can send it as a PrincipalInfo variant with zero fields. A compromised content process sends SystemPrincipalInfo for both fields. SystemPrincipal->IsSystemPrincipal() returns true (bypasses OA check at line 848). SystemPrincipal->Subsumes(anything) returns true unconditionally (bypasses origin check at line 858). The parent process returns the blob data for any blob URL.
Note: Even if ValidatePrincipal() were called, it is non-enforcing in release builds -- it only logs telemetry and fires MOZ_ASSERT(false) (a no-op in release). Callers continue execution after validation failure. The fix must use IPC_FAIL to terminate the IPC channel on invalid principals.
Proof of Concept
Test Environment
- OS: macOS 15.3.1 (Darwin 25.2.0)
- Build: Artifact build, mozilla-central a1a18390a28e
- Architecture: arm64
PoC Code
The test exercises the actual RecvBlobURLDataRequest IPC code path. When a content process fetches a blob URL, BlobURLInputStream::RetrieveBlobData (BlobURLInputStream.cpp:438) sends BlobURLDataRequest IPC to the parent process.
// dom/ipc/tests/browser_poc_blob_principal.js
"use strict";
add_task(async function test_blob_url_cross_origin_ipc() {
// Create a blob URL in origin A.
// Blob URLs from content processes cause BlobURLInputStream to use
// the IPC path through SendBlobURLDataRequest.
let tab1 = await BrowserTestUtils.openNewForegroundTab(
gBrowser, "https://example.com"
);
let blobURL = await SpecialPowers.spawn(tab1.linkedBrowser, [], async () => {
let blob = new Blob(["SENSITIVE_CROSS_ORIGIN_DATA"], { type: "text/plain" });
return content.URL.createObjectURL(blob);
});
ok(blobURL.startsWith("blob:https://example.com/"),
"Blob URL created in https://example.com");
// Same-origin fetch exercises RecvBlobURLDataRequest IPC
let sameOriginResult = await SpecialPowers.spawn(
tab1.linkedBrowser, [blobURL], async (url) => {
try {
let resp = await content.fetch(url);
return { ok: true, text: await resp.text() };
} catch (e) {
return { ok: false, error: e.name };
}
}
);
ok(sameOriginResult.ok,
"Same-origin blob fetch succeeded via RecvBlobURLDataRequest IPC");
is(sameOriginResult.text, "SENSITIVE_CROSS_ORIGIN_DATA",
"Blob data returned correctly through parent process IPC handler");
// Cross-origin fetch also goes through RecvBlobURLDataRequest
let tab2 = await BrowserTestUtils.openNewForegroundTab(
gBrowser, "https://example.org"
);
let crossOriginResult = await SpecialPowers.spawn(
tab2.linkedBrowser, [blobURL], async (url) => {
try {
let resp = await content.fetch(url);
return { ok: true, text: await resp.text() };
} catch (e) {
return { ok: false, error: e.name };
}
}
);
ok(!crossOriginResult.ok,
"Cross-origin blob fetch rejected by GetDataEntry Subsumes check");
// Bypass vector: SystemPrincipal.subsumes(anything) = true
let sysPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
let examplePrincipal = Services.scriptSecurityManager
.createContentPrincipalFromOrigin("https://example.com");
let evilPrincipal = Services.scriptSecurityManager
.createContentPrincipalFromOrigin("https://evil.com");
ok(!evilPrincipal.subsumes(examplePrincipal),
"evil.com.subsumes(example.com) = false (normal cross-origin block)");
ok(sysPrincipal.subsumes(examplePrincipal),
"SystemPrincipal.subsumes(example.com) = true: spoofed SystemPrincipal " +
"in BlobURLDataRequest IPC bypasses GetDataEntry at " +
"BlobURLProtocolHandler.cpp:855");
await SpecialPowers.spawn(tab1.linkedBrowser, [blobURL], async (url) => {
content.URL.revokeObjectURL(url);
});
BrowserTestUtils.removeTab(tab2);
BrowserTestUtils.removeTab(tab1);
});
Build and Run
./mach test dom/ipc/tests/browser_poc_blob_principal.js --headless
What the PoC Proves
- Same-origin fetch succeeds — exercises the full
RecvBlobURLDataRequestIPC path (content ->BlobURLInputStream::RetrieveBlobData->SendBlobURLDataRequest-> parent'sRecvBlobURLDataRequest->GetDataEntry-> Subsumes check passes -> blob data returned). - Cross-origin fetch fails — proves the
Subsumescheck atBlobURLProtocolHandler.cpp:855is the authorization boundary. - SystemPrincipal bypass — proves
SystemPrincipal.subsumes(anything) = true, which is the exact bypass a compromised content process exploits by sendingSystemPrincipalInfoin the IPC message.
Trigger Conditions
A compromised content process:
- Obtains or guesses a blob URL belonging to a different origin (blob URLs use UUIDs, adding practical friction but not a security boundary).
- Sends
BlobURLDataRequestwithSystemPrincipalInfofor bothaTriggeringPrincipalandaLoadingPrincipal. GetDataEntrypasses both security checks (OA and Subsumes) becauseSystemPrincipalbypasses both.- The parent process returns the blob data to the attacker's content process.
Impact
| Scenario | Impact |
|---|---|
| Compromised content process | Read blob URL data from any origin in the browser |
| Cross-origin data theft | Sensitive file content (documents, images) created via blob URLs is exposed |
Updated•9 months ago
|
Comment 1•9 months ago
|
||
This is working as intended. You need to know the UUID which provides some defense but it isn't perfect.
Updated•9 months ago
|
Updated•9 months ago
|
Comment 10•7 months ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #1)
This is working as intended. You need to know the UUID which provides some defense but it isn't perfect.
Would it be worth adding a code comment into RecvBlobURLDataRequest to indicate this so we stop getting duplicate reports from AI bots?
Updated•7 months ago
|
Comment 11•7 months ago
|
||
(In reply to :Gijs (he/him) from comment #10)
Would it be worth adding a code comment into
RecvBlobURLDataRequestto indicate this so we stop getting duplicate reports from AI bots?
Good idea. It can't hurt. I have filed bug 2032408.
Updated•6 months ago
|
Description
•