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_uri validation.

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):

  1. In the authorization server — the redirect_uri check itself accepts a foreign host (see Redirect Validation Bypasses), so the credential leaves directly.
  2. In the client — redirect_uri is 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 Referer header 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 state makes 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 Referer header 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.com callback rule plus a subdomain takeover gave zero-interaction code theft (writeup).
  • Covert Redirect (2014). The original disclosure that a poorly validated redirect_uri plus 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_uri allowlists 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_uri with strict byte-equality; never sanitize it, and treat code/state appearing 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. Bind state and the PKCE verifier to a pre-session cookie so a planted return path or an injected code cannot be reused (masimshahzad).
  • Referrer-Policy: no-referrer on 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.

Sources