ZITADEL: Missing client_id binding in OIDC authorization code exchange and refresh token flows (RFC 6749 Section 4.1.3 violation)
Description
Summary
Zitadel's OAuth2 / OIDC CodeExchange and RefreshToken implementations omit a critical validation step to ensure that the requesting client matches the client that originally initiated the authorization flow. This violates RFC 6749 Section 4.1.3, which mandates that the authorization server must ensure the authorization code was issued to the authenticated confidential client.
Impact
This flaw creates potential vulnerabilities in two main authentication phases, provided specific external preconditions are met:
- Authorization Code Injection: An attacker who intercepts an authorization code (via an independent application vulnerability such as XSS, referrer leakage, log access, or network interception) can exchange it using credentials from a completely different client (
ClientB) registered on the same Zitadel instance. Zitadel will authenticateClientBand issue tokens for the victim user without verifying the client binding. - Refresh Token Cross-Use: An attacker who successfully steals a valid refresh token (via an external application exploit or data leak) can present it under a different client identity. Zitadel validates the token's format and expiration but fails to enforce client binding, allowing the attacker to maintain persistent access from an unauthorized client.
- Device Authorization Cross-Use: An attacker who intercepts or manipulates a device authorization flow grant can finalize the exchange using a different client context than the one that initiated the device session, bypassing intended client boundaries.
Scope and Mitigation Factors:
- External Preconditions: It is critical to note that exploiting either vector requires a pre-existing vulnerability or data leak within the target application environment to intercept the code or token in the first place. Securing the application layer against token theft remains outside the scope of Zitadel.
- Multi-tenant risk: On shared or multi-tenant instances, a client belonging to one tenant could theoretically exploit codes/tokens belonging to another tenant's clients if they are successfully intercepted.
- PKCE protection: Clients strictly using PKCE (Proof Key for Code Exchange) are partially mitigated against the authorization code injection vector, as the attacker would still require the
code_verifier. However, PKCE does not protect against refresh token cross-use.
Affected
Versions
Systems running one of the following versions are affected:
- 4.x:
4.0.0through4.15.1(including RC versions) - 3.x:
3.0.0through3.4.11(including RC versions)
Patches
The vulnerability has been addressed in the latest releases by re-introducing strict client identity validation on the CodeExchange and RefreshToken grants.
Please upgrade to one of the following secure versions:
Workarounds
The recommended solution is to upgrade to a patched version.
To reduce exposure in the interim, ensure absolute adherence to application security best practices to prevent credential/token theft, enforce the use of PKCE for all clients to mitigate the Authorization Code Injection risk, and minimize refresh token lifespans.
Questions
If you have any questions or comments about this advisory, please email us at security@zitadel.com
Credits
Thanks to kodareef5, Shubham Raj / Causal Security, and Gaurav Popalghat for identifying and responsibly reporting this or a part of this vulnerability.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
1Patches
Vulnerability mechanics
Root cause
"Missing client identity validation in the authorization code, refresh token, and device authorization grant handlers allows a token obtained for one client to be exchanged by a different client."
Attack vector
An attacker who has already obtained a valid authorization code, refresh token, or device code through an independent application vulnerability (e.g., XSS, referrer leakage, log access, or network interception) can present that credential to Zitadel using a different OAuth2 client (`ClientB`) registered on the same instance. Because Zitadel did not verify that the exchanging client matches the client that originally initiated the flow, the attacker can obtain tokens for the victim user under `ClientB`'s identity. This violates RFC 6749 Section 4.1.3 and affects the authorization code, refresh token, and device authorization grants [ref_id=1].
Affected code
The vulnerability resides in the `CodeExchange`, `RefreshToken`, and `DeviceToken` grant handlers in `internal/api/oidc/token_code.go`, `internal/api/oidc/token_refresh.go`, and `internal/api/oidc/token_device.go`, as well as the `ExchangeOIDCSessionRefreshAndAccessToken` and `CreateOIDCSessionFromDeviceAuth` commands in `internal/command/oidc_session.go` and `internal/command/device_auth.go`. These endpoints omitted a check that the requesting client's ID matches the `client_id` stored in the authorization request, refresh token, or device authorization model.
What the fix does
The patch adds a client identity check at each grant endpoint. In `token_code.go`, the `codeExchangeV1` and `codeExchangeComplianceChecker` functions now compare `authReq.GetClientID()` against `client.client.ClientID` and return `oidc.ErrInvalidClient()` on mismatch. In `token_refresh.go`, the `refreshTokenComplianceChecker` function compares `model.ClientID` against the requesting client's ID. In `device_auth.go`, `CreateOIDCSessionFromDeviceAuth` compares `deviceAuthModel.ClientID` against the provided `clientID`. The `ExchangeOIDCSessionRefreshAndAccessToken` command signature is extended to accept `reqClientID` and pass it to the compliance checker. These changes enforce the RFC 6749 requirement that the token exchange must be performed by the same client that initiated the flow [patch_id=6468210].
Preconditions
- inputThe attacker must first obtain a valid authorization code, refresh token, or device code through an independent application vulnerability (XSS, referrer leakage, log access, network interception).
- configThe attacker must have access to a different OAuth2 client (`ClientB`) registered on the same Zitadel instance.
- configFor the authorization code vector, PKCE is a partial mitigation — the attacker would also need the `code_verifier`.
Generated on Jun 18, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-xqxv-4jc2-x56xghsaADVISORY
- github.com/zitadel/zitadel/commit/0973b074b48816757c47fe732b06d2488d3d284cghsa
- github.com/zitadel/zitadel/releases/tag/v3.4.12ghsa
- github.com/zitadel/zitadel/releases/tag/v4.15.2ghsa
- github.com/zitadel/zitadel/security/advisories/GHSA-xqxv-4jc2-x56xghsa
News mentions
0No linked articles in our index yet.