Summary
ZITADEL's OAuth2 and OIDC token flows fail to consistently verify that the client exchanging an authorization code or refresh token is the same client that initiated the authorization.
Under these conditions, intercepted grants or refresh tokens can be replayed and successfully exchanged under a different client, potentially enabling unauthorized access to protected resources.
Affected context
This vulnerability appears in ZITADEL's OAuth2 and OIDC implementations where authorization codes, refresh tokens, and device tokens are exchanged for access tokens.
It is relevant in deployments that:
- Support authorization code, refresh token, or device flows
- Rely on client identifiers and secrets for token exchange
- Operate in environments where network interception, logging, or proxying of tokens is possible
The risk manifests when the server does not strictly bind a grant or token to the originating client during the exchange step.
Exploit preconditions
- Attack surface: OAuth2/OIDC token endpoints handling CodeExchange, RefreshToken, or device token flows
- Required access: Ability to obtain or intercept valid authorization codes, refresh tokens, or device tokens issued to some client
- Trigger point: Submitting the intercepted grant or token to the token endpoint from a different, attacker-controlled client
- Why exploitation is possible: The server does not fully enforce that the client performing the token exchange is the same client that initiated the original authorization, allowing cross-client token reuse.
Why this happens
The underlying issue is an authentication and authorization logic flaw in client binding during OAuth2/OIDC token exchanges.
Instead of strictly validating that the client identifier (and associated credentials) match the client recorded for the original authorization request, the implementation allows grants or refresh tokens to be redeemed by a different client.
This maps to:
- CWE-287: Improper Authentication, because the platform fails to robustly authenticate the client as the rightful owner of the grant.
- CWE-863: Improper Authorization, since a client is permitted to access functionality (token redemption) using tokens it was not originally authorized to use.
Conceptually, the bug represents missing or incomplete correlation between the session state of the authorization flow and the client identity at the exchange step.
Potential impact
- Attackers may obtain access tokens tied to another client's authorization flows.
- Unauthorized clients could access user data or APIs protected by ZITADEL-issued tokens.
- Compromise of confidentiality for resources scoped to the misused tokens.
- Potential lateral movement if tokens grant broad permissions or administrative access.
- Erosion of trust in the identity platform's token isolation and client boundary guarantees.
General mitigation guidance
Effective mitigation typically focuses on hardening client binding and authorization logic within OAuth2/OIDC flows.
Common defensive patterns include:
- Strictly associating authorization codes, refresh tokens, and device tokens with the originating client and persisting this binding in server-side state.
- Enforcing verification at the token endpoint that the requesting client identifier (and credentials, where applicable) match the client recorded for the grant.
- Designing flows to minimize token exposure (e.g., limiting where tokens are logged, stored, or transmitted) and reducing opportunities for interception.
- Applying least-privilege principles to scopes and token lifetimes so that misuse of a single token yields limited access.
- Implementing secure-by-default behaviors in OAuth/OIDC libraries and abstractions, making correct client binding and validation automatic rather than optional.
How teams detect issues like this
Detection approaches can combine protocol-aware analysis with code-level review:
- Code review signals: Examine token exchange handlers to confirm that client identifiers are consistently validated against stored authorization session data; look for flows where the client from the original authorization is not explicitly checked.
- Static analysis patterns: Flag endpoints that process authorization codes, refresh tokens, or device tokens without correlating them to a bound client ID, or that rely solely on token contents without server-side state verification.
- Policy enforcement: Define security requirements for OAuth/OIDC flows (e.g., "all grants must be bound to a single client and checked at redemption time") and enforce them via architectural reviews and CI checks.
- Runtime monitoring: Analyze token issuance and redemption logs for anomalous patterns, such as grants created under one client but redeemed under another, even if the platform currently permits it.
Some automated security testing tools with protocol support can help simulate cross-client token redemption attempts and highlight missing validation.

