CVE-2026-142136: Keycloak-operator: keycloak-operator: plaintext credentials exposure in keycloakrealmimport custom resource
A flaw was found in the Keycloak Operator, which is used to manage Keycloak instances on Kubernetes and OpenShift. The issue occurs because the documentation and default behavior encourage users to include sensitive information, such as client secrets and private keys, directly within the KeycloakRealmImport custom resource. Because these resources are not treated as protected secrets by Kubernetes, an attacker with basic read permissions for the custom resource can recover this sensitive material, potentially leading to full compromise of the Keycloak realm.
Other sources
A flaw was found in the Keycloak Operator. The vulnerability exists because the KeycloakRealmImport custom resource (CR) allows sensitive realm export data, including client secrets, key-provider secrets, and private keys, to be stored in plaintext within the spec.realm field. In a standard Kubernetes environment, access to Secret objects is strictly controlled; however, permissions to read custom resources are often delegated separately. An attacker with namespaced get permission on keycloakrealmimports.k8s.keycloak.org can retrieve the full CR content, bypassing the lack of access to Kubernetes Secrets. Successful exploitation allows an attacker to recover active reusable client credentials and realm signing or encryption keys, enabling them to impersonate clients, decrypt sensitive data, or gain unauthorized administrative access to the Keycloak realm.
— Red Hat
Affected Software
Event History
Frequently Asked Questions
Who is exposed to this issue?
Clusters are exposed when KeycloakRealmImport resources contain sensitive realm-export data and users or workloads have namespaced read access to keycloakrealmimports.k8s.keycloak.org. This can affect readers that are not permitted to read Kubernetes Secret objects.
What access does an attacker need?
An attacker needs namespaced get permission on keycloakrealmimports.k8s.keycloak.org. No access to Kubernetes Secrets is required if the sensitive material is present in the custom resource.
How can I determine whether sensitive data is exposed?
Review KeycloakRealmImport resources and check the spec.realm field for client secrets, key-provider secrets, or private keys. Any such values stored there can be retrieved by principals allowed to read the resource.
Does this depend on an unusual configuration?
No unusual custom-resource configuration is indicated. The documented and default behavior encourages placing sensitive information directly in the KeycloakRealmImport custom resource, where it is stored as plaintext.