---
id: "CVE-2026-37980"
kind: "vulnerability"
aliases: ["CVE-2026-37980", "GHSA-m32f-8vh9-2hh3"]
title: "Keycloak: Arbitrary code execution via Stored Cross-Site Scripting (XSS) in organization selection login page"
severity: "medium"
cvss: 6.900000095367432
epss: 0.003819999983534217
exploited: false
status: "open"
category: "package"
products: [{"name": "org.keycloak:keycloak-services", "fixed": [], "affected": "<= 26.5.5", "ecosystem": "maven"}, {"name": "redhat build of keycloak", "fixed": [], "affected": "", "ecosystem": "vendor"}]
ecosystems: ["maven", "vendor"]
tags: ["cwe-79", "java", "keycloak", "maven", "package", "self-hosted"]
not_affected_if: ["no-organizations-in-use", "version-above-26.5.5"]
published_at: "2026-04-14T15:16:34+00:00"
first_seen_at: "2026-10-23T19:11:31+00:00"
updated_at: "2026-10-23T23:44:52+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-m32f-8vh9-2hh3", "first_seen_at": "2026-10-23T19:11:31+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-37980", "first_seen_at": "2026-10-23T23:44:52+00:00"}]
---

# Keycloak: Arbitrary code execution via Stored Cross-Site Scripting (XSS) in organization selection login page

Keycloak's organization selection login page puts the organization alias into an inline JavaScript onclick handler without escaping it. An attacker with manage-realm or manage-organizations rights can store a script in the alias that runs in the browser of every user who opens that login page, enabling session theft and account actions.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- maven:org.keycloak:keycloak-services affected <= 26.5.5 fixed ?
- vendor:redhat build of keycloak affected ? fixed ?

## How to check

Look for organizations in the admin console whose alias contains quotes, angle brackets or script text; unknown whether a version check command is given by the sources.

## Fix

Upgrade keycloak-services to a release newer than 26.5.5; the fixed version is not stated in the sources.
Until then, restrict manage-realm and manage-organizations to trusted admins and review existing organization aliases.

## Timeline

- 2026-10-23T19:11:31+00:00 ghsa https://github.com/advisories/GHSA-m32f-8vh9-2hh3
- 2026-10-23T23:44:52+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-37980

## From the sources

A flaw was found in Keycloak, specifically in the organization selection login page. A remote attacker with `manage-realm` or `manage-organizations` administrative privileges can exploit a Stored Cross-Site Scripting (XSS) vulnerability. This flaw occurs because the `organization.alias` is placed into an inline JavaScript `onclick` handler, allowing a crafted JavaScript payload to execute in a user's browser when they view the login page. Successful exploitation enables arbitrary JavaScript execution, potentially leading to session theft, unauthorized account actions, or further attacks against users of the affected realm.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
