All your Paypal OAuth tokens belong to me - localhost for the win

ID INTOTHESYMMETRY:31C218C2F56AB996FB15716709542570
Type intothesymmetry
Reporter Antonio Sanso (
Modified 2018-08-17T09:54:13


tl;dr I was able to hijack the OAuth tokens of EVERY Paypal OAuth application with a really simple trick.


If you have been following this blog you might have got tired of how many times I have stressed out the importance of the redirect_uri parameter in the OAuth flow.
This simple parameter might be source of many headaches for any maintainer of OAuth installations being it a client or a server.
Accepting the risk of repeating myself here is two simple suggestions that may help you stay away from troubles (you can always skip this part and going directly to the Paypal Vulnerability section):

_If you are building an OAuth client, _

Thou shall register a redirect_uri as much as specific as you can

i.e. if your OAuth client callback is then

  • DO register
  • NOT JUST or If you are still not convinced here is how I hacked Google leveraging this mistake.

Second suggestion is

The ONLY_ safe validation

method for redirect_uri the
authorization server should
adopt is exact matching_

Although other methods offer client developers desirable flexibility in managing their application’s deployment, they are exploitable.

From “OAuth 2 In Action” by Justin Richer and Antonio Sanso, Copyrights 2016
Again here you can find examples of providers that were vulnerable to this attack

Paypal Vulnerability

So after this long premise the legitimate question is what was wrong with Paypal ?

Basically like many online internet services Paypal offers the option to register your own Paypal application via a Dashboard. So far so good :). The better news (for Paypal) is that they actually employs an exact matching policy for redirect_uri :)

So what was wrong ?

While testing my own OAuth client I have noticed something a bit fishy. The easier way to describe it is using an OAuth application from Paypal itself (remember the vulnerability I found is universal aka worked with every client!). Basically Paypal has setup a Demo Paypal application to showcases their OAuth functionalities. The initial OAuth request looked like:

As you can see the registered redirect_uri for this application is

What I have found out is that the Paypal Authorization Server was also accepting localhost as redirect_uri. So

was still a valid request and the authorization code was then delivered back to localhost .

Cute right? But still not a vulnerability :(

Well the next natural step was to create a DNS entry for my website looking lke <> and try:

and you know what? BINGO :

So it really looks like that even if Paypal did actually performed exact matching validation, localhost was a magic word and it override the validation completely!!!
Worth repeating is this vulnerability worked for any Paypal OAuth client hence was Universal making my initial claim

All your Paypal tokens belong to me - localhost for the win

not so crazy anymore.
For more follow me on Twitter.

Disclosure timeline

08-09-2016 - Reported to Paypal security team.

26-09-2016 - Paypal replied this is not a vulnerability!!

26-09-2016 - I replied to Paypal saying ok no problem. Are you sure you do not want to give an extra look into it ?

28-09-2016 - Paypal replied the will give another try.

07-11-2016 - Paypal fixed the issue (bounty awarded)
28 -11-2016 - Public disclosure.


I would like to thank the Paypal Security team for the constant and quick support.