Closed Bug 2035756 Opened 6 months ago Closed 4 months ago

Fission Escape via Unvalidated PrincipalToInherit in nsDocShellLoadState: Compromised Content Process can load about:srcdoc for arbitrary principal and data

Categories

(Core :: DOM: Navigation, defect)

defect

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox-esr115 153+ fixed
firefox-esr140 153+ fixed
firefox151 --- wontfix
firefox152 --- wontfix
firefox153 + fixed
firefox154 + fixed

People

(Reporter: vhilla, Assigned: vhilla)

References

(Blocks 1 open bug)

Details

(Keywords: csectype-sop, sec-high, Whiteboard: [fixes sec-high bug 2034682][adv-main153+r][adv-esr140.13+r][adv-esr115.38+r])

Attachments

(2 files, 4 external files)

Attached patch patch — — Splinter Review

I'm reporting a bug that allows a compromised content process to load arbitrary code in a different origin via about:srcdoc, i.e. escape site isolation.

Bug 2034682 reports a supposed UXSS because a compromised content process could forge nsDocShellLoadState::PrincipalToInherit and the parent doesn't verify it. That bug uses about:blank and Nika points out that this might not be exploitable because it's just

loading a non-controllable empty about:blank document into an arbitrary origin's content process

This changes if we load about:srcdoc and I attached a PoC, just build and run MOZ_POC_UXSS=1 ./mach run poc_principal_inherit.html. I suppose the suggested fix in the original bug might still apply here too.

I filed this as a separate bug because I'm unsure how aware the original reporter is of this possibility.

I still want to test whether this could load a system principal, though I think we do check that content can't load system? Edit: Correct, trying to use a system principal gets us a null principal.

See Also: → CVE-2026-16349

The original bug does mention the possibility of about:srcdoc, though it does not go into any detail about how to do anything with it, so maybe we should give the other bug the "proper" rating and then leave this as sec-other? I'll switch it to "depends on".

  1. Affects all inheritable URIs:
    Not just about:blank — also about:srcdoc, and URIs with URI_INHERITS_SECURITY_CONTEXT.
Group: core-security → dom-core-security
Depends on: CVE-2026-16349
See Also: CVE-2026-16349 →
Keywords: sec-other
Whiteboard: fixes sec-high bug 2034682

Just a note on the sec rating from a discussion I had. The exploit allows a compromised content to host about:srcdoc with arbitrary code in a different non-compromised process and origin. The PoC embeds a target page, but interesting targets like bank pages won't let themselves be embedded. But executing code in a different process could allow an attacker to compromise other processes too. So sec-high makes sense.

Severity: -- → S2

Reproduced on mozilla-central and esr115 using localhost:8000/poc_principal_inherit.html.

Attached file poc3.diff —

ValidatePrincipalCouldPotentiallyBeLoadedBy in D299974 might not suffice. I created a third PoC where we jump from example.com via about:reader to example.org. Because an about: process has no origin suffix and falls through this check. Edit: actually, it gets put into the shared "web" remote type process. But still, it doesn't have an origin suffix and is less locked down.

We currently have three related bugs. The initial bug 2034682, forging mPrincipalToInherit to load about:blank in a different origin. This bug 2035756 reported by me to show this can be used to execute arbitrary code in that process / origin. And bug 2040160 discovered independently to show this can be used to gain system principal.

Bug 2040160 is simple to fix by adding some checks for about:srcdoc.

I have a patch in bug 2034682 to validate the principal, but it can be circumvented (poc3.diff). From discussion with Nika, the patch is hard to uplift and locking the exploit down completely is tricky right now. See bug 2027207, there has been recent work to improve process isolation checks, some not yet in release. Uplifting a fix to a version without that recent work bears the risk of blocking / crashing legitimate loads.

