
Cloud Vulnerability DB
A community-led vulnerabilities database
CVE-2025-9162 is a variable injection vulnerability in org.keycloak/keycloak-model-storage-services that allows a highly privileged attacker to expose sensitive environment variables — such as database passwords — by crafting malicious realm import documents. The KeycloakRealmImport custom resource substitutes placeholders within imported realm documents that can reference environment variables, enabling injection of sensitive data into the Keycloak environment. Affected versions are keycloak-model-storage-services < 26.2.9 and >= 26.3.0, < 26.3.4. The vulnerability was reported on August 19, 2025, and publicly disclosed on August 21, 2025, with patches released in September–October 2025. It carries a CVSS v3.1 base score of 4.9 (Medium) (Red Hat CVE, Github Advisory).
The root cause is classified as CWE-526 (Cleartext Storage of Sensitive Information in an Environment Variable). The vulnerable code resides in AbstractFileBasedImportProvider.java, where placeholder substitution during realm import can resolve environment variable references embedded in a crafted realm document (Red Hat Bugzilla, Github Advisory). An attacker with administrative (high-privilege) network access can supply a specially crafted realm document containing environment variable references (e.g., referencing $DB_PASSWORD), which are then substituted and potentially exposed in the imported realm configuration. No user interaction is required, and the attack complexity is low, but exploitation is gated by the requirement for high privileges.
Successful exploitation results in a high confidentiality impact — specifically, the exposure of sensitive environment variables such as database credentials or other secrets accessible to the Keycloak process. There is no direct integrity or availability impact. In environments where Keycloak has access to secrets via environment variables (e.g., Kubernetes secrets mounted as env vars), this could lead to credential theft and potential lateral movement to backend databases or other integrated services (Github Advisory, Red Hat CVE).
No public proof-of-concept exploit code or in-the-wild exploitation has been reported for CVE-2025-9162. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The EPSS score is approximately 0.028–0.041%, placing it in the 13th percentile for exploitation likelihood within 30 days (Github Advisory). Exploitation requires high-privilege access (e.g., Keycloak administrator), which significantly limits the attack surface.
KeycloakRealmImport custom resources.${DB_PASSWORD} or ${SECRET_KEY}, in fields that will be stored or returned (e.g., realm attributes, client secrets, or display names).KeycloakRealmImport custom resource or the Keycloak admin API to trigger the import of the crafted realm document.KeycloakRealmImport) initiated by unexpected or unauthorized admin accounts; audit log entries for realm creation or update events with unusual timing.KeycloakRealmImport custom resource objects created in the Keycloak namespace; review of kubectl get keycloakrealmimport -n <namespace> for unrecognized entries.${VAR_NAME}) in unexpected locations.POST /admin/realms) from unexpected source IPs or service accounts (Red Hat Bugzilla).Red Hat has released patched versions addressing this vulnerability: keycloak-model-storage-services 26.2.9 and 26.3.4. For Red Hat build of Keycloak, the fixes are included in RHSA-2025:15336 (version 26.0.15), RHSA-2025:16399, and RHSA-2025:16400. Organizations should upgrade to Keycloak 26.2.9+ or 26.3.4+ as soon as possible. As a workaround, restrict administrative access to Keycloak and limit who can create or submit KeycloakRealmImport custom resources in Kubernetes/OpenShift environments (Github Advisory, RHSA-2025:15336).
Red Hat classified this vulnerability as Moderate severity and issued multiple security advisories (RHSA-2025:15336 through RHSA-2025:16400) covering both standalone and OpenShift container deployments of Keycloak. The vulnerability was credited to researcher Ankush-Pathak. Coverage has been limited to standard vulnerability aggregators and German security news outlet pro-linux.de; no significant broader community or social media discussion has been observed (RHSA-2025:15336, Github Advisory).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."