Keycloak ModStor Service: EnvVar Injection via Realm Import
CVE-2025-9162 Published on August 21, 2025
Org.keycloak/keycloak-model-storage-service: variable injection into environment variables
A flaw was found in org.keycloak/keycloak-model-storage-service. The KeycloakRealmImport custom resource substitutes placeholders within imported realm documents, potentially referencing environment variables. This substitution process
allows for injection attacks when crafted realm documents are processed. An attacker can leverage this to inject malicious content during the realm import procedure. This can lead to unintended consequences within the Keycloak environment.
Vulnerability Analysis
CVE-2025-9162 is exploitable with network access, and requires user privileges. This vulnerability is considered to have a low attack complexity. The potential impact of an exploit of this vulnerability is considered to have a high impact on confidentiality, with no impact on integrity and availability.
Timeline
Reported to Red Hat.
Made public.
Weakness Type
Exposure of Sensitive Information Through Environmental Variables
Environmental variables may contain sensitive information about a remote server.
Products Associated with CVE-2025-9162
Want to know whenever a new CVE is published for Red Hat Build Keycloak? stack.watch will email you.
Affected Versions
keycloak:- Before 26.3.4 is affected.
- Version 26.0.15-1 and below * is unaffected.
- Version 26.0-18 and below * is unaffected.
- Version 26.0-19 and below * is unaffected.
- Version 26.2.8-1 and below * is unaffected.
- Version 26.2-8 and below * is unaffected.
- Version 26.2-8 and below * is unaffected.
- Version 26.2.9-1 and below * is unaffected.
- Version 26.2-9 and below * is unaffected.
- Version 26.2-9 and below * is unaffected.
Vulnerable Packages
The following package name and versions may be associated with CVE-2025-9162
| Package Manager | Vulnerable Package | Versions | Fixed In |
|---|---|---|---|
| maven | org.keycloak:keycloak-model-storage-services | < 26.2.9 | 26.2.9 |
| maven | org.keycloak:keycloak-model-storage-services | >= 26.3.0, < 26.3.4 | 26.3.4 |
Exploit Probability
EPSS (Exploit Prediction Scoring System) scores estimate the probability that a vulnerability will be exploited in the wild within the next 30 days. The percentile shows you how this score compares to all other vulnerabilities.