Private files are allowed to be uploaded (exfiltration)
A missing path validation in Firefox for Android's handling of file URIs from file pickers allows a malicious picker app to return a URI pointing to Firefox's private files, which are then uploaded to a webpage. An attacker could steal private information such as cookies.
Originally disclosed on Mozilla
- Fixed in 4 days
- Paid in 16 days
- Disclosed after 4 days
Summary
A missing path validation in the way Firefox deals with Uris from File Pickers allows private files to be uploaded.
Environment
- Device: HTC m8
- OS version: Android 9
- Package name: org.mozilla.firefox
- App version: 68.10.1
Proof of concept
Pre-conditions:
- PoC installed
- Firefox installed
- Python3 installed
- ngrok (optional for easy tunneling)
Steps:
-
Start
server.py$ python3 server.py -
Open server in Firefox
-
Tap to upload
-
Choose a Files > Mozilla Internal
-
Tap "Upload Image"
Result
Private file is uploaded and displayed in the webpage
Expected result
Private files shouldn't be allowed to be uploaded.
Detailed explanation
This vulnerability is similar to https://bugs.chromium.org/p/chromium/issues/detail?id=859349
When the malicious picker is chosen, the following URI is returned to Firefox:
file:///data/data/org.mozilla.firefox/shared_prefs/GeckoApp.xml
Because there is no validation in file:// URIs, it's possible to upload private files to malicious webpages.
This requires a malicious app installed but a file picker can deploy a targeted attack by checking if Firefox was the one triggering the pick request.
This vulnerability not only affects file:// URIs but content:// URIs too through _data column (which contains the path to the file). This means a malicious picker can return a content URI and Firefox will upload the file which is pointed by _data column.
Vulnerable code
// Some file pickers may return a file uri
if ("file".equals(uri.getScheme())) {
String path = uri.getPath();
sendResult(path == null ? "" : path);
return;
}
Remediation
- Firefox should canonical paths checks to see if the file being uploaded belongs to the internal directory or not.
Attachments
- PoC.zip - Source code of the PoC app used
- poc.apk - Compiled binary of the PoC
- video.mp4 - Screencap showing the exploit in action
- server.py - A simple upload server that prints the uploaded content
Impact
This allows a malicious file picker to trick the user into uploading files to a malicious webpage and steal private information such as cookies.
This also allows private file's exfiltration, which is essentially a backup feature without encryption. All internal files are affected by this vulnerability.
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
A malicious file picker could trick the user into uploading private files, such as cookies, to a malicious webpage, leading to exfiltration of internal files.
What the attacker needed
Malicious file picker app installed; user chooses the malicious picker
The fix
Firefox should add canonical path checks to ensure uploaded files do not belong to its internal directory.
How it was found
- Start the upload server.
- Open the server in Firefox.
- Tap to upload.
- Choose a Files > Mozilla Internal.
- Tap 'Upload Image'.
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 pick a file to upload in Firefox, the app trusts the file picker to give a safe file location. A malicious file picker app can instead give a location inside Firefox's own private storage, so Firefox uploads its own secret files to a website. This lets an attacker steal things like cookies.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.