Closed Bug 1793326 Opened 4 years ago Closed 4 years ago

Reflected DOM-based XSS without CSP bypass in FxA Content Server via handleOauthResponse method in ThirdPartyAuthMixin

Categories

(Cloud Services :: Server: Firefox Accounts, task)

task

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: 40826d, Unassigned)

References

()

Details

(4 keywords, Whiteboard: [reporter-external] [web-bounty-form] [verif?])

Attachments

(1 file)

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

  1. Browse to https://accounts.firefox.com/post_verify/third_party_auth/callback?provider=google&state=javascript:alert(document.domain)

  2. 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.

Flags: sec-bounty?

(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!)

Component: Other → Server: Firefox Accounts
Product: Websites → Cloud Services

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

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

Flags: needinfo?(wclouser)

Thanks for filing this @40826d. I'll get it on the roadmap

Flags: needinfo?(wclouser)

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.

Status: UNCONFIRMED → NEW
Ever confirmed: true

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.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED

An xss-blocked-by-CSP is a relatively minor problem, but still earns a bounty in a critical site.

Flags: sec-bounty? → sec-bounty+
Keywords: sec-low, wsec-xss

Thanks all for the fix and bounty on this one.

Group: websites-security
Summary: Reflected DOM-based XSS in FxA Content Server via handleOauthResponse method in ThirdPartyAuthMixin → Reflected DOM-based XSS without CSP bypass in FxA Content Server via handleOauthResponse method in ThirdPartyAuthMixin
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: