SessionHistory IPC accepts non-sender-owned BrowsingContext and lets popup content drive opener/victim history traversal
Categories
(Core :: DOM: Navigation, defect)
Tracking
()
People
(Reporter: mihebur, Assigned: farre)
Details
(4 keywords, Whiteboard: [adv-main155+][adv-esr153.2+])
Attachments
(6 files, 2 external files)
|
8.18 KB,
text/markdown
|
Details | |
|
4.57 KB,
patch
|
Details | Diff | Splinter Review | |
|
21.38 KB,
text/plain
|
Details | |
|
6.75 KB,
patch
|
Details | Diff | Splinter Review | |
|
1.53 KB,
patch
|
Details | Diff | Splinter Review | |
|
65.64 KB,
application/octet-stream
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
Steps to reproduce:
I tested the Firefox SessionHistory IPC path with a PoC that models a compromised or confused content-side sender.
This report is related in class to bug 2047357 and bug 2048592, but affects a different consumer: SessionHistory / HistoryGo. I am filing it as a limited-impact IPC ownership/hardening issue in the same family, not as a claim of sandbox escape or direct cross-origin data access.
The PoC creates a victim/opener tab on mochi.test with two same-tab history entries, then opens an attacker popup on example.com. The PoC changes only the content-side sender path immediately before ContentChild::SendHistoryGo(...), retargeting HistoryGo(-1) from the popup's own BrowsingContext to the opener/victim BrowsingContext.
I ran:
MOZ_HEADLESS=1 ./mach test docshell/test/browser/browser_fip030_history_go_cross_bc_opener_probe.js
The attached markdown file contains the full technical writeup, patch, and runtime evidence.
Actual results:
The parent accepted the retargeted BrowsingContext and applied the history traversal to the opener/victim tab.
Key runtime evidence:
FIP030-SENDER retarget HistoryGo senderBC=17179869185 openerBC=15 offset=-1
FIP030 victim navigated after attacker history.back(): true
FAIL test_cross_bc_history_go_to_opener - A popup content process should not drive opener/victim session history traversal
The victim/opener tab navigated from victim2 back to victim1 after the attacker popup called history.back().
I am not claiming sandbox escape, memory corruption, direct cross-origin data read, or arbitrary script execution. The demonstrated issue is an IPC trust-boundary failure. The test sets browser.navigation.requireUserInteraction to false to isolate the ownership-validation issue; the default value is true, so practical reach is likely limited by existing history/user-interaction rules.
Expected results:
The parent-side SessionHistory IPC receiver should reject, ignore, or otherwise avoid applying HistoryGo to a BrowsingContext that is not owned by, or authorized for, the sending content process.
A popup/content sender should not be able to drive its opener/victim tab's session history traversal by retargeting HistoryGo IPC to the opener's BrowsingContext.
More generally, the family of parent-side receivers that accept MaybeDiscardedBrowsingContext from content should be audited to ensure they validate sender ownership before applying state changes, dispatching events, or routing browser/user actions.
In the PoC, the victim/opener tab should have remained on victim2.
Comment 1•5 months ago
|
||
This report refers to a test case file that does not exist. Please attach it to the bug report.
Updated•5 months ago
|
Updated•5 months ago
|
(In reply to Andrew McCreight [:mccr8] from comment #1)
This report refers to a test case file that does not exist. Please attach it to the bug report.
Sorry about that. The original attachment was the technical writeup, but I did not attach the standalone testcase patch.
I am attaching the patch containing the browser-chrome testcase:
docshell/test/browser/browser_fip030_history_go_cross_bc_opener_probe.js
The patch also contains the small content-side sender instrumentation used to model a compromised/confused sender retargeting HistoryGo to the opener BrowsingContext.
I also attached the clean test output. Key runtime lines:
FIP030-SENDER retarget HistoryGo senderBC=17179869185 openerBC=15 offset=-1
FIP030 victim navigated after attacker history.back(): true
I also tested the adjacent NavigationTraverse IPC path as a sibling variant of this issue.
ContentParent::RecvNavigationTraverse has the same sender-supplied MaybeDiscarded<BrowsingContext> shape: it resolves aContext.get_canonical() and calls canonical->NavigationTraverse(..., Some(ChildID()), ...) without an explicit check that the sender owns the supplied BrowsingContext.
I will attach the supporting artifacts separately:
fip064-navigationtraverse-crossbc.patchfip064-navigationtraverse-parent-key-override.patchfip064-navigationtraverse-parent-override-test.log
The probe retargets the popup content process' outgoing SendNavigationTraverse message to the opener/victim BrowsingContext, then supplies the victim's Navigation API key at the parent boundary.
Runtime result from fip064-navigationtraverse-parent-override-test.log:
FIP064-SENDER retarget NavigationTraverse senderBC=17179869185 openerBC=15
FIP064-PARENT override NavigationTraverse key=e4b05451-6049-4f1a-ac09-325f336daa73 child=9
FIP064 attacker traverseTo(local key) result after IPC retarget shim: completed
FIP064 victim navigated after attacker NavigationTraverse IPC retarget: true
FAIL ... A popup content process should not drive opener/victim NavigationTraverse
Scope note: the normal public Navigation API rejects a key that is not present in the popup's own entry list before IPC. This probe tests the parent-side IPC trust boundary, not unmodified page JavaScript directly calling navigation.traverseTo() with another tab's key.
This appears to be the same ownership-validation class as the original HistoryGo issue, exposed through RecvNavigationTraverse. It may be worth auditing other parent receivers that accept sender-supplied MaybeDiscarded<BrowsingContext> values.
Comment 9•5 months ago
|
||
The rating assigned by our bug rating tool (currently under development) is:
Rating: sec-low
Explanation: The report accurately describes the code: ContentParent::RecvHistoryGo and RecvNavigationTraverse (dom/ipc/ContentParent.cpp ~7542-7566) resolve a sender-supplied MaybeDiscarded<BrowsingContext> and call CanonicalBrowsingContext::HistoryGo / NavigationTraverse without verifying the sending content process owns that BrowsingContext. This is a genuine IPC ownership/trust-boundary (defense-in-depth) gap. However, the issue is NOT reachable from unmodified Firefox: the reporter explicitly patches the content-side sender (ContentChild::SendHistoryGo / SendNavigationTraverse) to retarget the message to the opener BC, i.e. it models a compromised/confused content process. Normal page JS cannot reach it (the public History/Navigation APIs only ever send the page's own BC and validate keys before IPC), and the PoC additionally flips the default pref browser.navigation.requireUserInteraction (true by default) to false. Even when triggered, the impact is strictly bounded: the attacker can only drive the victim/opener tab back/forward within entries already in its own session history. There is no memory corruption, no sandbox escape, no cross-origin data read, and no ability to navigate the victim to an arbitrary attacker URL. Given the clear security implication but very limited scope and the requirement of an already-compromised content process plus a non-default pref, sec-low is appropriate (this is essentially an IPC hardening issue); it is not memory-safety or data-disclosure and so does not rise to moderate/high. No screenshots/videos required review.
| Assignee | ||
Updated•5 months ago
|
| Assignee | ||
Updated•5 months ago
|
| Assignee | ||
Comment 10•5 months ago
|
||
Comment 11•5 months ago
|
||
Comment 12•5 months ago
|
||
Comment 13•5 months ago
•
|
||
Backed out for causing mochitest failures at test_hashchange_popstate_event_order.html
Backout link
Push with failures
Failure log(s) 1
Failure log(s) 2
and aslo this log and this dt failure
And also this - log
| Assignee | ||
Updated•5 months ago
|
Comment 14•4 months ago
|
||
There is an r+ patch which didn't land and no activity in this bug for 1 week.
:farre, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.
Updated•4 months ago
|
| Assignee | ||
Updated•4 months ago
|
Comment 15•4 months ago
|
||
Comment 16•4 months ago
|
||
Comment 17•4 months ago
|
||
TEST-UNEXPECTED-FAIL | /navigation-api/navigation-history-entry/after-detach.html | navigation.currentEntry/entries()/canGoBack/canGoForward after iframe removal - promise_test: Unhandled rejection with value: object "InvalidStateError: No such entry with key found"
followed by more failures, see the log.
Comment 18•4 months ago
|
||
(I think :farre is on PTO for a while, so adding a needinfo on :smaug to potentially take a look, but leaving :farre's needinfo in case someone is monitoring his needinfos.)
Comment 20•3 months ago
|
||
Updated•3 months ago
|
Comment 21•3 months ago
|
||
| bugherder | ||
Comment 22•3 months ago
|
||
Authored by https://github.com/farre
https://github.com/mozilla/enterprise-firefox/commit/cd138927aae91bf4e89e3ee676b496c4c1da2aaf
[enterprise-main] Bug 2048699 - Ensure the browsing context can do history traversal. r=dom-core-reviewers,smaug
Updated•3 months ago
|
Comment 24•3 months ago
|
||
firefox-esr153 Uplift Approval Request
- User impact if declined/Reason for urgency: Possible for compromised process to control global history navs.
- Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Performs an IPC filtering, following a common do nothing pattern.
- String changes made/needed?: None
- Is Android affected?: yes
| Assignee | ||
Comment 25•3 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D308961
| Assignee | ||
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Comment 26•3 months ago
|
||
| uplift | ||
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•21 days ago
|
Description
•