Bug 2540960 (CVE-2026-97848)

Summary: CVE-2026-97848 keycloak-services: keycloak-services: Protocol mapper with jsonType=JSON bypasses token sanitization
Product: [Other] Security Response Reporter: OSIDB Bzimport <bzimport>
Component: vulnerabilityAssignee: Product Security <prodsec-ir-bot>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: aschwart, aszczucz, boliveir, drichtar, mposolda, pjindal, rmartinc, security-response-team, ssilvert, sthorger, vmuzikar
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
A flaw was found in the token sanitization logic of Keycloak, an open source identity and access management solution. The issue occurs when a protocol mapper is configured to emit structured claims using the JSON type. The security check designed to remove unauthorized role mappings only looks for standard Java maps and fails to recognize Jackson based JSON objects. This allows an attacker to inject forged client roles into security tokens, which could lead to unauthorized access to protected resources.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Deadline: 2026-11-23   

Description OSIDB Bzimport 2026-09-25 06:25:05 UTC
A flaw was found in Keycloaks token sanitization mechanism, which was originally implemented to prevent role forgery. The sanitizer responsible for removing unauthorized resource access claims from tokens only performs a type check for java.util.Map. When a protocol mapper is configured with jsonType=JSON, the resulting value is a Jackson ObjectNode, which bypasses this specific type check.
An attacker with client registration privileges or a valid Initial Access Token can exploit this by registering a client with a protocol mapper targeting the resource access claim. By setting the mapper to use the JSON type, the attacker can inject arbitrary client roles into the issued tokens. Successful exploitation allows an attacker to forge administrative roles, which are then accepted by resource servers or relying parties that perform authorization based on the resource access claim.