DEV Community

kozhevniko
kozhevniko

Posted on

Keycloak Operator Copied Proxy Credentials into Plain Environment Values

Keycloak Operator Copied Proxy Credentials into Plain Environment Values

The Red Hat Build of Keycloak Operator can resolve proxy settings from a Kubernetes Secret. A flaw tracked as CVE-2026-137944 caused the operator to copy the resolved HTTP_PROXY, HTTPS_PROXY, or NO_PROXY value into the Keycloak operand StatefulSet as a literal environment variable. If the proxy URL contained authentication, the password could appear in the pod specification rather than remain behind a Secret reference.

Red Hat rates the issue Low and assigns CVSSv3.1 4.3. The reported precondition is specific: the operator runs with proxy authentication in one of those variables, the value comes from a platform-resolved Secret, and a user with enough access can inspect the operand StatefulSet. The vulnerability is a disclosure of credentials already present in the deployment environment.

Kubernetes secrets can leak after resolution

A Secret protects the stored object only while controllers and consumers reference it correctly. If a controller resolves a value and writes the clear text into another object, the new object becomes a second security boundary. Kubernetes users with read access to StatefulSets may not have direct access to the original Secret, yet they can see the copied value.

That is why the small CVSS score can still warrant action. A proxy password may be reused by egress gateways, package mirrors, or an enterprise network service. It can also expose the proxy endpoint and naming convention used by the cluster. The impact depends on the credential's scope and the RBAC around workload objects.

The advisory does not describe a direct authentication bypass in Keycloak. It describes credential exposure through operator-generated configuration. Defenders should keep that distinction when assessing logs and access requests.

Find the literal before rotating

Inspect Keycloak operand StatefulSets for environment variables whose values contain a proxy URL with user information. Do not print the full secret in a ticket. Record the namespace, workload, variable name, and whether the value is a literal or a reference. Compare the operator inventory with the clusters that use authenticated egress proxies.

Review Kubernetes audit logs for reads of StatefulSet specs and for subjects whose RBAC should not include workload inspection. The exposure may have existed for months. Rotate the proxy credential after the deployment is changed, then update every consumer that shares it. Removing the copied value without rotation leaves the previously exposed password valid.

Apply the fixed Red Hat Build of Keycloak Operator release identified in the vendor errata. If no immediate upgrade is possible, remove proxy authentication from values that the operator propagates and require the workload to obtain the credential through a supported Secret reference. Restrict get and list access to StatefulSets in the Keycloak namespace.

Validate the change

After remediation, inspect a newly reconciled StatefulSet. The proxy variable should not contain a clear-text password. The Keycloak pod should still reach the required external services. Check operator logs for reconciliation errors without copying secret values into the logs.

Rotate credentials and invalidate old proxy sessions where the gateway supports it. For high-value clusters, add a policy check that rejects workload environment values containing URL userinfo. This control catches future controllers or manual manifests that repeat the same mistake.

References

Top comments (0)