UXSS: location.origin is changed (port/host)
A universal cross-site scripting (UXSS) issue in Firefox where a page can change its own origin's port (and possibly host) by modifying a window proxy property, causing location.origin to report a different value. An attacker could potentially use this to bypass same-origin policy and access data from other origins.
Originally disclosed on Mozilla
- Fixed in 2 months
- Paid in 2 months
- Disclosed after 2 months
Firefox version: firefox-91.0b9 OS: Ubuntu 18.04.1
There is a console.log printing location.origin on poc.html #9(console.log(location.origin);).
If you turn on the devtools.console.stdout.content setting and run firefox, you can see that location.origin is changed.
The part to change the port or host of origin is line 34 and 35 in poc.html.
v96.port = 1234;
It seems that changing the host does not work well, but it is possible to change it to something else arbitrarily.
- reproduce
host poc.html at http://127.0.0.1:7000/poc.html then
~/firefox/firefox-91.0b9/firefox --headless http://127.0.0.1:7000/poc.html
result is here.
*** You are running in headless mode.
[GFX1-]: glxtest: Unable to open a connection to the X server
[GFX1-]: glxtest: libEGL initialize failed
[GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
console.log: "http://127.0.0.1:7000"
console.log: "http://127.0.0.1:7000"
console.log: "http://127.0.0.1:7000"
console.log: "http://127.0.0.1:7000"
console.log: "http://127.0.0.1:7000"
console.log: "http://127.0.0.1:1234"
console.log: "http://127.0.0.1:1234"
console.log: "http://127.0.0.1:1234"
console.log: "http://127.0.0.1:1234"
console.log: "http://127.0.0.1:1234"
console.log: "http://127.0.0.1:1234"
console.log: "http://127.0.0.1:1234"
- rr log (rr_log.txt)
rr record ~/firefox/firefox-91.0b9/firefox --headless http://127.0.0.1:7000/poc.html
rr -M replay -a | tee rr_log.txt
[rr 27391 1683]*** You are running in headless mode.
[rr 27391 4310][GFX1-]: glxtest: Unable to open a connection to the X server
[rr 27391 4314][GFX1-]: glxtest: libEGL initialize failed
[rr 27391 17889][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
[rr 27524 26611]console.log: "http://127.0.0.1:7000"
[rr 27524 28826]console.log: "http://127.0.0.1:7000"
[rr 27524 30135]console.log: "http://127.0.0.1:7000"
[rr 27524 32311]console.log: "http://127.0.0.1:7000"
[rr 27524 32989]console.log: "http://127.0.0.1:7000"
[rr 27524 35930]console.log: "http://127.0.0.1:1234"
[rr 27524 36783]console.log: "http://127.0.0.1:1234"
[rr 27524 37772]console.log: "http://127.0.0.1:1234"
[rr 27524 38782]console.log: "http://127.0.0.1:1234"
[rr 27524 39478]console.log: "http://127.0.0.1:1234"
[rr 27524 40252]console.log: "http://127.0.0.1:1234"
[rr 27524 40887]console.log: "http://127.0.0.1:1234"
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 a flaw in how Firefox handles writes to properties of the window proxy object, allowing a page to alter its own origin's port.
What the attacker needed
Victim visits a malicious page; Firefox browser
How it was found
- Host a proof-of-concept page on a local web server.
- Run Firefox in headless mode pointing at that page.
- Observe the console output showing location.origin changing from the original port to a new port.
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.
Websites are normally kept separate by the browser using the 'same-origin policy', which stops one site from reading another's data. This report shows a bug where a page can trick the browser into thinking it is on a different address (by changing the port number), which could let it break that separation. The author demonstrates this by printing the page's origin before and after the change.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.