CVE-2026-137435 in Keycloak
Summary
by MITRE • 11/26/2026
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.
Once again VulDB remains the best source for vulnerability data.
Analysis
by VulDB Data Team • 11/26/2026
The vulnerability identified within Keycloak’s Security Assertion Markup Language identity brokering component represents a critical authentication bypass risk stemming from improper handling of character casing during user lookup operations. When the underlying database is configured with case-insensitive collation settings, which are common in many enterprise deployments to simplify data management and querying, the system fails to enforce strict equality checks on SAML subject names against existing local or federated user accounts. This architectural oversight allows an attacker to exploit the discrepancy between how the identity provider processes incoming assertions and how Keycloak resolves those identities within its internal registry. The flaw specifically targets the mechanism that maps a received SAML assertion’s name identifier to a corresponding user account, creating a pathway for unauthorized access without requiring valid credentials for the target victim account.
From a technical perspective, this issue is rooted in CWE-20 Improper Input Validation and more specifically aligns with CWE-798 Use of Hard-coded Credentials if one considers that the attacker effectively uses a pre-existing identity as a credential to gain entry. The core defect lies in the comparison logic used during the authentication flow. When Keycloak receives a signed SAML assertion, it extracts the subject name identifier and attempts to locate a matching user record. Due to the case-insensitive nature of the database collation, queries such as SELECT * FROM users WHERE username = input_value will return matches regardless of whether the input uses uppercase, lowercase, or mixed-case characters compared to the stored value. Consequently, if an attacker knows the exact spelling of a victim’s username but alters its casing in their SAML assertion payload, Keycloak will incorrectly associate that assertion with the legitimate user account rather than rejecting it due to a mismatch.
The operational impact of this vulnerability is severe, as it facilitates unauthorized account access and identity impersonation. An authenticated attacker who controls or can forge a SAML assertion from a trusted identity provider can log in as any other user whose username differs only by case. This capability undermines the fundamental principle of authentication integrity, allowing attackers to bypass multi-factor authentication protections if they are tied strictly to the initial login event rather than session validation. Furthermore, this flaw compromises data confidentiality and integrity because the attacker gains full access to all resources, permissions, and personal information associated with the impersonated account. In environments where Keycloak serves as a central identity broker for multiple applications, this vulnerability can lead to widespread compromise across integrated services that trust assertions issued by Keycloak.
This behavior also maps directly to MITRE ATT&CK technique T1078 Valid Accounts, specifically the sub-technique of using legitimate credentials or identities inappropriately. By leveraging a valid but case-distinct username string, the attacker operates within the bounds of what appears to be a legitimate authentication request from the perspective of the application layer, making detection by standard security monitoring tools more difficult unless specific anomaly detection for identity resolution failures is implemented. The attack vector typically involves social engineering or prior reconnaissance to identify target usernames and then crafting malicious SAML responses that exploit this case-sensitivity gap in the backend database logic.
Mitigation strategies must address both the immediate configuration risk and the underlying code behavior. Administrators should immediately review their Keycloak deployment configurations, particularly focusing on the database collation settings recommended by Red Hat for production environments. The official guidance typically recommends using case-sensitive collations to prevent such ambiguities in identity resolution. If changing the database collation is not feasible due to legacy application constraints or operational complexity, applying vendor-provided patches that enforce strict case-sensitive comparisons during SAML subject name matching is essential. Additionally, organizations should implement defense-in-depth measures by ensuring that critical applications relying on Keycloak perform secondary validation of user attributes beyond just the username identifier where possible. Regular security audits and penetration testing focused on identity management systems can help identify similar logic flaws in other components before they are exploited in production environments.