Skip to content
OAuth / SSO Write-up Intermediate

Zero-Click Account Takeover via OAuth

The OAuth authorisation server did not validate the redirect_uri parameter, allowing an attacker to redirect the authorisation code to an attacker-controlled domain. The attacker could then exchange that code for an access token and take over the victim's account.

amrqansow Follow

Published on medium.com

I’m Amr Khaled — a Web, Network & Android Penetration Tester, and an active Bug Hunter on platforms such as HackerOne and Bugcrowd.

Amr khaled Zakaria, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Root cause

Likely the OAuth authorisation server failed to validate the redirect_uri parameter against a whitelist of allowed values.

Impact

An attacker could obtain a victim's access token and take over their account, though the victim must click a link and accept permissions.

What the attacker needed

Victim clicks a link; victim accepts permissions

How it was found

  1. Send the vulnerable authorisation URL with the redirect_uri pointing to an attacker-controlled domain to the victim.
  2. The victim clicks the URL, opens it, and accepts the permissions.
  3. The authorisation code is sent to the attacker's server.
  4. Use the authorisation code and the same redirect_uri in the token-exchange request.
  5. The server responds with the victim's access token, allowing account takeover.

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 write-up has not been written yet. The Original tab links to the source.

OAuth is a way for apps to access your account on another service without asking for your password. When you log in, the service gives the app a short-lived code that the app swaps for a key (access token). Here, the app did not check where it sent that code, so an attacker could trick the service into sending the code to their own server and then use it to get the key and control the 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.

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.