OAuth serves as an open standard for token-based authentication employed by many internet giants, including PayPal. That is why the discovery of a critical flaw in the online payments service that could have allowed hackers to steal OAuth tokens from users has sent PayPal scrambling to roll out a patch.
Antonio Sanso, a security researcher and Adobe software engineer, discovered the flaw after he tested his own OAuth client. In addition to PayPal, Sanso also detected the same vulnerability in other major internet services like Facebook and Google.
Sanso says the problem lies in the way PayPal handles the redirect_uri parameter to give applications certain authentication tokens. The service has been using enhanced redirect checks to confirm the redirect_uri parameter since 2015. Still, it did not stop Sanso from bypassing these checks when he started to investigate the system in September.
PayPal lets developers use a dashboard that can produce token requests in order to enlist their apps with the service. The resulting token requests are then sent to a PayPal authorization server. Now, Sanso found an error in how PayPal recognizes a localhost as a valid redirect_uri parameter during the authentication process. He said this method wrongly implemented OAuth.
Gaming the validation system
Sanso then went on to game PayPal’s validation system and have it reveal the otherwise confidential OAuth authentication tokens. He managed to trick the system by adding a certain domain name system entry to his website, noting that localhost served as the magic word for overriding PayPal’s exact matching validation process.
The vulnerability could have compromised any PayPal OAuth client according to Sanso. He advised users to create a very specific redirect_uri when making an OAuth client. Sanso wrote in a blog post:
DO register https://yourouauthclient[dot]com/oauth/oauthprovider/callback. NOT JUST https://yourouauthclient[dot]com/ or https://yourouauthclient[dot]com/oauth.
PayPal did not believe Sanso’s findings at first, though the company eventually reconsidered its decision and now issued a fix to the flaw.