/

CVE-2026-46389

Severity:

CRITICAL RISK

(10.0)

Broken Client Authentication Logic (CWE-287) in UDS Identity Config Keycloak Authenticator

CVE-2026-46389

Analyzed

Vulnerability type

Category:

Authentication Bypass

CWE:

CWE-287, CWE-303

Impact:

Full client impersonation and token issuance without knowledge of the real client secret

Severity:

CRITICAL RISK

(10.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A logic flaw in the client-kubernetes-secret Keycloak client authenticator used by UDS Identity Config causes the provided client_secret to be overwritten with the mounted Kubernetes secret before it is checked.

As a result, any client_secret value is accepted for affected clients, allowing an attacker who can reach the Keycloak token endpoint and knows a valid client_id to obtain OAuth2 tokens scoped to that client's service account.

Affected context

This vulnerability affects environments where:

  • UDS Identity Config versions 0.11.0 through 0.26.0 are used to build Keycloak configuration images, and
  • The client-kubernetes-secret Keycloak client authenticator is configured for one or more clients, and
  • Keycloak's token endpoint is reachable from attacker-controlled network paths (e.g., internal networks, shared clusters, or exposed management APIs).

The issue manifests specifically during OAuth2 client authentication using client credentials: the authenticator fetches the Kubernetes-mounted secret and overwrites the user-submitted client_secret before performing the comparison, effectively disabling secret-based verification.

Exploit preconditions

  • Attack surface: Keycloak token endpoint (e.g., /realms/<realm>/protocol/openid-connect/token) that uses the client-kubernetes-secret authenticator.
  • Required access:
  • Network reachability to the Keycloak token endpoint, and
  • Knowledge of a valid client_id configured to use the vulnerable authenticator.
  • Authentication state: No prior authentication is required; the vulnerability affects the initial client authentication step using client credentials.
  • Trigger point: Any OAuth2 client-credentials flow (or similar) where the client sends its client_id and client_secret to obtain a token.
  • Why exploitation is possible: The authenticator overwrites the supplied client_secret with the Kubernetes-mounted secret value before comparison, so the equality check is always true regardless of the caller's input. This nullifies the secret as a proof-of-possession credential and results in an effective authentication bypass.

Why this happens

The underlying issue is a logic error in the authentication flow for the client-kubernetes-secret authenticator, mapping primarily to CWE-287: Improper Authentication and related to CWE-303: Incorrect Implementation of Authentication Algorithm.

Instead of comparing the caller-supplied client_secret to the expected secret loaded from a Kubernetes-mounted secret, the implementation first loads the expected secret and then incorrectly assigns it into the variable representing the submitted secret, overwriting the attacker-controlled value. The subsequent comparison therefore checks the secret against itself and always succeeds.

At an abstract level, this represents an authentication implementation that:

  • Fails to preserve the distinction between untrusted input and trusted reference data during verification.
  • Treats the expected credential as both sides of the equality check, eliminating any real proof-of-knowledge requirement.

This pattern is common in custom authentication mechanisms that manipulate state in-place, reuse variables incorrectly, or mix responsibilities of "input" versus "stored" values in the same abstraction.

Potential impact

  • An attacker can impersonate any affected OAuth2 client that uses the client-kubernetes-secret authenticator.
  • OAuth2 access tokens and refresh tokens may be obtained without knowledge of the true client secret.
  • For high-privilege clients (such as uds-operator), attackers may be able to register, modify, or delete other clients and their configurations.
  • Misuse of service accounts associated with compromised clients, potentially allowing access to protected APIs, data, or administrative operations.
  • Escalation of privileges within the identity and service ecosystem, potentially leading to broader compromise across dependent services.

General mitigation guidance

Effective mitigation focuses on hardening client authentication flows and reducing trust in single secrets as the sole gate:

  • Use well-tested authenticators: Prefer built-in, battle-tested client authentication mechanisms provided by the identity platform over custom or extension logic whenever possible.
  • Isolate trusted and untrusted values: Ensure that code handling authentication clearly separates the caller's input (untrusted) from stored secrets or Kubernetes-mounted credentials (trusted), and never reuses the same variable or structure for both.
  • Fail closed on validation: Design authentication checks so that any unexpected state, missing secret, or mismatch results in a denial, not a fallback to success or default acceptance.
  • Apply least privilege to clients: Scope each client's permissions, roles, and service account to the minimal set required to function, reducing impact if a client is impersonated.
  • Restrict network exposure: Limit access to the Keycloak token endpoint to only the services and networks that require it (e.g., via ingress policies, service meshes, or firewall rules).
  • Use defense in depth for sensitive clients: For highly privileged clients, consider multi-factor trust (e.g., mTLS between services, IP-based restrictions, or additional policy checks) rather than relying solely on shared secrets.

How teams detect issues like this

Detecting this class of authentication weaknesses involves both code-level analysis and runtime monitoring:

  • Static analysis and code review:
  • Search for custom Keycloak authenticators or extensions that perform client credential verification.
  • Flag patterns where:
  • The same variable is used for both user input and stored secrets, or
  • The stored secret is assigned into the parameter or request object before comparison.
  • Review logic around equality checks to ensure one side is always the unmodified request input and the other side is the reference secret.
  • Incorporate secure coding guidelines and linters focused on authentication flows and trust boundaries.
  • Configuration review:
  • Enumerate all clients using non-default or custom authenticators such as client-kubernetes-secret.
  • Focus manual review on those authenticators' implementations and bindings.
  • Runtime and log-based detection:
  • Monitor for unusual token issuance patterns, such as:
  • Tokens being requested for high-privilege clients from unexpected IP ranges or services.
  • Sudden spikes in token requests for a single client.
  • Enable detailed authentication logging in Keycloak and analyze for consistent acceptance of incorrect or malformed client credential patterns.
  • Security testing pipelines:
  • Integrate automated API tests to validate that incorrect client secrets are rejected for each client type.
  • Use automated tools to fuzz client authentication endpoints with invalid secrets and observe acceptance rates.

Sources

SourceLink
github.comgithub.com/defenseunicorns/uds-identity-config/releases/tag/v0.26.1
github.comgithub.com/defenseunicorns/uds-identity-config/security/advisories/GHSA-8mg2-6588-r4hw

Frequently asked

questions

Yes, if the Keycloak token endpoint is reachable from the attacker's network location and at least one client uses the vulnerable client-kubernetes-secret authenticator. No prior credentials are required beyond knowledge of a valid client_id.

The attacker needs:

  • Network access to the Keycloak token endpoint, and
  • Knowledge of a target client_id configured to use the vulnerable authenticator.

They do not need the real client_secret or any existing user or admin account.

The safest fix is to ensure that authentication logic strictly compares the unaltered, user-supplied secret to a separately stored, trusted secret, and fails closed on any mismatch or unexpected state. Using well-reviewed, standard authenticators instead of bespoke logic significantly reduces the risk of such logic flaws.

Preventive measures include:

  • Adopting secure coding standards for authentication flows, emphasizing separation of untrusted input from stored secrets.
  • Performing rigorous code reviews and security testing on any custom identity provider extensions or authenticators.
  • Incorporating static analysis and CI checks that flag suspicious credential-handling patterns.
  • Minimizing the use of custom authentication components and relying on the identity provider's built-in mechanisms wherever possible.
Find out what's already
exploitable in your codebase.