Open Redirect to OAuth Token Theft
Why an open redirect on an origin the authorization server trusts escalates to account takeover: the redirect acts as a proxy that forwards the authorization code or access token off the client origin, defeating exact-match
redirect_urivalidation.
How it works
OAuth’s security rests on the code/token reaching only the registered client. Exact-match redirect_uri validation protects the IdP-to-client hop, but not a redirect that fires afterward on the client’s own trusted origin (masimshahzad). Two placements are distinguished in the notes (flex0geek):
- In the authorization server — the
redirect_uricheck itself accepts a foreign host (see Redirect Validation Bypasses), so the credential leaves directly. - In the client —
redirect_uriis pinned to an allowed host, but that host contains an open redirect, so the browser is bounced onward with the credential still attached to the URL.
With the authorization-code flow a leaked code can be replayed at the legitimate callback and the client completes the login, so the client secret is never needed (OAuth Part II). With the implicit flow the token arrives in the URL fragment and is usable directly against the provider’s APIs, not just for client login (PortSwigger). This is the canonical weaponization of a “low severity” open redirect, and the reason programs that exclude standalone open redirects still pay when one sits on an OAuth origin (Tib3rius).
Escalation surface
- Registered callback is clean, elsewhere isn’t. The callback path (
/oauth/callback) rarely redirects, so path confusion moves the landing page to a vulnerable path on the same origin while still satisfying the host allowlist (Top 10 OAuth Pt 2). ACSAC ‘23 showed this empirically: 6 of 16 major IdPs (Atlassian, Facebook, GitHub, Microsoft, NAVER, VK) accepted path-confusion redirect URIs, and because the victim lands on a page that never consumes the code, the normal single-use race disappears. Any data-leaking bug on any path of the client becomes OAuth ATO (ACM). - Referer / fragment leakage. Where the callback embeds third-party scripts or reflects into HTML, the code/token leaks via the
Refererheader or an injected resource; ACSAC measured code leakage to ad networks (Real-Time Bidding) on real sites (ACM, Top 10 OAuth Pt 2). - Open redirect to arbitrary provider redirector. Chaining through a provider logout/continue endpoint (
accounts.google.com/...?continue=) reaches any destination from a trusted host (Cobalt). - Missing/weak
statemakes the login-CSRF setup step possible, which is what plants the attacker-controlled return path (below).
Notable cases
- Airbnb, 2016 ($5,000). Redirect URIs were an exact list, yet a post-login redirect derived from the
Refererheader plus a cross-site-GET login-CSRF on the OAuth start endpoint delivered Facebook and Google tokens to an attacker page; the mobile app accepted the bare provider token as login (masimshahzad). - Zee Entertainment, P1 CVSS 9.0. An open redirect on
signin?callback=sent the browser to the attacker with a one-time OTP auth code in the query; it was redeemable once for a session valid ~55 days, chained onward to full ATO (Josekutty Binu). - Stale CNAME + wildcard
redirect_uri($6,000). A*.target.comcallback rule plus a subdomain takeover gave zero-interaction code theft (writeup). - Covert Redirect (2014). The original disclosure that a poorly validated
redirect_uriplus an open redirector on a trusted domain intercepts the code/token; many providers moved to exact match afterward (Gupta). - CVE-2019-9837 (Doorkeeper OIDC) — open redirect via
redirect_uri(Gupta); CVE-2020-5233 / CVE-2021-21291 (OAuth2-Proxy) — open redirect via crafted redirect URLs / whitelist-domain feature (ZeroPath).
Defenses
- Exact-match, per-client
redirect_uriallowlists with no wildcards, and re-validate at the token endpoint; GitHub and NAVER allowed ATO partly because the Redeem-Process check was lax or optional (ACM, Doyensec). - Treat
redirect_uriwith strict byte-equality; never sanitize it, and treatcode/stateappearing inside it as an attack indicator (ACM). - Never derive post-login redirects from
Referer; store an internal return path server-side and accept only allowlisted relative paths. Bindstateand the PKCE verifier to a pre-session cookie so a planted return path or an injected code cannot be reused (masimshahzad). Referrer-Policy: no-referreron OAuth endpoints; keep third-party scripts off callback pages (RFC 6749 §3.1.2.5) (Top 10 OAuth Pt 2).- Kill open redirects on every origin in the OAuth allowlist, not only the callback path.
Related
- Open Redirect (main guide)
- Redirect Validation Bypasses · Open Redirect to SSRF · DOM-Based Open Redirect
- OAuth 2.0 Vulnerabilities · OpenID Connect Security · Account Takeover · Vulnerability Chaining · Login CSRF · Mobile OAuth and Deep Link Attacks
Sources
- OAuth 2.0 Redirect URI Validation Falls Short (ACM) · original
- What can I do with Open Redirect with OAuth? · original
- The Referer Header That Redirected OAuth Tokens · original
- Chaining an Open Redirect Into Account Takeover (P1 · CVSS 9.0) · original
- How I Chained a Stale CNAME Record with OAuth 2.0 Wildcards for a $6,000 ATO · original
- PortSwigger: OAuth 2.0 authentication vulnerabilities · original
- Top 10 OAuth 2.0 Hacking Techniques Part 2 · original
- OAuth Vulnerabilities Part II (Bug Bounty 2k25) · original
- Cobalt: OAuth Vulnerabilities Part 2 · original
- Doyensec: Common OAuth Vulnerabilities · original
- SSO Protocol Security: Critical Vulnerabilities in SAML, OAuth, OIDC, JWT · original
- OAuth2-Proxy Authentication Bypass (CVE-2025-54576) · original
- Web AppSec Interview Questions · original
- 0xn3va: OAuth 2.0 Vulnerabilities cheat sheet · original
- The Art of Breaking OAuth: Real-World Exploits and Misuses · original
- Grafana CVE-2025-6023: Full Account Takeover · original