Skip to content
OAuth / SSO Write-up Intermediate

How an OAuth 2.0 Redirect URI Bypass Led to Account Takeover and an $8,000 Bounty

The identity provider validated the OAuth redirect URI with a loose prefix match instead of an exact match, so a path traversal in the redirect URI could point to an open redirect on the client application. An attacker could then capture the authorization code and exchange it for the victim's session, leading to account takeover.

T4nv1 Follow

Published on medium.com

Single Sign-On (SSO) integrations are designed to streamline authentication, but subtle oversights in how callback parameters are validated can compromise the entire authentication flow. When an application relies on OAuth 2.0 without enforcing strict string matching on redirect URIs, attackers can intercept…

T4nv1, 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

Impact

An attacker could capture the authorization code and exchange it for the victim's session, resulting in complete account takeover.

What the attacker needed

Victim clicks a crafted link; attacker controls a domain; client app has an open redirect

The fix

The identity provider was configured to enforce exact string matching on redirect URIs, the open redirect was fixed, and PKCE was implemented.

How it was found

  1. The attacker crafts an OAuth authorization link with a redirect URI that starts with the legitimate domain but includes a path traversal to an open redirect endpoint.
  2. The victim clicks the link and authenticates with the identity provider.
  3. The identity provider validates the redirect URI by prefix match and redirects back to the client application with the authorization code.
  4. The client application's router processes the path traversal and forwards the browser to the open redirect endpoint, preserving the code in the query string.
  5. The browser follows the open redirect to the attacker's domain, sending the authorization code to the attacker.
  6. The attacker captures the code and exchanges it at the legitimate callback endpoint to gain access to the victim's account.

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.

When you log in with a third-party service, that service sends a temporary code back to the app. If the app or the third-party service checks the return address loosely, an attacker can trick the system into sending the code to a server they control. The attacker then uses that code to log in as the victim.

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 T4nv1

View all

113 more disclosed reports, best first.

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.