Skip to content
OAuth / SSO Disclosed report CVE-2012-1963

Content Security Policy: violation reports leak OAuth 2.0 and OpenID credentials

Karthikeyan Bhargavan Follow

Originally disclosed on Mozilla

  • Fixed in 16 days
  • Paid in 7 months
  • Disclosed after 16 days
Text
The Content Security Policy (CSP) violation reports generated by Firefox include sensitive data within the "blocked-uri" parameter. In particular, they include fragment components and query strings even if the blocked-uri has a different origin than the protected resource (violating CSP 1.1 recommendations). Hence, a malicious website may use Firefox's CSP implementation to steal a user's OAuth 2.0 access tokens and OpenID credentials. This leads to serious attacks on popular social authorization servers such as Facebook and Google.

For example, suppose a Yahoo user has previously used "Sign in with Facebook" to log in to Yahoo. 
Suppose also that the user is currently logged in to Facebook (she does not have to be logged in to Yahoo.) 
If she then visits attacker.com, this website can redirect her to Facebook's OAuth 2.0 endpoint, requesting an access token for the current user at Yahoo.
Facebook issues a token and forwards the user to open.login.yahoo.com/#access_token=AAAXXX
The key security mechanism of OAuth 2.0 is that this access token will only be sent to Yahoo, so even if the original token request was sent by an attacker, he will not be able to obtain the access token.

Now, suppose attacker.com had a CSP that forbid connections to open.login.yahoo.com.
Then Firefox will send a CSP violation report to "report-uri" that contains as its "blocked-uri" the full URL open.login.yahoo.com/#access_token=AAAXXX
Hence, the attacker obtains the user's Facebook access token at Yahoo and may download sensitive user information from the Facebook API.
For comparison, Chrome sends a "blocked-uri" that contains only the domain open.login.yahoo.com, avoiding the attack.

A similar attack works for the Facebook OAuth 2.0 authorization code flow, allowing the attacker to steal the auth code and potentially log in as the user on Yahoo.

A similar attack works on the Google OpenID interaction, where the attacker obtains the user's name and email address from Google and also a signed OpenID response that the attacker may potentially use to log in as the user to Yahoo.

Demo:
----

As a proof of concept, we have built an attack webpage that silently retrieves (and stores) any visitor's names and email addresses from Facebook and Google.
The preconditions for this demonstration: the visitor must be logged into Facebook or Google (in the same browser) and must have previously authorized Yahoo to access his Facebook or Google profile (by using Sign in with Facebook for example).
The demo is at http://moscova.inria.fr/~karthik/csp/index.html

Causes and Fixes:
-----------------

The attack shown here was predicted (for a fictionalized version of OAuth) by Adam Barth in http://lists.w3.org/Archives/Public/public-web-security/2011Apr/0055.html
Our demo shows that it is an effective attack on real OAuth and OpenID users,
such as those using the Google, Facebook, Live, LinkedIn, and Dropbox APIs.

The root issue is that Firefox does not implement the recommendations of CSP 1.1 on violation reports (section 4.15). Implementing them would disable the attack above. 

Specifically, Firefox must remove the <fragment> component from the blocked URI. This would prevent Facebook access tokens from being leaked.

Since "the origin of the blocked-uri is not the same as the origin of the protected resource", Firefox should also removes the query string. This would prevent the Google OpenID identifiers from being leaked.

About Us:
--------
I lead a security research group called Prosecco at INRIA in France.
http://prosecco.gforge.inria.fr
Our work focuses on formal security proofs for cryptographic and web applications. We found this attack as part of a formal study of OAuth
http://www.doc.ic.ac.uk/~maffeis/csf12.pdf
We would welcome the opportunity to study any fixes you may propose and incorporate them into our analyses.

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

What is known

A high-severity OAuth / SSO bug in Security. Mozilla made it public on 10 July 2012 as CVE-2012-1963.

About OAuth / SSO

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is OAuth / SSO?

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.