Skip to main content

Posts

Native applications with OAuth 2

By Justin Richer and Antonio Sanso  This article was excerpted from the book OAuth 2 in Action . The OAuth core specification specifies four different grant types: Authorization Code , Implicit , Resource Owner Password Credentials and Client Credentials . Each grant type is designed with different security and deployment aspects in mind and should be used accordingly.  For example, the Implicit grant flow is to be used by OAuth clients where the client code executes within the user agent environment. Such clients are generally JavaScript-only applications, which have, of course, limited capability of hiding the client_secret in client-side code running in the browser. At the other side of the spectrum there are classic server-side applications that can use the authorization code grant type and can safely store the client_secret somewhere in the server. What about native applications then?  Native applications are those that run directly on the end user’s...

Holy redirect_uri Batman!

If you bought the book I have been writing with Justin Richer namely OAuth 2 in Action you might have noticed that we will never got tired to stress out how much important the redirect_uri is in the OAuth 2 universe. Failing to understand this (rather simple) concept might  lead to disasters. The redirect_uri is really central in the two most common OAuth flows ( authorization code and implicit grant ). I have blogged about redirect_uri related vulnerability several times and both in OAuth client and OAuth server context.  Developing an OAuth client is notoriously easier to develop compare to the server counter part. Said that the OAuth client implementer should still take care and master some concepts.  If I would be limited to give a single warning for OAuth client implementer this would be  If you are building an OAuth client,   Thou shall register a redirect_uri as much as specific as you can or simply less formally " The registe...

Google Chrome Potential leak of sensitive information to malicious extensions (CVE-2016-1658)

Last Google Chrome release for Chrome 50.0.2661.75 contains the fix for a security low bug I found (CVE-2016-1658). When first I found this bug I was under the impression it could be an UXSS. Quickly after I reported I started to realize that this wasn't as exploitable though. The issue per se was extremely easy to reproduce: Create an HTML file that looks like and save it (e.g. chrome.html) <h1>Hi</h1>  <script> alert(document.domain)</script> Now supposing the file is saved under (in MacOS) /Users/xxx/Downloads/chrome.html open the file from hard disk in this way:   file://mail.google.com/Users/xxx/Downloads/chrome.html   Note: mail.google.com is arbitrary . This can be any domain (hence is universal)  Observe the document.domain alerted is mail.google.com!  Observe the cookies transported are the one associated with *.google.com domain : Now this looked really weird to me and I reported as an...

OpenSSL Key Recovery Attack on DH small subgroups (CVE-2016-0701)

Usual Mandatory Disclaimer: IANAC (I am not a cryptographer) so I might likely end up writing a bunch of mistakes in this blog post... tl;dr The OpenSSL 1.0.2 releases suffer from a Key Recovery Attack on DH small subgroups . This issue got assigned CVE-2016-0701 with a severity of High and OpenSSL 1.0.2 users should upgrade to 1.0.2f. If an application is using DH configured with parameters based on primes that are not "safe" or not Lim-Lee (as the one in RFC 5114 ) and either Static DH ciphersuites are used or DHE ciphersuites with the default OpenSSL configuration (in particular SSL_OP_SINGLE_DH_USE is not set) then is vulnerable to this attack.  It is believed that many popular applications (e.g. Apache mod_ssl) do set the  SSL_OP_SINGLE_DH_USE option and would therefore not be at risk (for DHE ciphersuites), they still might be for Static DH ciphersuites. Introduction So if you are still here it means you wanna know more. And here is the thing. In my last bl...

What the heck is RFC 5114?

Mandatory Disclaimer: I ANAC (I am not a cryptographer) so I might likely end up writing a bunch of mistakes in this blog post... I already talked about Diffie–Hellman (DH from now on) in TLS in my previous post: Small subgroup attack in Mozilla NSS . As mentioned FWIW I strongly agree with Google Chrome decision to deprecate DHE . The reason is mainly due to the Weak Diffie-Hellman attack and related paper . If you are interested in this topic there is a really nice presentation about it at 32C3 . This shows a really nice potential attack that anyone with enough computational power (let's say NSA) can perform against DHE 1024 bits (details in the paper). Said that for some reason I have been looking at DHE for a while now and one day I hit RFC 5114 . Now what the heck is this specification about :S ? I found only few references about it. One funny one from here says (emphasis mine): There is a semi-mysterious RFC 5114 – Additional Diffie-Hellman Groups docu...

Small subgroup attack in Mozilla NSS

tl;dr While the TLS servers attacks has been pretty much studied and fixed (see e.g. https://www.secure-resumption.com/ and https://weakdh.org/ ) the situation with the TLS clients is (was) not ideal and can be improved. Here I report a Small subgroup attack for TLS clients that I performed against various browsers and reported. Whoever reads this blog is used to read about OAuth . For once (and maybe more in the future) let's hijack the usual topic and let's talk about my new "passion" : TLS in particular Diffie–Hellman (DH from now on). Now, before to start I need to clarify one thing IANAC (I am not a cryptographer) so I might likely end up writing a bunch of mistakes in this blog post... Diffie-Hellman is used in SSL/TLS, as "ephemeral Diffie-Hellman" (EDH) and it is probably going to be kill soonish (or at least is the intent of Google Chrome ). FWIW I personally agree with this unless EDH implements the Negotiated Finite Field specification ...

Top 10 OAuth 2 Implementation Vulnerabilities

Some time ago I posted a blogpost abut  Top 5 OAuth 2 Implementation Vulnerabilities . This week I have extended the list while presenting Top X OAuth 2 Hacks at OWASP Switzerland. This blog post (like the presentation) is just a collection of interesting attack OAuth related. #10 The Postman Always Rings Twice  I have introduced this 'attack' in last year post . This is for provider implementer , it is not extremely severe but, hey, is better to follow the spec. Specifically The client MUST NOT use the authorization code  more than once.  If an authorization code is used more than once, the authorization server MUST deny the request and SHOULD revoke (when possible) all tokens previously issued based on that authorization code. It turned out that even Facebook and Google did it wrong ... :) #9 Match Point To all OAuth Providers be sure to follow section 4.1.3 of the spec in particular ...if the "redirect_uri" parameter was included in the...