OAuth Token Leakage Through Open Redirect Chains
Approved domains can relay stolen tokens, and only exact matching stops it.

OAuth token leakage through open redirect chains turns a supposedly minor flaw into a route to account takeover. The failure spans the authorization server, the client application, and the browser. Teams that check those parts one at a time can miss the attack. Finding and fixing it requires following the code or token all the way to its final destination.
Why an open redirect becomes a different vulnerability inside an OAuth flow
Bug bounty programs often give open redirects a low rating or leave them out altogether. That classification fits the standalone phishing case, where a trusted website sends someone to an attacker’s page. Inside an OAuth flow, the same endpoint can forward a credential.
The victim may only have to open one link. When an existing identity-provider session lets authorization finish on its own, the attacker has no need to get the victim to enter a password on a fake page. The legitimate flow issues the credential, and the redirect sends it elsewhere. This is why severity cannot be assigned from the redirect alone.
The 2025 “Challenging the Myth of Harmless Open Redirection” study found that 11.5% of open redirect vulnerabilities across affected sites could be escalated to XSS, CSRF, and information leakage, a finding broader than OAuth token theft. It nevertheless exposes the weakness in treating redirection as harmless by default. Teams need to check what sensitive operation reaches the redirect as well as whether the redirect exists.
How OAuth's redirect_uri validation is designed to work, and where the trust model assumes too much
The authorization server checks a submitted redirect_uri against the client’s registered redirect URIs before sending a code or token there. That check defines a security boundary. Prefix matching, substring matching, or a poorly escaped regular expression can accept a destination that was never meant to be allowed when the client was registered. A familiar hostname is not enough if the accepted path leads to an open redirect.
The stakes follow from how bearer tokens work. Whoever holds the token can use the access it grants without proving that they are the person who originally signed in. Redirect validation therefore controls possession of a credential. Trusting the destination also assumes that the client will not forward the authorization response somewhere else.
That assumption is especially risky with the implicit grant. With response_type=token, the authorization server puts the access token in the redirect URL’s fragment as #access_token=…. The browser receives the credential directly rather than leaving it to a server-to-server exchange. A later redirect can then move that fragment beyond the approved destination.
RFC 9700, published by the IETF in January 2025, states, “When comparing client redirection URIs against pre-registered URIs, authorization servers MUST utilize exact string matching”. The specification also names open redirectors as a route to code and token exfiltration and deprecates response types that issue access tokens in the authorization response. The rule is clear. But after years of looser implementations, the checks in use still fall short of what the rule requires.
How the chain assembles: redirect_uri allowlist bypass, open redirect sink, and fragment delivery
The main chain joins three conditions. The authorization server accepts a redirect URI that is only an approximate match, the approved client domain has an open redirect endpoint, and the authorization response puts the token in a fragment. Together, they let the attacker use an approved domain as a relay.
First, the attacker builds an authorization request whose redirect_uri points to the client’s open redirect endpoint. A validator that checks only whether the host is approved accepts it, even though the endpoint is not the intended callback. The authorization server then sends the browser there with the access token in the fragment. The initial destination looks legitimate because it is legitimate.
The client endpoint next redirects the browser to an attacker-controlled destination. Where the browser preserves the fragment through that redirect, the token arrives at the attacker’s page intact. That page reads it from window.location.hash. No further user interaction is needed. The credential has crossed the trust boundary through a navigation step the authorization server did not control.
A path-traversal variant reaches the same outcome indirectly. The validator accepts a path because it starts with an allowed prefix, while browser path resolution leads to a different endpoint containing the redirect sink. The accepted text and the executed route diverge.
Referer leakage is a separate channel from fragment forwarding. RFC 9700 addresses leakage through third-party resources on the callback page as a distinct concern. A callback URL containing an authorization code can expose that code through a Referer header, depending on browser behavior and policy. The distinction is important when proving a finding, because a fragment read by JavaScript and a code disclosed in a request header are different delivery mechanisms.

