Repository navigation
Description
Describe the bug
A stored cross-site scripting (XSS) vulnerability exists in Keycloak's login theme rendering. A realm administrator with the manage-realm permission can store malicious HTML in realm display fields (such as displayNameHtml). This content is rendered on the pre-authentication login page and can execute arbitrary JavaScript in the browser of any user who visits that realm's login page, without requiring additional interaction beyond loading the page. The vulnerability stems from the HTML sanitization pipeline used to process admin-supplied HTML: the kcSanitize filter leaves certain numeric character references inert, but the subsequent fixURLs() post-processor restores the & encoding back to &, re-activating those references before the browser parses them. A no-click variant also affects the WebAuthn error page.
Version
26.1.3 to 26.8.0
Expected behavior
Admin-supplied HTML stored in realm display fields (such as displayNameHtml) is sanitized such that no JavaScript can execute when the login page is rendered, regardless of the encoding or formatting of the stored value. The sanitization result should be stable and consistent with what the browser ultimately interprets.
Actual behavior
Admin-supplied HTML containing a crafted JavaScript URL passes through the sanitization step (kcSanitize) and is re-activated by the fixURLs() post-processor, resulting in executable script being rendered on the login page for all users in the realm.
This issue was originally tracked in the private repository. Migrated by @abstractj.
Metadata
Metadata
Assignees
Labels
Type
Fields
Projects
- StatusShow more project fieldsDone
Activity
[-][CVE-2026-107889] Responsible disclosure - stored XSS on the login page via kcSanitize bypass (PoC attached)[/-][+][CVE-2026-107889] Stored XSS on the login page via kcSanitize bypass[/+]prevent kcSanitize from re-activating disallowed URL schemes after li…
prevent kcSanitize from re-activating disallowed URL schemes after li…
4 remaining items
mabartos commentedon Oct 14, 2026
@michalvavrik Could you please create backports for 26.6 and 26.8? Thanks!
[26.8] prevent kcSanitize from re-activating disallowed URL schemes a…
[26.6] prevent kcSanitize from re-activating disallowed URL schemes a…
michalvavrik commentedon Oct 14, 2026
don't worry, I didn't forget, please find linked PRs and get reviews and merge; thanks for the ping
[26.6] prevent kcSanitize from re-activating disallowed URL schemes a…
prevent kcSanitize from re-activating disallowed URL schemes after li…
prevent kcSanitize from re-activating disallowed URL schemes after li…