Skip to content
XSS Disclosed report Intermediate CVE-2020-12404

XSS from booby-trapped link on Firefox iOS Download Link Action

A download link action in Firefox iOS inserted an unescaped URL into a JavaScript call, allowing an attacker to inject code. An attacker could craft a link that, when the victim used the download option, executed script in the context of the current page's domain.

Vinoth Kumar Follow

Originally disclosed on Mozilla

  • Fixed in 8 hours
  • Paid in 48 days
  • Disclosed after 8 hours
Text
Created attachment 9142011
firefox-ios.html

Firefox Version: v24.1
OS: iOS 13.3.1

Issue: Universal XSS on Firefox iOS Download link Action

Description:

Firefox iOS user clicks download link in hyperlink option and XSS is triggered on current url, When the hyperlink is in format https://anydomain/','123');alert(document.domain);//

Sample attack scenerio 
* Attacker links https://attacker.com/','123');alert( in google.com index
* Victim click's download link on firefox iOS
* XSS is executed on victim's google.com domain

Steps to reproduce:

1. Open https://vinothkumar.tech/firefox-ios your iOS firefox browser.
2. Hold the link until preview popup appears.
3. Click Download Link
4. XSS is triggered

Root Cause: 
https://github.com/mozilla-mobile/firefox-ios/blob/v24.1/Client/Frontend/Browser/BrowserViewController/BrowserViewController+WebViewDelegates.swift#L171

Unescaped url link is being appeneded to the javascript when download action clicked
'''
currentTab.webView?.evaluateJavaScript("window.__firefox__.download('\(url.absoluteString)', '\(UserScriptManager.securityToken)')")
'''

Fix:
'''
let safeUrl = url.absoluteString.replacingOccurrences(of: "'", with: "%27")
currentTab.webView?.evaluateJavaScript("window.__firefox__.download('\(safeUrl)', '\(UserScriptManager.securityToken)')")
'''

Youtube Unlisted Video: https://youtu.be/zkVVolyCrt0

POC:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Firefox Universal Download Link XSS POC</title>
</head>
<body>
    <a href="http://vinothsparrow.herokuapp.com/','123');alert(document.domain);//">Download Link in Firefox</a><br><br>
</body>
</html>

The original report as published on Mozilla's Bugzilla, by Vinoth Kumar. 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

Impact

An attacker could execute arbitrary JavaScript in the context of the victim's current domain, potentially leading to universal XSS on any site the victim visits.

What the attacker needed

Firefox iOS app; victim long-presses a crafted link; victim taps Download Link

The fix

The URL should be sanitised by replacing single quotes with their percent-encoded form before being inserted into the JavaScript call.

How it was found

  1. Open the attacker's page in Firefox on iOS.
  2. Long-press the link until the preview popup appears.
  3. Tap 'Download Link'.
  4. The injected script runs in the context of the current 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 tap and hold a link in Firefox on iOS, a menu appears with a 'Download Link' option. The app took the link's address and pasted it directly into a small piece of JavaScript code without cleaning it first. By putting special characters in the link, an attacker could make that JavaScript run their own code on whatever website the victim was viewing.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by Vinoth Kumar

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.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.