/

CVE-2026-22822

Severity:

HIGH RISK

(8.8)

Improper Authorization in External Secrets Operator

CVE-2026-22822

Modified

Vulnerability type

Category:

Improper Authorization

CWE:

CWE-863

Impact:

Cross-Namespace Secret Access and Privilege Escalation

Severity:

HIGH RISK

(8.8)

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

External Secrets Operator introduced a getSecretKey template function that could read Kubernetes Secrets across namespaces using the controller's roleBinding.

If an attacker can define or modify ExternalSecret resources, they may bypass namespace isolation controls and retrieve secrets from other namespaces, leading to data exposure and privilege escalation.

Affected context

This vulnerability affects Kubernetes clusters running External Secrets Operator versions starting from 0.20.2 and prior to 1.2.0 where:

  • The senhasegura Devops Secrets Management (DSM) provider is enabled or templating capabilities are available.
  • The controller has a roleBinding that allows it to read Secrets across multiple namespaces.
  • Users or automation are allowed to create or modify ExternalSecret resources with templating.

Under these conditions, the getSecretKey function can be abused to access Secrets outside the intended namespace scope, bypassing ESO's normal security safeguards.

Exploit preconditions

  • Attack surface: Kubernetes API server via ExternalSecret custom resources.
  • Required access: Ability to create, modify, or control ExternalSecret objects in any namespace where External Secrets Operator is active.
  • Trigger point: Rendering of templates that invoke the getSecretKey function by the ESO controller.
  • Why exploitation is possible: The getSecretKey function executes in the security context and RBAC scope of the external-secrets controller, not the namespace-scoped identity of the ExternalSecret resource. This breaks intended namespace isolation and fails to enforce authorization checks aligned with ESO's security model.

Why this happens

The root cause lies in an authorization design flaw where a helper function (getSecretKey) is allowed to perform secret retrieval using the elevated privileges of the External Secrets Operator controller.

Instead of enforcing namespace and policy constraints associated with the requesting ExternalSecret resource, the function uses the controller's roleBinding permissions, enabling cross-namespace secret fetches.

This maps to CWE-863: Incorrect Authorization, where the system authorizes access based on an overly privileged principal (the controller) rather than enforcing least privilege and resource-scoped policies for each request.

Potential impact

  • Unauthorized reading of Kubernetes Secrets from other namespaces.
  • Leakage of credentials, API keys, tokens, and certificates intended for isolated workloads.
  • Lateral movement by using stolen credentials to access additional services or clusters.
  • Escalation of privileges if Secrets include higher-privileged service account tokens or administrative credentials.
  • Breach of multi-tenant isolation guarantees within a shared cluster environment.

General mitigation guidance

Effective mitigation focuses on tightening authorization boundaries and removing dangerous helper abstractions:

  • Avoid using template functions that perform privileged operations on behalf of user-defined resources, especially when they can cross namespace boundaries.
  • Enforce strict namespace isolation for any component that accesses Secrets; the controller should only read Secrets in namespaces explicitly required by design.
  • Apply least-privilege RBAC for the External Secrets Operator, limiting its roleBinding to only the namespaces and Secret types it must manage.
  • Use admission control or policy engines (e.g., Kyverno, Kubewarden, OPA/Gatekeeper) to deny ExternalSecret specs that reference disallowed template functions or patterns capable of bypassing safeguards.
  • Prefer explicit, declarative mappings from external secret stores to Kubernetes Secrets instead of flexible templating that can trigger privileged operations.

How teams detect issues like this

Detection typically relies on a combination of configuration review and runtime policy enforcement:

  • Scan ExternalSecret manifests (in Git repos or via the Kubernetes API) for usage of the getSecretKey function and similar high-privilege template helpers.
  • Use admission controllers or policy engines to log (and optionally block) ExternalSecret resources that contain suspicious templating constructs or cross-namespace references.
  • Review RBAC bindings for the External Secrets Operator to identify controllers with cluster-wide or broad namespace-wide Secret read permissions.
  • Employ configuration and policy-as-code scanning in CI/CD to flag ESO configurations that break namespace isolation or grant excessive privileges to the controller.

Sources

SourceLink
github.comgithub.com/external-secrets/external-secrets/commit/17d3e22b8d3fbe339faf8515a95ec06ec92b1feb
github.comgithub.com/external-secrets/external-secrets/issues/5690
github.comgithub.com/external-secrets/external-secrets/pull/3895
github.comgithub.com/external-secrets/external-secrets/releases/tag/v1.2.0
github.comgithub.com/external-secrets/external-secrets/security/advisories/GHSA-77v3-r3jw-j2v2
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-22822
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2431873
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-22822.json

Frequently asked

questions

It can be, if an attacker can interact with the Kubernetes API server—for example via a compromised workload, CI pipeline, or user account—and create or modify ExternalSecret resources. The actual data exfiltration occurs through the cluster's control plane, not from a public network endpoint.

The attacker must be able to define or update ExternalSecret objects in a namespace where External Secrets Operator runs. They do not need direct access to other namespaces' Secrets; the vulnerability leverages the controller's elevated roleBinding.

Remove or disable template functions that operate with elevated controller privileges, and ensure any remaining helper functions enforce strict namespace and policy constraints. Combine this with least-privilege RBAC for the operator so it cannot read Secrets beyond its intended scope.

When designing operators and controllers, avoid exposing templating or helper APIs that can execute in a privileged context on behalf of arbitrary user-defined resources. Apply threat modeling for RBAC and multi-tenancy, enforce namespace-scoped access checks, and use policy engines in both CI and admission control to stop configurations that would bypass intended security safeguards.

Find out what's already
exploitable in your codebase.