Reflected DOM-based XSS without CSP bypass in FxA Content Server via handleOauthResponse method in ThirdPartyAuthMixin
Categories
(Cloud Services :: Server: Firefox Accounts, task)
Tracking
(Not tracked)
People
(Reporter: 40826d, Unassigned)
References
()
Details
(4 keywords, Whiteboard: [reporter-external] [web-bounty-form] [verif?])
Attachments
(1 file)
|
760.44 KB,
image/png
|
Details |
Summary
The Firefox Accounts Content Server is susceptible to reflected DOM-based XSS attacks by way of the ThirdPartyAuthMixin wherein the state parameter can be used to load arbitrary JavaScript URLs.
When invoked as a GET with state and provider parameters, the /post_verify/third_party_auth/callback route hits the ThirdPartyAuthCallback class which calls handleOauthResponse() in ThirdPartyAuthMixin.
handleOauthResponse() sets window.location.href to the value of state using the navigateAway() method.
The FxA middleware enforces a strong CSP making JavaScript execution on https://accounts.firefox.com or https://accounts.stage.mozaws.net generally infeasible, however I wanted to bring this to the team's attention as FxA is considered critical in the Web Bug Bounty Program.
### Environment
- Firefox 105.0.1 (64-bit), Firefox Developer Edition 106.0b6 (64-bit) with CSP disabled
### Steps to Reproduce
-
Browse to
https://accounts.firefox.com/post_verify/third_party_auth/callback?provider=google&state=javascript:alert(document.domain) -
Open DevTools and observe the CSP error (unless you disabled CSP using a WebExtension or intercept proxy, in which case you will observe an alert dialog with the value of
document.domain):Refused to run the JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self' https://accounts-static.cdn.mozilla.net". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present.
Impact
An attacker can execute arbitrary JavaScript in the context of another user on https://accounts.firefox.com to exfiltrate PII and perform actions as that user provided that CSP is unsupported or disabled in the user's browser.
| Reporter | ||
Comment 1•4 years ago
|
||
| Reporter | ||
Comment 2•4 years ago
|
||
(I just figured out that the inner H3 headings weren't parsed to Markdown because of a couple non-breaking spaces that snuck in. If it's possible to edit the description to fix this, or if you have any questions about the bug, please let me know!)
Updated•4 years ago
|
Comment 3•4 years ago
|
||
Hello,
Thank you for your excellent report.
I can see the CSP violation when I go to https://accounts.firefox.com/post_verify/third_party_auth/callback?provider=google&state=javascript:alert(document.domain).
I'll ask the FxA team to take a look.
Thanks,
Frida
Comment 4•4 years ago
|
||
Hello Wil,
Can you please take a look at this report? The CSP blocks the XSS but it would be better if we fix the root cause of this issue.
Thanks,
Frida
Comment 5•4 years ago
|
||
Thanks for filing this @40826d. I'll get it on the roadmap
| Reporter | ||
Comment 6•4 years ago
|
||
Hi Frida and Wil, appreciate the fast response and thanks for looking into this! Please let me know if you require any additional info from my end.
Updated•4 years ago
|
Comment 7•4 years ago
|
||
A fix for this bug was deployed to production last Wednesday, 2022-10-19.
The pull request of the fix is at https://github.com/mozilla/fxa/pull/14289.
Thank you for reporting this bug, viridian.
Comment 8•4 years ago
|
||
An xss-blocked-by-CSP is a relatively minor problem, but still earns a bounty in a critical site.
| Reporter | ||
Comment 9•4 years ago
|
||
Thanks all for the fix and bounty on this one.
Updated•4 years ago
|
| Reporter | ||
Updated•4 years ago
|
Updated•2 years ago
|
Updated•1 year ago
|
Description
•