Summary
An authorization flaw in ZITADEL's OAuth2 Token Exchange endpoint allows tokens to be exchanged without verifying that the subject token belongs to the requesting client or that requested scopes stay within the original token's privileges.
Under certain configurations, this can let a low-privilege token be traded for elevated permissions against another application that trusts ZITADEL-issued tokens.
Affected context
This vulnerability appears in ZITADEL deployments that use the OAuth2 Token Exchange grant type (urn:ietf:params:oauth:grant-type:token-exchange) for issuing tokens across applications.
It becomes relevant when multiple clients share the same identity provider and rely on ZITADEL to enforce client binding and scope limitations during token exchanges.
The risk is most pronounced where downstream applications honor exchanged tokens without performing additional audience or scope checks.
Exploit preconditions
- Attack surface: OAuth2 / OIDC token endpoint exposed by ZITADEL.
- Required access: Possession of a valid but low-privilege subject token and the ability to call the token exchange endpoint as an OAuth2 client.
- Trigger point: Invoking the token exchange grant with a subject token issued for one client while requesting scopes or audiences associated with another application.
- Why exploitation is possible: The endpoint does not sufficiently verify that:
- The subject token is bound to the requesting client, and
- The requested scopes are constrained to those granted in the original token.
Why this happens
The root cause is inadequate authorization checks in the token exchange flow, specifically missing validation of token ownership and scope inheritance rules.
Instead of enforcing strict client binding and scope containment, the implementation allows a client to present a token issued in a different context and request broader scopes or a different audience.
This maps to CWE-862: Missing Authorization, where the system fails to confirm that the caller is entitled to use the provided subject token in this way and to request the elevated permissions.
Potential impact
- Low-privilege users may obtain tokens granting higher-privilege scopes.
- Access could be gained to another application's APIs relying on ZITADEL tokens.
- Cross-application privilege escalation within the same identity platform.
- Potential exposure of sensitive data protected by downstream services.
- Unauthorized actions carried out under the guise of another client or role.
General mitigation guidance
Mitigation focuses on strengthening authorization checks and enforcing the principle of least privilege in token exchange flows.
Common defensive patterns include:
- Strictly binding subject tokens to their original client and rejecting exchanges from non-owning clients.
- Enforcing that requested scopes and audiences during token exchange are a subset of those granted in the original token.
- Applying audience and client-specific policies that restrict which clients may perform token exchanges and for which target resources.
- Designing downstream services to validate scopes, audiences, and client identifiers independently rather than assuming upstream enforcement is sufficient.
- Using conservative default configurations where cross-client token exchange is disabled or tightly whitelisted.
How teams detect issues like this
Detection typically involves reviewing both code and configuration around token exchange handling.
Useful approaches include:
- Static or configuration analysis to ensure that token exchange logic enforces client binding and scope subset checks.
- Code review checklists that explicitly ask how subject tokens, audiences, and scopes are validated for token exchange grants.
- Logging and monitoring of token exchange events, including source client, subject token client, requested scopes, and target audiences, to spot anomalous privilege jumps.
- Automated security tests that attempt token exchanges with mismatched clients or expanded scopes to verify defenses.

