Bypass privileged internal: URL protetion through referrer
The secret key protecting privileged internal:// URLs was leaked through the Referer header when a user loaded the original page from ReaderView. An attacker could use this key to exploit an existing XSS bug in about/sessionrestore and access cross-origin web content.
Originally disclosed on Mozilla
- Fixed in 23 months
- Paid in 23 months
- Disclosed after 23 months
Created attachment 9165250
Demonstrate uuidkey stealing attack
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.2 Safari/605.1.15
Steps to reproduce:
In Bug 1263627, secret key based privileged URLs protection was implemented for internal:// schemes.
If protection is bypassed, untrusted web content can still abuse a XSS bug in about/sessionrestore (Bug 1258188) and also still can get any cross origin web contents (Bug 1279787).
The bypass technique I found is below.
(1) Open Safari and visit http://csrf.jp/2020/uuidkey_stealer_entry.html
(2) Tap a firefox:// link in the page to launch exploit in ReaderView on Firefox for iOS.
Note that this step is not mandatory, just a shortcut for easier reproduction.
(3) ReaderView frame is shown in Firefox for iOS, and wait for few seconds
(4) Tap "Load original page" in ReaderView
(5) Exploitation code at http://csrf.jp/2020/uuidkey_stealer.php is shown.
Then secret key (uuidkey) is leaked through REFERER header
(6) Tap "Exploit Link", alert() by XSS is shown in internal://local (see attached video for demonstration)
Actual results:
As explaind at (5), secret key (uuidkey) is leaked to web page through REFERER header.
By using the key, untrusted web contents can abuse existing XSS bug on sessionrestore (Bug 1258188).
Expected results:
Set <meta name="referrer" content="never"> in ReaderViewLoading.html .
https://github.com/mozilla-mobile/firefox-ios/blob/76faae8c6c94e22c8fbc0de72e2d06f615738e2c/Client/Frontend/Reader/ReaderViewLoading.html#L7
That can stop the REFERER leakage.
The other HTML template `Reader.html` already has the same protection. Do the same thing.
https://github.com/mozilla-mobile/firefox-ios/blob/76faae8c6c94e22c8fbc0de72e2d06f615738e2c/Client/Frontend/Reader/Reader.html#L10
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 ReaderViewLoading.html template did not set a referrer policy, so the secret key in the URL was included in the Referer header sent to the web page.
Impact
The leaked key could allow untrusted web content to abuse an existing XSS bug in about/sessionrestore and access cross-origin web content.
What the attacker needed
Firefox for iOS; victim visits attacker page; victim taps a link to open ReaderView; victim taps 'Load original page'
How it was found
- Open Safari and visit the attacker's entry page.
- Tap a firefox:// link to launch the exploit in ReaderView on Firefox for iOS.
- Wait for the ReaderView frame to appear.
- Tap 'Load original page' in ReaderView.
- The exploitation code runs and the secret key is leaked through the Referer header.
- Tap 'Exploit Link' to trigger an alert via XSS in internal://local.
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.
Firefox for iOS uses a secret key to protect special internal pages. When you use ReaderView and tap 'Load original page', the secret key was sent to the website in the Referer header, which tells the site where you came from. A malicious site could read that key and use it to run harmful code on those internal pages.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.