Skip to content
OAuth / SSO Disclosed report Intermediate

configure a redirect URI for Facebook OAuth

The Facebook OAuth flow on Gratipay allowed any redirect URI, so an attacker could craft a link that sent the OAuth authorisation code to a user-controlled profile page. That page could then leak the code via the Referer header or third-party images, potentially allowing the attacker to steal access tokens.

paulos__ Follow

Originally disclosed on HackerOne

  • Triaged in 23 days
  • Fixed in 23 days
  • Paid in 23 days
  • Disclosed after 25 days

Hey,

Its me again. since the Login with Facebook doesnt have a dedicated directory like gratipay.com/facebook/callback it is possible to still steal access tokens.

https://www.facebook.com/dialog/oauth?response_type=code&client_id=144124902390407&redirect_uri=https://gratipay.com/~attacka/&scope=public_profile%2Cemail%2Cuser_friends&state=mjemgKNb0s24lbEqBcyVqDEVNoYDYs

As you can see it will send the token to my profile (/~attacka) and my profile points to example.com, if the user clicks on that link the referrer header will send tokenz (obviously lol)

gratipay also imports pictures from 3rd parties, forexample my img src is from ls.googleusercontent.com which means it will also leak the access_tokens to there.

Fix: add the redirect uri like: https://www.gratipay.com/facebook/callback so users have no way to tamper with it.

Thanks, P

The original report as published on HackerOne, by paulos__. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

How it worked

Root cause

Likely the OAuth implementation did not enforce a fixed redirect URI, allowing attackers to supply arbitrary redirect targets.

Impact

An attacker could steal OAuth access tokens via the leaked code.

What the attacker needed

Victim clicks a crafted link; attacker has a profile on the site

The fix

The OAuth implementation should enforce a fixed redirect URI, such as a dedicated callback endpoint, so users cannot tamper with it.

How it was found

  1. Craft a Facebook OAuth authorisation URL with the redirect_uri pointing to an attacker-controlled profile page on the target site.
  2. Ensure the attacker profile page redirects to an external site or contains third-party images.
  3. Send the crafted link to a victim; when clicked, the OAuth code is sent to the attacker's profile page.
  4. The code leaks via the Referer header or third-party image requests.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

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

When you log in with Facebook, Facebook sends a secret code back to the website. If the website doesn't check exactly where that code goes, an attacker can make it go to a page they control. Then they can grab the code and use it to access your account.

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 by paulos__

View all

16 more disclosed reports, best first.

More from Gratipay

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.