CVE-2026-137435: Keycloak-services: keycloak-services: case-distinct saml nameid allows authentication as another account
A flaw was found in the SAML identity brokering component of Keycloak. When Keycloak is configured to use a database with case-insensitive collation, it may incorrectly match a SAML subject name to an existing user account if the names differ only by case. This issue allows an attacker to log in as a different user by providing a case-distinct version of a victim's username in a signed SAML assertion, leading to unauthorized account access.
Other sources
A vulnerability was found in Keycloak where the SAML identity provider brokering mechanism fails to perform a case-sensitive validation of the asserted subject. When a realm brokers logins from a SAML identity provider, Keycloak looks up the federated identity link using a plain database equality query against the FEDERATEDUSERID column. If the underlying database uses a case-insensitive collation, a signed SAML assertion containing a subject that differs only in case (e.g., Alice vs alice) will resolve to the same federated identity link. Keycloak does not perform a secondary case-sensitive check on the returned value. An attacker can exploit this to obtain a valid access token for a victim's account, effectively bypassing authentication for the intended user.
— Red Hat
Affected Software
Event History
Frequently Asked Questions
Which deployments are affected?
The issue applies to realms that broker logins from a SAML identity provider and use a database with case-insensitive collation. The federated identity lookup against the FEDERATED_USER_ID column can then treat names differing only by case as equal.
What does an attacker need to exploit this?
An attacker needs to provide a signed SAML assertion whose subject is a case-distinct variant of a victim's username, such as "Alice" instead of "alice."
What is the impact of successful exploitation?
The attacker can obtain a valid access token for the victim's account and access that account without authenticating as the victim.