Skip to content

[CVE-2026-97846] Standard Token Exchange bypasses required mTLS certificate binding and issues an active bearer token when no client certificate is supplied #53187

Closed

Description

@abstractj

Describe the bug

When a confidential client has mTLS holder-of-key token binding enabled (tls.client.certificate.bound.access.tokens=true), Keycloak correctly rejects ordinary token grants when no client certificate is presented. However, the Standard Token Exchange V2 grant path (StandardTokenExchangeProvider) does not apply the same enforcement. An attacker who holds the client's credentials and a valid subject token whose audience includes that client can submit a token exchange request without a TLS client certificate. The exchange succeeds and returns an active Bearer access token with no cnf.x5t#S256 claim, bypassing the configured sender-constraint entirely.

The root cause is that StandardTokenExchangeProvider constructs its response directly via tokenManager.responseBuilder(...) rather than through OAuth2GrantTypeBase.createTokenResponseBuilder. It never invokes checkAndBindMtlsHoKToken or an equivalent mandatory certificate check. A transient mTLS protocol mapper is added when the client has the holder-of-key setting enabled, but this mapper only handles the success case — when no certificate is present, bindTokenWithClientCertificate returns null and the mapper silently returns the token unchanged. There is no post-generation enforcement to reject the unconstrained token before it is returned.

This issue covers the Standard Token Exchange V2 path. A related bypass in the UMA grant path was addressed in #1166.

Version

26.7.4

Expected behavior

When tls.client.certificate.bound.access.tokens=true is configured on a client, a Standard Token Exchange V2 request submitted without a TLS client certificate should be rejected with 400 invalid_request, consistent with the behavior of all other grant types.

Actual behavior

The token exchange request succeeds and returns an active Bearer access token with no cnf.x5t#S256 claim. The token is accepted as active by Keycloak's introspection endpoint, effectively bypassing the mTLS sender-constraint configured on the client.


This issue was originally tracked in the private repository. Migrated by @abstractj.

Activity

  1. added
    priority/important
    kind/cve
    area/token-exchange/standard
    on Sep 25, 2026
  2. added theissue type on Sep 25, 2026
  3. changed the title [-][CVE-2026-97846] Standard Token Exchange bypasses required mTLS certificate binding and issues an active bearer token when no client certificate is supplied — #YWH-PGM40475-284[/-] [+][CVE-2026-97846] Standard Token Exchange bypasses required mTLS certificate binding and issues an active bearer token when no client certificate is supplied[/+] on Sep 25, 2026
  4. self-assigned this
    on Sep 25, 2026
  5. added a commit that references this issue on Sep 28, 2026
    cfa31ef
  6. added
    severity/medium
    on Sep 30, 2026
  7. 7 remaining items

  8. added a commit that references this issue on Oct 8, 2026
    4a720a8
  9. added a commit that references this issue on Oct 12, 2026
    6992882
  10. added 2 commits that reference this issue on Oct 22, 2026
    fae14d3
    05ffab1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/token-exchange/standardkind/cvepriority/importantrelease/26.6.8release/26.8.1release/27.0.0severity/mediumteam/cloud-nativeteam/communityteam/continuous-deliveryteam/core-authnteam/core-clientsteam/core-iamteam/core-protocolsteam/core-sharedteam/production-readiness

Type

Fields

No fields configured for cve.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions