JavaScript injection on FxA domain through firefox://?fxa scheme
The Firefox for iOS app did not properly escape the 'email' and 'access_code' URL parameters when constructing JavaScript code for the Firefox Accounts login page. An attacker could inject arbitrary JavaScript into the login page by crafting a malicious firefox:// URL.
Originally disclosed on Mozilla
- Fixed in 41 days
- Paid in 6 days
- Disclosed after 41 days
Created attachment 8823358
Screenshot when the bug was reproduced
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12
Steps to reproduce:
Open following URL with the latest Firefox for iOS.
firefox://?fxa=signin&email=[address removed]');$('.email').val('JAVASCRIPT_INJECTED!!&access_code=12345
The above PoC can be tried from following link as well.
http://mallory.csrf.jp/ios/fxa.html
Actual results:
JavaScript code "$('.email').val('JAVASCRIPT_INJECTED!!')" is injected to Firefox Accounts login page through webView.evaluateJavaScript.
This bug has been introduced by Bug 1317580.
In the following commit, URL query parameter 'email' and 'access_code' are not properly escaped and finally it's used for constructing JavaScript code.
https://github.com/mozilla-mobile/firefox-ios/pull/2249/files#diff-7c8dce404b977a471215d06058caec4aR127
Expected results:
The format of 'email' and 'access_code' should be validated before constructing JavaScript code.
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 Firefox Accounts login page, potentially leading to theft of credentials or other malicious actions.
What the attacker needed
Victim opens a malicious link; Firefox for iOS installed
The fix
The format of the 'email' and 'access_code' parameters should be validated before constructing JavaScript code.
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 open a special link in Firefox for iOS, the app takes some parts of the link and puts them into a script that runs on the login page. Because it didn't clean these parts, someone could put their own script code in the link. Then, when you open the link, that script runs on the login page, which could let an attacker do things like steal your login details.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.