Unvalidated PrincipalToInherit in nsDocShellLoadState — Content Process Forges Cross-Origin Principal on about:blank
A compromised content process can send a navigation to about:blank with an unvalidated PrincipalToInherit set to another site's principal, and the parent process then forces that principal onto the resulting document. This would give the attacker same-origin access to the target site's cookies, storage and DOM, achieving universal cross-site scripting.
- Fixed in 3 months
- Paid in 4 months
- Disclosed after 3 months
Created attachment 9573287 poc-principaltoinherit-uxss.cpp
Summary
nsDocShellLoadState::PrincipalToInherit is deserialized from content process IPC (nsDocShellLoadState.cpp:94) without validation — NOT checked in ValidateWithOriginalState (lines 1348-1400). A compromised content process sends a navigation to about:blank with PrincipalToInherit set to https://bank.com. In DocumentLoadListener::SecurityFlagsForLoadInfo (DocumentLoadListener.cpp:125-137), the parent sets SEC_FORCE_INHERIT_PRINCIPAL because about:blank inherits principals by design. The resulting about:blank document gets bank.com's principal, granting full same-origin access to bank.com's cookies, localStorage, and DOM.
CheckForIncoherentResultPrincipal (nsContentSecurityManager.cpp) has a logic gap that fails to catch HTTP principals being inherited into non-HTTP URIs like about:blank.
This is UXSS — a compromised content process can forge a document with any origin's principal.
Root Cause
1. Unvalidated PrincipalToInherit
// nsDocShellLoadState.cpp:94 — Deserialized from content IPC, NO validation
mPrincipalToInherit = aLoadState.PrincipalToInherit();
NOT in ValidateWithOriginalState (lines 1348-1400). The FIXME at lines 1394-1397 explicitly acknowledges:
// FIXME: Consider calculating less information in the target process so that
// we can validate more properties more easily.
// FIXME: Identify what other flags will not change when sent through a
// content process.
2. SEC_FORCE_INHERIT_PRINCIPAL set from content-controlled principal
// DocumentLoadListener.cpp:125-137
if (aLoadState->PrincipalToInherit()) {
nsIURI* uri = aLoadState->URI();
bool inheritAttrs = nsContentUtils::ChannelShouldInheritPrincipal(
aLoadState->PrincipalToInherit(), uri,
true, // aInheritForAboutBlank ← KEY: about:blank inherits
isSrcdoc);
if (inheritAttrs && !uri->SchemeIs("data")) {
securityFlags |= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
}
}
For URI = about:blank, ChannelShouldInheritPrincipal returns true (about:blank inherits by design). SEC_FORCE_INHERIT_PRINCIPAL is set on the LoadInfo.
3. CheckForIncoherentResultPrincipal logic gap
// nsContentSecurityManager.cpp:1806-1810
if (nsScriptSecurityManager::IsHttpOrHttpsAndCrossOrigin(
resultSiteOriginURI, channelSiteOriginURI) ||
(!net::SchemeIsHttpOrHttps(resultSiteOriginURI) &&
net::SchemeIsHttpOrHttps(channelSiteOriginURI))) {
return NS_ERROR_CONTENT_BLOCKED;
}
For resultSiteOriginURI = https://bank.com and channelSiteOriginURI = about:blank:
- First condition: false (about:blank is not HTTP/HTTPS)
- Second condition: false (bank.com IS HTTP/HTTPS, so
!SchemeIsHttpOrHttpsis false)
The check does NOT block the attack. It catches http-to-http cross-origin mismatches but NOT http principals inherited into non-http URIs.
Attack Chain
Compromised content process (https://attacker.com)
│
├─ Step 1: Craft DocShellLoadStateInit
│ {
│ URI: "about:blank",
│ PrincipalToInherit: https://bank.com principal,
│ TriggeringRemoteType: own remote type (passes check),
│ TriggeringPrincipal: own principal
│ }
│
├─ Step 2: Send navigation via DocumentChannel IPC
│ → nsDocShellLoadState.cpp:94: mPrincipalToInherit = bank.com
│ → ValidateWithOriginalState does NOT check PrincipalToInherit
│
├─ Step 3: DocumentLoadListener processes navigation
│ → SecurityFlagsForLoadInfo (line 125-137):
│ ChannelShouldInheritPrincipal(bank.com, about:blank, true) → true
│ SEC_FORCE_INHERIT_PRINCIPAL set on LoadInfo
│
├─ Step 4: Channel result principal = bank.com
│ → CheckForIncoherentResultPrincipal: DOES NOT BLOCK (logic gap)
│ → GetChannelResultPrincipal returns bank.com
│
├─ Step 5: Process isolation assigns process
│ → ProcessIsolation.cpp: computes web=https://bank.com
│ → about:blank loaded in bank.com's content process
│
└─ Result:
- about:blank document has https://bank.com principal
- Same-origin access to bank.com: cookies, localStorage, DOM
- UXSS achieved — arbitrary origin access from compromised process
Impact
1. Universal Cross-Site Scripting (sec-critical → UXSS tier): A compromised content process for any origin can create documents with ANY other origin's principal. This grants:
- Read/write access to cookies (including session tokens)
- Full localStorage/sessionStorage access
- DOM access to same-origin pages
- Same-origin network requests with victim's credentials
2. Full sandbox escape (origin isolation bypass): Fission's site isolation is supposed to prevent one site from accessing another's data. This attack bypasses Fission by forging the result principal at the navigation layer, before process isolation decisions.
3. Works on default configuration: No non-default prefs required. About:blank principal inheritance is a core browser feature. Fission/process isolation is default.
4. Affects all inheritable URIs:
Not just about:blank — also about:srcdoc, and URIs with URI_INHERITS_SECURITY_CONTEXT.
Contrast
ValidateWithOriginalState validates TriggeringPrincipal (line 1371) but NOT PrincipalToInherit. Both are deserialized from the same IPC message. The omission is inconsistent — if TriggeringPrincipal needs validation, PrincipalToInherit certainly does too (it directly controls the document's final principal).
ValidateHistoryLoad (DocumentLoadListener.cpp:677-683) DOES validate PrincipalToInherit for history loads — proving Mozilla recognizes it as security-sensitive. But the main load path doesn't validate it.
Limitations
- Requires compromised content process: Standard Fission threat model.
- Confidence: MEDIUM: The full exploit chain needs verification against the actual channel creation and process switch. CheckForIncoherentResultPrincipal might have additional checks not visible in the available source.
- Process switch timing: Whether the forged PrincipalToInherit survives the process switch needs testing.
References
- docshell/base/nsDocShellLoadState.cpp:94 — PrincipalToInherit deserialized without validation
- docshell/base/nsDocShellLoadState.cpp:1348-1400 — ValidateWithOriginalState (field NOT checked)
- docshell/base/nsDocShellLoadState.cpp:1394-1397 — FIXME acknowledging incomplete validation
- netwerk/ipc/DocumentLoadListener.cpp:125-137 — SEC_FORCE_INHERIT_PRINCIPAL from content value
- dom/security/nsContentSecurityManager.cpp:1806-1810 — CheckForIncoherentResultPrincipal gap
- netwerk/ipc/DocumentLoadListener.cpp:677-683 — ValidateHistoryLoad DOES check (contrast)
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the parent process trusts the PrincipalToInherit field sent over IPC without validating it, and the later coherence check does not catch an HTTP principal being inherited into a non-HTTP URI such as about:blank.
Impact
A compromised content process could forge a document with any origin's principal, bypassing site isolation and gaining same-origin access to that origin's cookies, storage and DOM; the author rates confidence as medium and notes the chain still needs verification.
What the attacker needed
Compromised content process; default browser configuration
The fix
PrincipalToInherit should be validated in ValidateWithOriginalState the same way TriggeringPrincipal is, and the coherence check should also reject HTTP principals inherited into non-HTTP URIs.
How it was found
- Craft a DocShellLoadStateInit with URI about:blank and PrincipalToInherit set to the target site's principal.
- Send the navigation over DocumentChannel IPC so the parent deserialises the unvalidated principal.
- The parent sets SEC_FORCE_INHERIT_PRINCIPAL because about:blank inherits by design.
- The coherence check fails to block the HTTP principal on a non-HTTP URI.
- Process isolation places the about:blank document in the target site's process, giving same-origin access.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A browser tries to keep each website in its own separate process so one site cannot read another's data. This report says a malicious or compromised process can ask the browser to open a blank page but claim it belongs to a bank's website, and the browser believes it. If true, the attacker's code could then read the bank's cookies and page content as if it were the bank itself.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.