Firefox Lite history.replaceState same-origin check failure
Firefox Lite's implementation of history.replaceState failed to enforce the same-origin check required by the HTML specification, and also resolved relative URLs against the base URI. An attacker could use this to change the displayed URL to one belonging to a different origin, misleading the user about which site they are on.
Originally disclosed on Mozilla
- Fixed in 28 days
- Paid in 29 days
- Disclosed after 28 days
+++ This bug was initially created as a clone of Bug #1681103 +++
bug 1681103 comment 3 and following describes a separate issue that I'm moving to this bug.
testcase: attachment 9194803
result: attachment 9194804
There seem to be two failures to follow the [specified behavior](https://html.spec.whatwg.org/multipage/history.html#shared-history-push/replace-state-steps):
1. relative URL is resolved wrt to baseURI (minor, annoying)
2. there is no same-origin check (horrifyingly insecure)
I don't have a Firefox Lite to experiment with so I don't know if the same-origin check is always skipped or if it's only skipped in the case of relative URLs, but either way this POC demonstrates exactly why that restriction is in the standard!
I'm surprised either of these would be performed by the FF Lite browser front-end. I would have expected `replaceState` and `pushState` would be executed by the underlying platform WebView and the security checks should be at that level.
Irvan: what device do you have and android version? Does the default browser, or other WebView-based browsers have the same problem on your device? In bug 1581103 comment 0 you say the original problem doesn't reproduce in other browsers so it's likely you already tried this, but I'm very surprised at the thought of rolling our own `replaceState()` implementation.
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 browser front-end implemented replaceState itself instead of relying on the platform WebView, and omitted the same-origin validation the standard requires.
Impact
A page could set the address bar to a URL of a different origin, which could mislead users into trusting the page as another site; the text does not confirm whether this works for all URLs or only relative ones.
What the attacker needed
Firefox Lite browser; victim visits attacker page
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.
Browsers normally only let a page change its own address bar entry to another page on the same website. This check stops a malicious site from making the address bar show a trusted site's address. Firefox Lite skipped that check, so a page could pretend to be a different site.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.