Skip to content
OAuth / SSO Disclosed report Intermediate

No redirect uri for Twitter Oath resulting in token leak

The OAuth authorisation endpoint for Twitter accepted a user-controlled 'next' parameter that determined where the OAuth token was sent after authorisation. An attacker could change this parameter to redirect the token to a profile page they control, leaking the token.

b3nac Follow

Originally disclosed on HackerOne

  • Triaged in 2 hours
  • Fixed in 2 days
  • Disclosed after 2 days

Good afternoon,

There's an opportunity to steal Oath tokens upon the return uri in the following redirect.

https://wakatime.com/oauth/twitter/authorize?reason=tweet&next=/share/embeddable/5e22456d-9aae-4267-b1a9-4315c2605d89/0ed2e4de-f479-4e03-a8db-464a0696c08f.svg/tweet

If I change the &next= to my profile for example /@5e22456d-9aae-4267-b1a9-4315c2605d89

This results in an open redirect to my main profile leaking the Oauth token:

#POC

https://wakatime.com/oauth/twitter/authorize?reason=tweet&next=/@5e22456d-9aae-4267-b1a9-4315c2605d89

results in F199105

Here's a video demonstrating the vulnerability. F199111

#Patch Add a redirect uri that can't be tampered with.

#References

This is almost the exact same scenario that is in this report. https://hackerone.com/reports/140432

Attachments

OauthTokenLeak.png
OauthTokenLeak.png From the original on HackerOne

The original report as published on HackerOne, by b3nac. 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 flow used a user-supplied 'next' parameter as the redirect destination without validating it against a fixed allowlist, allowing an open redirect that exposed the token.

What the attacker needed

Attacker crafts a link with a modified next parameter; the OAuth flow is completed

The fix

The OAuth flow should use a fixed, pre-registered redirect URI that cannot be tampered with by the user.

How it was found

  1. Visit the OAuth authorisation URL with the original 'next' parameter.
  2. Change the 'next' parameter to a profile path controlled by the attacker.
  3. Complete the OAuth flow and observe the token being sent to the attacker-controlled profile.

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 Twitter on a website, the site receives a special token that proves who you are. This report shows that the site let the user choose where that token was sent afterwards. By changing a value in the link, an attacker could make the token go to a page they control, stealing it.

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 b3nac

View all

6 more disclosed reports, best first.

More from WakaTime

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.