Saving as "webpage complete" allows the download of cross-origin resources with arbitrary extensions under certain conditions
When a user saves a page as 'Webpage, complete', Firefox downloads cross-origin resources with attacker-controlled filenames and extensions. An attacker can then use CSS-based exfiltration techniques to read data from cross-origin sites, provided the target site allows control over the filename/extension and permits null bytes in responses.
Originally disclosed on Mozilla
- Fixed in 2.3 years
- Paid in 2.3 years
- Disclosed after 2.3 years
Created attachment 9298917
repro.mkv
An attacker can craft a page that when saved by a user will end up dropping a cross-origin website in the user's disk with an arbitrary extension.
An attacker then can exfiltrate data from cross-origin websites by abusing the techniques described on https://bugs.chromium.org/p/chromium/issues/detail?id=788936 and https://bugs.chromium.org/p/chromium/issues/detail?id=848123.
The conditions for the CSS exfiltration technique used in this attack are:
1. You must be able to control the filename/extension of the targeted site.
2. You must be able to insert null bytes into the response of the targeted site.
For [1], that usually happens in websites that allow you to create usernames containing dots, so you could create a user named "poc.css" (https://example.com/account/poc.css), for example. Also, many websites allow http://example.com/index.php to be loaded as http://example.org/index.php/poc.css
As for [2], I am not aware of many sites that actively filter out null bytes from user input.
In fact, this attack can even be performed on Monorail, which is Chromium's issue tracker (https://bugs.chromium.org/u/3293457725/hotlists/poc.css).
In the PoC, the information of five public bugs are going to be exfiltrated, but in an actual attack, a hotlist could be prepared to contain all the private issues in Monorail.
I have also attached a video reproducing the attack.
VERSION
Version: 105.0 (64-bit).
Operating System: Ubuntu 20.04
REPRODUCTION CASE
1. Open https://lbherrera.github.io/lab/firefox/save-51279807/index.html
2. Press Ctrl+S and select "Webpage, complete" if it is not already selected.
3. Save the page and open the HTML file that was downloaded.
4. The exfiltrated information should be displayed on the page.
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
Impact
An attacker could exfiltrate data from cross-origin websites, but only if the targeted site meets two specific conditions: the attacker can control the filename/extension and can insert null bytes into the response.
What the attacker needed
Victim saves page as 'Webpage, complete'; target site allows filename/extension control; target site allows null bytes in responses
How it was found
- Open the provided proof-of-concept page.
- Press Ctrl+S and select 'Webpage, complete' if not already selected.
- Save the page and open the downloaded HTML file.
- The exfiltrated information should be displayed on 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.
When you save a webpage for offline use, your browser downloads all the files that page needs, like images and stylesheets. This report shows that an attacker can make the browser save files from other websites with names and extensions the attacker chooses. That can let the attacker steal information from those other sites using a trick that reads data through CSS, a language for styling web pages.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.