Impact
A flaw was discovered in the token sanitization logic of Keycloak, where role mappings embedded in security tokens are not properly validated when a protocol mapper emits structured claims using a JSON type. The check that removes unauthorized role mappings only targets standard Java maps and ignores Jackson based JSON objects, allowing an attacker to inject forged client roles into tokens. This flaw corresponds to CWE-20 and can enable an attacker to gain unauthorized access to protected resources by presenting a token that lists roles they do not possess.
Affected Systems
The vulnerability affects deployments of Keycloak, the open source identity and access management solution, whenever a protocol mapper is configured to output structured claims as JSON type. No specific vendor product version information is provided, so all systems using such mappers could be impacted until a patch is applied.
Risk and Exploitability
The CVSS score of 6.5 indicates a medium severity vulnerability. Because the EPSS score is not available, the likelihood of exploitation cannot be quantified directly, and the vulnerability is not listed in the CISA KEV catalog. The most likely attack vector is an attacker who has the ability to configure or modify a protocol mapper—such as through administrative access or an abuse of client registration—to inject the malicious JSON object that bypasses token sanitization. Once token sanitization is bypassed, the attacker can claim roles that are not authorized and potentially gain access to protected resources.
OpenCVE Enrichment