My suggestion is

  • Bug 2040160 gets fixed and uplifted as usual, without mentioning the principal issue.
  • D299974 lands as enhancement and doesn't get uplifted. It fixes the straightforward version from the attached patch file. Having some validation hopefully makes it less likely someone looks and discovers something like poc3.diff. By now, two reporters found the lack of validation independently via LLMs.
  • The three bugs remain private. Unsure if that requires setting something on bug 2040160 if it gets fixed.

ni? Nika to make sure I got things right. Do you have something D299974 could land together with? Otherwise I'd file a bug and phrase it as follow-up to bug 2027207. Or bundle it in bug 2039808, but the mTriggeringWindowId part would need some debugging.

Flags: needinfo?(nika)

Sorry for the slow response. I think adding more validation like that as a normal enhancement makes sense. I'm also landing other principal validation patches as enhancements on nightly, and it's a known gap in our security that we don't defend peer content processes very well against cross-origin attacks. The big things which are notable here are any cases where we can escalate to the privilegedabout process, or to the parent process.

Flags: needinfo?(nika)

The bug is marked as tracked for firefox152 (beta) and tracked for firefox153 (nightly). However, the bug still isn't assigned.

:hsinyi, could you please find an assignee for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit BugBot documentation.

Flags: needinfo?(htsai)
Assignee: nobody → vhilla
Flags: needinfo?(htsai)
Depends on: 2045635
See Also: → CVE-2026-15719
See Also: → 2046997
Duplicate of this bug: 2046997
Duplicate of this bug: 2047875

The current situation is that

  • A patch is landing and will be uplifted to block cross process javascript: loads (bug 2043820).
  • A patch was uplifted to block srcdoc in top-level or on non-srcdoc URIs (bug 2040160).
  • A patch is riding the train to verify principals in nsDocShellLoadState (bug 2045635).

What is left is that

  • The patch to verify mPrincipalToInherit can't be uplifted and doesn't cover poc3.diff. We could look into asserting that for about:srcdoc, the embedder subsumes the srcdoc principal.
  • One can forge principals on a SH entry without touching nsDocShellLoadState (bug 2046558).
  • mResultPrincipalURI isn't verified and can be used similar to mPrincipalToInherit with about:srcdoc or data: URIs (bug 2049792).
  • Blob URI registration verifies principals, but a workaround like poc3.diff might be possible.
  • One can navigate to a top level chrome URI (bug 2048793).
Attached file (secure) —
No longer depends on: CVE-2026-16349

Marking 154 as affected because bug 2045635 has the poc3.diff gap.

See Also: → CVE-2026-16349
See Also: → CVE-2026-12295
Group: dom-core-security → core-security-release
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch

:dveditz, I think this should be csectype-sop, but not csectype-sandbox-escape.

A compromised content process can execute code in another origin, but not in the parent process (unlike bug 2040160). Bug 2043820 is pretty similar and got sec-moderate due to requiring the compromised content.

Flags: needinfo?(dveditz)
Attached file (secure) —
Attachment #9606159 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: sec-high: compromised content process can execute code in other origins
  • Code covered by automated testing?: unknown
  • Fix verified in Nightly?: no
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing: To simulate a compromised content process, Firefox needs to be built with the attached patch. Then set MOZ_POC_UXSS=1 and open ./poc_principal_inherit.html. The iframe should be blank and not contain the text origin: example.org, or crash on debug.
  • Risk associated with taking this patch: low
  • Explanation of risk level: In general, about:srcdoc should be embedded same-origin and data: URIs should have a null principal. Adding checks for that should thus be low-risk.

The patch covers two edge cases and I don't expect there to be more, but if there are, I don't think they would break much.

  • String changes made/needed?: No
  • Is Android affected?: yes
Attached file (secure) —
Attachment #9606161 - Flags: approval-mozilla-esr140?

