Firefox Local Files Theft - CVE-2019-11730
Firefox implements a directory-based Same Origin Policy for file:// URIs, so a malicious HTML file opened locally can read other files in its containing folder. By using clickjacking to switch context to the directory listing, an attacker can steal files such as SSH private keys.
quitten.github.io
Published on quitten.github.io
Recently, I was performing a research on Same Origin Policy attacks, I managed to realize that the la version of Firefox (currently 67) is vulnerable to local files theft attack (on any supported OS), due to improper implementation of Same Origin Policy for file scheme URIs. Let’s go over the PoC details then I will…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Firefox grants directory-based same-origin privileges to file:// URIs, allowing a file to read other files in its folder, and also permits fetch requests to file:// URLs.
Impact
An attacker could steal any file in the folder containing the malicious file, including SSH private keys, by tricking the victim into opening the file and clicking once.
What the attacker needed
Victim downloads and opens a malicious HTML file; victim clicks once on the page; Firefox browser
The fix
The report suggests that the RFC should enforce a more secure file-based Same Origin Policy and that Firefox should not allow fetch requests to file:// URLs, but no fix is mentioned as applied.
How it was found
- Attacker sends a malicious HTML file to the victim, who downloads and opens it.
- The malicious file loads its containing folder in an iframe.
- The victim is tricked via clickjacking into clicking a file in the iframe's directory listing, switching context.
- The iframe gains escalated privileges and can read files in the folder.
- The malicious file fetches sensitive files, such as SSH private keys, and sends them to the attacker.
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 write-up has not been written yet. The Original tab links to the source.
When you open a local HTML file in Firefox, the browser treats all files in the same folder as belonging to the same origin. This means a malicious file can read other files in that folder, like your SSH keys, and send them to an attacker. Other browsers prevent this by not allowing local files to fetch other local files.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.