Skip to main content

OAuth 2 attacks - Introducing 'The Devil Wears Prada' and 'Lassie Come Home'

As the OAuth 2 framework is becoming more and more used I thought it would be useful to share some of the most common attacks. It is important to highlight that the attacks I am going to introduce today are not issues in the specification per se but rather possible implementation issues. The first document to look at when you try to secure one OAuth 2 implementation is the OAuth 2.0 Threat Model but this is way not enough. In order to have a safe implementation it is important to understand what is OAuth about and to be involved in the "OAuthsphere" (OAuth mailing list, blogs, etc),

In this blog post I will try to show two of the most common attacks that I have renamed  'The Devil Wears Prada' and 'Lassie Come Home'.

Let's see. Firstly the actors:

The Actors

The Devil Wears Prada

The first time I read about this potential issue was in one of John Bradley's blog post . This issue is also known as "confused deputy problem". In a nutshell (once again) OAuth is NOT an authentication protocol. It is an access delegation protocol. It is/can-be-used as an authentication protocol but only and only if you know what you are doing! Let's see what it could happen if you are using the OAuth Implicit Grant flow (aka Client side) . Firstly here a quick reminder of the Client side flow:


In the above example, Alice (the resource owner, RO from now) allows Bob  from www.printondemand,biz (the client)  to access the profile pictures from her Facebook (the server) account in order to have a nice photo album. So far so good, right? (Yes :)) Now let see what could happen if www.printondemand,biz would use the profile information of Alice to authenticate her:

The are at least two things to be noticed from the flow above:
  • uses the profile information from Facebook to log in
  • does not have any security. Indeed they have not Authenticated the User! (at all...)
What does this tell us? That authenticates, given an Access Token.

Now let's see how we can use this information to "our" (from the attacker point of view) advantage.
Let's assume there is yet another client ( This client uses legitimately the profile information from Alice to do something that Alice authorized for (e.g. keeping historical profile information). Now when Alice gives the Access Token to the latter does exactly what Alice expects it to do. The problem is that he does as well something more, behind the back of Alice. Here's the flow:

So, referring to the image above, after point 6, Alice got from what he requested. At this point Alice is out of the game. owns an Access Token from Alice though. What can do is to give this Access Token to And which one is the outcome? You have guessed it, right? How nice :) just authenticated as Alice!!!!
To be noticed that this attack came from something that the RO kind of trusted, hence I named it  "The Devil Wears Prada".

At this point you might wonder which one is the mitigation for this attack. There are several but the best that comes in my mind is to use OpenId Connect for authentication.

 Lassie Come Home

Ready for another one?  This attack is a generalization of on attack done some time ago against Facebook. Now let see an example:

The famous offers the possibility to register your own client.
One of the client of (named example) is one departement of itself. This clients runs under the domain of Above you can see a normal client side flow.
The problem that can happens in this case is a bit subtle but well known. It is really important that the redirect uri matches as much as possible the hostname of the client. Let's see what it could happen if, at client registration time, chooses a redirect uri of *

Following the image above let's assume that I ( have registered yet another client at My client id is 'Bad' and ther registered redirect uri is
The next step to do is to create a link as per the image above and let the RO click on it.
Guess where the RO Access Token ends up? If you answered kudos to you.
The reasons why this happens are basically two:

1. the registered redirect uri from the client 'example' is too loose so is a perfectly valid redirect uri!!
2. URL Fragment is preserved for 302 redirects

At this stage you might also wonder why I named this attack 'Lassie come home' but I also hope you figured out the answer :).
That's all for now folks. Happy hacking....


This comment has been removed by a blog administrator.

Popular posts from this blog

Billion Laugh Attack in

tl;dr suffered from a Billion Laugh Attack vulnerability that made the containerized environment to crash with a single invocation.
Introduction Few months ago I applied for a talk at a security conference titled Soyouwanna be a Bug Bounty Hunter but it was rejected :(. The reason behind it is that I have been on/off in the bug bounty business for a while as you can see here:
Funny. Found in a forgotten drawer from the time I was a bug hunter :p — Antonio Sanso (@asanso) November 30, 2018 and I would have liked to share some of the things I have learned during these years (not necessary technical advises only). You can find a couple of these advises here:

Rule #1 of any bug hunter is to have a good RSS feed list
and here

The rule #2 of any bug hunter is to DO NOT be to fussy with 'food' specifically with "left over"
Today's rule is: The rule #3 of any bug hunter is DO LOOK at the old stuff


Bug bounty left over (and rant) Part III (Google and Twitter)

tl;dr in this blog post I am going to talk about some bug bounty left over with a little rant.

Here you can find bug bounty left over part I and II
Here you can find bug bounty rant part I and II
Introduction In one of my previous post I was saying that: 

"The rule #1 of any bug hunter... is to have a good RSS feed list."
Well well well allow me in this post to state rule #2 (IMHO)

"The rule #2 of any bug hunter is to DO NOT be to fussy with 'food' specifically with left over"

aka even if the most experience bug hunter was there (and it definitely was my case here, given the fact we are talking about no one less than filedescriptor) do not assume that all the vulnerabilities have been found! So if you want some examples here we go.
Part I - GoogleI have the privilege to receive from time to time Google Vulnerability Research Grant. One of the last I received had many target options to choose from, but one in particular caught my attention, namely Google Issue T…

Slack SAML authentication bypass

tl;dr  I found a severe issue in the Slack's SAML implementation that allowed me to bypass the authentication. This has now been solved by Slack.
Introduction IMHO the rule #1 of any bug hunter (note I do not consider myself one of them since I do this really sporadically) is to have a good RSS feed list.  In the course of the last years I built a pretty decent one and I try to follow other security experts trying to "steal" some useful tricks. There are many experts in different fields of the security panorama and too many to quote them here (maybe another post). But one of the leading expert (that I follow) on SAML is by far Ioannis Kakavas. Indeed he was able in the last years to find serious vulnerability in the SAML implementation of Microsoft and Github. Usually I am more an "OAuth guy" but since both, SAML and OAuth, are nothing else that grandchildren of Kerberos learning SAML has been in my todo list for long time. The Github incident gave me the final…