HTML injection in %READER-BYLINE% of ReaderMode of Firefox for iOS
The ReaderMode template in Firefox for iOS replaced a previously fixed placeholder with a new one that lacks HTML escaping, allowing HTML injection via a page's meta author tag. An attacker could inject HTML, and by chaining with another bug, achieve XSS on an internal page.
Originally disclosed on Mozilla
- Fixed in 14 days
- Paid in 19 days
- Disclosed after 14 days
Created attachment 9360426
demonstration-on-bitbucket.mov
The following commit replaced %READER-CREDITS% to %READER-BYLINE% in the ReaderMode template of Firefox for iOS.
https://github.com/mozilla-mobile/firefox-ios/commit/3c6ea106b139ae581b6bb6da86f31a1fe53fcb49#diff-953c74716db0300bf5fd5751de34b1ab0674deb75cacdd8ecae8ae7ba700da98R18
Previously, %READER-CREDITS% was prone to HTML injection attack but it was fixed on Bug 1653822 by escaping HTML tags in author name as follows.
https://github.com/mozilla-mobile/firefox-ios/blob/main/Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentStart/ReaderMode.js#L81
But the fix is not applied to %READER-BYLINE%, so HTML injection in ReaderMode is possible again through <meta [author]> tag in the original page.
The following URL is a demonstration of this bug on Atlassian BitBucket.
By abusing privilege escalation bug reported by Bug 1861405, XSS on internal://local through the bug can be achieved.
https://bitbucket.org/muneaki_nishimura/author/issues/1/test
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
The new %READER-BYLINE% placeholder was not given the same HTML-escaping treatment that was previously applied to %READER-CREDITS%.
Impact
An attacker could inject HTML into Reader Mode, and by chaining with a separate privilege escalation bug, achieve XSS on an internal page.
What the attacker needed
Victim opens a crafted page in Reader Mode; attacker controls meta author tag; separate privilege escalation bug for full XSS
The fix
The fix should apply the same HTML escaping to the author name used in %READER-BYLINE% as was done for %READER-CREDITS%.
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.
When Firefox shows a page in Reader Mode, it inserts the author's name into a template. The code that inserts the name does not clean it first, so if a page sets a special author tag containing HTML, that HTML gets inserted into the page. This lets an attacker run code in the browser, especially if combined with another flaw.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.