firefox-esr140 Uplift Approval Request

  • User impact if declined/Reason for urgency: sec-high: compromised content process can execute code in other origins
  • Code covered by automated testing?: unknown
  • Fix verified in Nightly?: no
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing: To simulate a compromised content process, Firefox needs to be built with the attached patch. Then set MOZ_POC_UXSS=1 and open ./poc_principal_inherit.html. The iframe should be blank and not contain the text origin: example.org, or crash on debug.
  • Risk associated with taking this patch: low
  • Explanation of risk level: In general, about:srcdoc should be embedded same-origin and data: URIs should have a null principal. Adding checks for that should thus be low-risk.

The patch covers two edge cases and I don't expect there to be more, but if there are, I don't think they would break much.

  • String changes made/needed?: No
  • Is Android affected?: yes
Attached file (secure) —
Attachment #9606162 - Flags: approval-mozilla-esr115?

firefox-esr115 Uplift Approval Request

  • User impact if declined/Reason for urgency: sec-high: compromised content process can execute code in other origins
  • Code covered by automated testing?: unknown
  • Fix verified in Nightly?: no
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing: To simulate a compromised content process, Firefox needs to be built with the attached patch. Then set MOZ_POC_UXSS=1 and open ./poc_principal_inherit.html. The iframe should be blank and not contain the text origin: example.org, or crash on debug.
  • Risk associated with taking this patch: low
  • Explanation of risk level: In general, about:srcdoc should be embedded same-origin and data: URIs should have a null principal. Adding checks for that should thus be low-risk.

The patch covers two edge cases and I don't expect there to be more, but if there are, I don't think they would break much.

  • String changes made/needed?: No
  • Is Android affected?: yes

sec-high with the csectype-sandbox-escape keyword require sec-aproval

Flags: needinfo?(vhilla)

Comment on attachment 9602920 [details]
(secure)

Security Approval Request

  • How easily could an exploit be constructed based on the patch?: It requires a compromised content process.
    If that's given, I think it's simple to find out how to forge the principal on data or srcdoc and get them to execute code in a different origin.
  • Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: No
  • Which branches (beta, release, and/or ESR) are affected by this flaw, and do the release status flags reflect this affected/unaffected state correctly?: all
  • If not all supported branches, which bug introduced the flaw?: None
  • Do you have backports for the affected branches?: Yes
  • If not, how different, hard to create, and risky will they be?:
  • How likely is this patch to cause regressions; how much testing does it need?: In general, about:srcdoc should be embedded same-origin and data: URIs should have a null principal. Adding checks for that should thus be low-risk.
    The patch covers two edge cases and I don't expect there to be more, but if there are, I don't think they would break much.
  • Is the patch ready to land after security approval is given?: Yes
  • Is Android affected?: Yes
Flags: needinfo?(vhilla)
Attachment #9602920 - Flags: sec-approval?

I am uplifting to branches even though it doesn't have sec-approval+ yet as it already landed in main and we are nearing the end of the beta cycle.

Attachment #9606159 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9606161 - Flags: approval-mozilla-esr140? → approval-mozilla-esr140+
Attachment #9606162 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+
Regressions: 2054139
QA Whiteboard: [sec] [uplift] [qa-triage-done-c154/b153]

( clearing my ni? and working on this in bug 2054139 )

Flags: needinfo?(vhilla)
Duplicate of this bug: CVE-2026-16349

Because this is fixing https://bugzilla.mozilla.org/show_bug.cgi?id=2049792#c19, I guess sandbox escape makes sense now.

Flags: needinfo?(dveditz)
Duplicate of this bug: 2049792
No longer duplicate of this bug: 2049792
See Also: → 2054677
No longer duplicate of this bug: CVE-2026-16349
Whiteboard: fixes sec-high bug 2034682 → [fixes sec-high bug 2034682][adv-main153+r][adv-esr140.13+r][adv-esr115.38+r]

Comment on attachment 9602920 [details]
(secure)

Clearing flag or retroactively granting, whichever

Attachment #9602920 - Flags: sec-approval? → sec-approval+
See Also: → , CVE-2026-74939, 2045635
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: