Skip to content
OAuth / SSO Disclosed report Intermediate

[Critical] - Steal OAuth Tokens

The OAuth redirect_uri validation for Twitter's Microsoft Outlook integration accepted any subdomain of twitter.com, and an open redirect on cards.twitter.com allowed an attacker to steal OAuth tokens. An attacker could craft a link that, when clicked by an already-authorized user, sends the access token to an attacker-controlled site.

paulos__ Follow

Originally disclosed on HackerOne

  • Triaged in 4 days
  • Fixed in 38 days
  • Paid in 7 days
  • Disclosed after 3 months

Hi,

This bug is caused because of the same mis-configuration as #128119. Only this time Microsoft Outlook auth is vulnerable instead of Facebook. this time I will try to be as clear as possible. after sign up of Twitter, Twitter asks users to import contacts (and it only requires on authorization) - or simply going to https://twitter.com/who_to_follow/import will do that.

I believe you have configured your oauth redirect_uri as twitter.com in your app settings. Meaning Microsoft will accept:

So the forumla of a valid redirect_uri for twitter app is http(s?)://.twitter.com/

Okay, so now we make an open redirect.

https://cards.twitter.com/cards/18ce53y6aap/yyms redirects to http://test.com and qualifies to bypass http(s?)://.twitter.com/ and we will add %2523 behind it like https://cards.twitter.com/cards/18ce53y6aap/yyms%2523 for microsoft to decode and send as a Hash %2523 -> %23 -> # with our stolen access_token.

We can then obtain this token using location.hash and all the user had to do is a single click (if already authorized - lots of people have)

To make things more clear, here is unlisted YouTube video to demonstrate how this works: https://youtu.be/apwbVpa2r6Y (also attached)

Thanks, Paulos

Attachments

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 redirect_uri validation used a wildcard pattern that accepted any subdomain of twitter.com, combined with an open redirect on a subdomain.

Impact

An attacker could steal OAuth access tokens from users who had already authorized the integration, but the attack required the victim to click a crafted link.

What the attacker needed

Victim has already authorized the integration; victim clicks a crafted link

How it was found

  1. Sign up for Twitter and go to the import contacts page to start the Microsoft Outlook authorization flow.
  2. Craft a redirect_uri that points to an open redirect on cards.twitter.com, appending an encoded fragment to carry the token.
  3. Send the crafted link to a victim who has already authorized the app; when clicked, the token is sent to the attacker's site.
  4. Retrieve the token from the URL fragment using location.hash.

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 another service like Microsoft, that service sends you back to the original site with a special code. The site must check that the return address is really its own. Here, the check allowed any address ending in twitter.com, and one of those addresses could redirect anywhere, so an attacker could trick the system into sending the secret code to themselves.

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 X / xAI

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.