Closed Bug 1328325 Opened 9 years ago Closed 9 years ago

JavaScript injection on FxA domain through firefox://?fxa scheme

Categories

(Firefox for iOS :: Firefox Accounts, defect)

Other
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
fxios 6.0+ ---

People

(Reporter: sdna.muneaki.nishimura, Assigned: vbudhram)

Details

(5 keywords)

Attachments

(1 file)

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=test@example.jp');$('.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.
Flags: sec-bounty?
Web-accessible protocol handlers that are actually commands are terrible from a security POV. Do we want every page to be able to launch these? That's a separate question from the current issue of having an XSS into the FxA context when doing so.
Assignee: nobody → vbudhram
This sounds bad. I know we're supposed to be done with 6.0, but we should consider blocking release for this. Hopefully something we can address quickly?
Flags: needinfo?(sleroux)
Flags: sec-bounty? → sec-bounty+
Oops, looks like Farhan was actually the reviewer.
Flags: needinfo?(sleroux) → needinfo?(fpatel)
Hey guys, I was the writer of the PR and this was an oversight on my part. Email validation is done on the server and that was why I choose to not include it in FxiOS. Any objections for putting up a PR that validates emails and access codes before injecting?
Flags: needinfo?(sleroux)
> Any objections for putting up a PR that validates emails and access codes before injecting? Nope - feel free to put up a PR and we can discuss the implementation there. As for using that patch as a resolution to this bug, since we were aiming to release 6.0 today and that would involve code changes + review, it might be best to resolve this with the Javascript escaping (if it's easy/trivial) or downlift the feature and push it to 7.0.
Flags: needinfo?(sleroux)
I think at this stage it's probably best to back out/disable this feature until we can address this.
Flags: needinfo?(fpatel)
(In reply to Farhan Patel from comment #6) > I think at this stage it's probably best to back out/disable this feature > until we can address this. I agree. Lets put it behind a feature flag and do a rapid 6.1 release in which we can address this and a few other issues.
Added feature flag patch to original feature bug https://bugzilla.mozilla.org/show_bug.cgi?id=1317580
When 6.1 is shipped and this is resolved as behind a pref, please resolve *this* bug (in our sec-critical queue) as "fixed."
Flags: needinfo?(vbudhram)
Followed up with :sleroux and this was shipped in 6.0 and not 6.1. It is behind the pref. Marking as fixed.
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: needinfo?(vbudhram)
Resolution: --- → FIXED
Group: firefox-core-security → core-security-release
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: