CVE-2026-9704 PUBLISHED

Keycloak: keycloak: privilege escalation due to oversized subject_token jwt

Assigner: redhat
Reserved: 27.05.2026 Published: 27.05.2026 Updated: 27.05.2026

A flaw was found in Keycloak. An authenticated user with low privileges can exploit this vulnerability by sending an oversized subject_token JSON Web Token (JWT) to the TokenEndpoint. When the token exceeds a 4000-character limit, it is silently dropped, causing the system to fall back to client credentials. This allows the user to gain the permissions of the client's service account, leading to privilege escalation.

Metrics

CVSS Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
CVSS Score: 6.8

Product Status

Vendor Red Hat
Product Red Hat Build of Keycloak
Versions Default: affected

Workarounds

To prevent the silent dropping of oversized subject_token JWTs, configure Keycloak to enforce strict parameter validation. This involves setting the fail-fast parameter to true for the TokenEndpoint configuration, which will cause requests with oversized parameters to be rejected explicitly rather than silently processed with reduced privileges. Consult Keycloak documentation for the exact method to modify these settings. A restart of the Keycloak service may be necessary for the changes to apply.

Credits

  • Red Hat would like to thank Filip Jovanov (PegasusMKD) for reporting this issue.

References

Problem Types

  • Improper Validation of Specified Quantity in Input CWE