Closed Bug 2076073 Opened 1 month ago Closed 1 month ago

ContentParent::RecvBlobURLDataRequest does not validate principals from content process — cross-origin blob data theft via forged SystemPrincipal

Categories

(Core :: DOM: Content Processes, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 2014103

People

(Reporter: nguyentuanhung1149, Unassigned)

Details

Summary

ContentParent::RecvBlobURLDataRequest (dom/ipc/ContentParent.cpp, lines 7537-7557 on mozilla-central tip) receives aTriggeringPrincipal and aLoadingPrincipal from the content process but does NOT call ValidatePrincipal() before passing them to BlobURLProtocolHandler::GetDataEntry(). This allows a compromised content process to forge SystemPrincipal, bypassing blob URL access controls and stealing cross-origin blob data.

Comparison with Other Handlers

Other IPC handlers in ContentParent.cpp that receive principals DO validate them:

  • RecvLoadURIExternal (line 4762): ValidatePrincipal(aTriggeringPrincipal) ✅
  • RecvStoreUserInteractionAsPermission (line 6715): ValidatePrincipal(aPrincipal) ✅
  • RecvBlobURLDataRequest (line 7537): NO ValidatePrincipal call ❌

Impact Chain

Step 1: Compromised content process sends forged request

A compromised content process sends PContent::BlobURLDataRequest with:

  • aBlobURL = a known cross-origin blob URL
  • aLoadingPrincipal = SystemPrincipal (forged)
  • aTriggeringPrincipal = SystemPrincipal (forged)
  • Other fields matching expected values

Step 2: GetDataEntry access checks bypassed

In BlobURLProtocolHandler::GetDataEntry (dom/file/uri/BlobURLProtocolHandler.cpp, lines 780-840):

Origin attributes check (lines 808-814):

if ((NS_WARN_IF(!aLoadingPrincipal) ||
     !aLoadingPrincipal->IsSystemPrincipal()) &&   // ← SystemPrincipal BYPASSES this check
    NS_WARN_IF(!ChromeUtils::IsOriginAttributesEqualIgnoringFPD(
        aOriginAttributes,
        BasePrincipal::Cast(info->mPrincipal)->OriginAttributesRef()))) {
  return false;
}

With forged SystemPrincipal as aLoadingPrincipal, IsSystemPrincipal() returns true, and the entire origin attributes check is SKIPPED.

Subsumes check (lines 816-818):

if (NS_WARN_IF(!aTriggeringPrincipal->Subsumes(info->mPrincipal))) {
  return false;
}

SystemPrincipal subsumes ALL principals, so this check ALWAYS passes with forged SystemPrincipal.

Step 3: Cross-origin blob data returned

GetDataEntry returns the blob implementation to the content process, completing the cross-origin data theft.

The SystemPrincipal Bypass is Intentional — But Only for Parent Process

The code comment at lines 802-806 explains:

// We also allow the system principal to create the channel regardless of
// the OriginAttributes.  This is primarily for the benefit of mechanisms
// like the Download API that explicitly create a channel with the system
// principal

This bypass is designed for legitimate parent-process APIs (Download API), NOT for content processes. But without ValidatePrincipal() in RecvBlobURLDataRequest, content processes can abuse it.

Steps to Reproduce (Code Path PoC)

  1. Content process constructs BlobURLDataRequest IPC message with:
    • aBlobURL = "blob:https://victim.com/UUID" (a known cross-origin blob URL)
    • aTriggeringPrincipal = SystemPrincipalInfo{} (serialized SystemPrincipal)
    • aLoadingPrincipal = SystemPrincipalInfo{}
    • aOriginAttributes = default OriginAttributes{}
  2. Parent process receives in RecvBlobURLDataRequest (line 7537)
  3. No ValidatePrincipal check — forged SystemPrincipal accepted
  4. GetDataEntry called with SystemPrincipal — bypasses all access checks
  5. Cross-origin blob data serialized and sent back to content process

Affected Versions

mozilla-central tip (verified 2026-09-28)

Suggested Fix

Add ValidatePrincipal() calls for both principals, matching the pattern used by other IPC handlers:

if (!ValidatePrincipal(aTriggeringPrincipal)) {
  return PrincipalValidationIpcFail(aTriggeringPrincipal, this, __func__);
}
if (!ValidatePrincipal(aLoadingPrincipal,
                       {ValidatePrincipalOptions::AllowNullPtr})) {
  return PrincipalValidationIpcFail(aLoadingPrincipal, this, __func__);
}

Credit

Nguyen Tuan Hung (nguyentuanhung1149@gmail.com) VNUHCM - UIT

Group: core-security
Status: UNCONFIRMED → RESOLVED
Closed: 1 month ago
Component: DOM: File → DOM: Content Processes
Duplicate of bug: 2014103
Resolution: --- → DUPLICATE
Severity: S2 → --
You need to log in before you can comment on or make changes to this bug.