Why parser-differential bypass techniques defeat filter-based defenses
Filter-based defenses fail when the validator and the component performing the redirect read the same input differently. The attacker targets that disagreement. A filter may approve what it thinks is a trusted destination while a later decoding or parsing step produces an external one. Banning another string leaves that split in place.
Double encoding makes the problem concrete. An input such as trusted.tld%252f@attacker.tld contains an encoded percent sign, so one decoding pass exposes %2f and leaves the interpretation incomplete. If later processing decodes or interprets the result differently, the earlier approval no longer describes the destination being used. The exact outcome depends on the parsing layers. The test is whether the parsing layers agree.
Other inputs probe the same fault line, including protocol-relative URLs, backslashes, userinfo syntax, whitespace prefixes, and null bytes in legacy parsers. These are not interchangeable tricks that work everywhere. Each tests a particular assumption about how a URL will be read or normalized after validation.
Authentik CVE-2024-52289 shows how validation can exist and still be wrong. Its redirect URI comparison used re.fullmatch() without first escaping special characters with re.escape(). The dot in app.example.com became a regex wildcard, allowing app0example.com to satisfy the comparison. Keycloak CVE-2024-2419, classified CWE-601 with CVSS 7.1, likewise involved URI parsing inconsistency that bypassed explicitly allowlisted hosts. It affected versions before 22.0.10 and versions from 23.0.0 before 24.0.3.
These failures point beyond a longer denylist. Validation and redirect execution need a consistent interpretation of the URL, while OAuth callback approval needs exact matching rather than a pattern that admits unintended destinations.
What real-world exploitation looks like at scale: named cases and their blast radius
Booking.com’s 2023 case exposed the weakness of approving a domain without enforcing the intended path. The OAuth provider checked that redirect URIs belonged to Booking.com, but weak path validation and an internal open redirect let tokens reach attacker-controlled domains. The domain check approved the first stop without controlling the next one.
The consequence can extend beyond a stolen browser session. Some refresh tokens never expire, and token access can survive password resets and MFA reenrollment. That persistence changes incident recovery. Restoring control of a password does not necessarily remove a credential already issued through OAuth.
Obsidian’s analysis describes a third-party OAuth supply chain breach in which persistent refresh tokens across a large number of organizations were compromised after an initial intrusion. It describes a blast radius an order of magnitude greater than incidents where attackers infiltrated Salesforce directly, with access persisting for months before detection. That case shows what can happen when tokens are compromised, though it does not prove that every such breach starts with an open redirect. A durable credential creates risk in both cases. Once stolen, it can turn one initial intrusion into access across many organizations.
Why PKCE does not close this vulnerability, and what the specification actually requires
PKCE prevents an attacker from redeeming an intercepted authorization code without the corresponding code verifier. But if the attacker initiated the authorization request and supplied the challenge, the attacker already holds that verifier. In that chain, PKCE does not distinguish the attacker from the party entitled to redeem the code.
The distinction is between interception and attacker-initiated authorization. PKCE binds redemption to a secret associated with the request. It does not establish that every destination reached through the redirect chain is safe. Nor does it protect an access token already issued directly through the implicit flow.
RFC 9700 treats PKCE and redirect validation as separate protections. Its requirements must be applied together, with S256 protection enforced. An authorization server that supports PKCE but accepts requests without it leaves a downgrade path. A feature being available is not the same as the server requiring its use.
The specification also requires clients not to expose open redirectors, including where exact callback matching is already in place. A callback that has been approved can itself send sensitive data elsewhere. OAuth 2.1, which is still under development, will include the specification’s security recommendations, but changes to implementations cannot wait for a new protocol label.
How to test for this vulnerability class in a real engagement
Testing needs to connect the authorization server’s decisions with the client’s redirect behavior. An automated scanner that assesses each endpoint in isolation can identify the pieces without establishing the chain. Greybox testing gives the tester a stronger starting point through partial knowledge of registered redirect URIs, grant types, and PKCE enforcement. Whitebox access to source code and configuration can narrow that search further.
For an authorized engagement, the practical approach is to test each registered redirect URI for exact matching. Prefix, substring, and regex behavior need to be distinguished to specify what “validation present” means. Path traversal, double encoding, backslash substitutions, and userinfo syntax can then probe interpretation differences. The accepted input is only half the evidence. The tester also needs the emitted Location value and the destination the browser actually reaches.
Where an approved domain contains a sibling open redirect, the next step is to construct the full authorization request using that endpoint as the redirect URI. The test should establish whether a code or token arrives at the controlled destination. Testers need to watch for fragment delivery and Referer leakage separately because they leak credentials in different ways. Requests leaving the callback page can reveal code leakage without proving fragment leakage.
The impact must be demonstrated. A redirect finding alone does not prove account takeover, and an accepted URI variant alone does not prove credential theft. Conversely, a working chain that delivers a usable token is not adequately described as a navigation flaw. Expert-led testing earns its value by connecting the evidence across those boundaries and showing what access the leaked credential enables.
Remediation that actually closes the chain, not just the most visible link
Effective remediation must address both approval and forwarding. Patching one open redirect while leaving approximate callback validation permits another endpoint to take its place. Tightening the authorization server while leaving an approved callback able to forward credentials preserves a different route. The fix has to cover the whole path.
At the authorization server, the required action is exact string matching against pre-registered redirect URIs. URL handling must also work the same way during validation and execution, and normalization must not allow more destinations to be accepted. On the client side, open redirects need to be removed from callback paths. A separate callback origin, such as callback.site.com separate from app.site.com, can also separate OAuth handling from redirect features elsewhere in the application.
The flow itself needs attention as well. Migrating away from the implicit grant to authorization code flow with PKCE removes the direct fragment-delivery mechanism. PKCE should use S256, reject the plain method, and require a code_challenge on /authorize with a matching code_verifier on /token. Applying it to confidential clients adds defense in depth.
Token handling and retesting complete the work. Access tokens in browser localStorage are reachable by JavaScript on the page, so removing a redirect does not make storage choices irrelevant. Retesting also needs to cover both sibling routes and the repaired endpoint. In the GitLab case, a sibling API route lacked the protection that was in place elsewhere.
A penetration test can provide the forcing function that isolated findings lack. It ties the redirect to credential exposure, demonstrates the resulting access, and tests whether the repair breaks that route and its siblings.


