Abstract
Kubernetes Operators, automated tools designed to manage application lifecycles within Kubernetes clusters, extend the functionalities of Kubernetes and reduce the operational burden on human engineers. While Operators significantly simplify DevOps workflows, they introduce new security risks. In particular, Kubernetes enforces namespace isolation to separate workloads and limit user access, ensuring that users can only interact with resources within their authorized namespaces. However, Kubernetes Operators often demand elevated privileges and may interact with resources across multiple namespaces. This introduces a new class of vulnerabilities: the Cross-Namespace Reference Vulnerability. The root cause lies in the mismatch between the declared scope of resources and the implemented scope of the Operator logic, resulting in Kubernetes being unable to properly isolate the namespace. Leveraging such a vulnerability, an adversary with limited access to a single authorized namespace may exploit the Operator to perform operations affecting other unauthorized namespaces, causing Privilege Escalation and further impacts. This paper systematically investigates Kubernetes Operator attacks, presenting two strategies for bypassing namespace isolation. Through large-scale measurements of over 2,200 Operators, we found that over 14% are potentially vulnerable, resulting in 7 CVEs affecting major vendors like Red Hat and NVIDIA.
Introduction: The Confused Deputy in the Cluster
In a multi-tenant Kubernetes cluster, namespaces serve as the primary "bulkhead" for isolation. Ideally, a user restricted to Namespace A should never be able to access or modify resources in Namespace B. To automate complex management tasks, developers deploy Operators—software extensions that monitor specific resources and execute logic to maintain a desired state.
However, because Operators often require cluster-wide permissions to function, they can inadvertently act as a "confused deputy." If an Operator's logic fails to validate the scope of the resources it references, a low-privileged attacker can trick the Operator into accessing sensitive data (like Secrets) or modifying configurations in a victim's namespace.
Vulnerability Mechanics
The research identifies two primary tactics for exploiting these vulnerabilities:
- Insecure Namespace-Scoped Resource Reference: An attacker creates a resource in their own namespace that contains a reference to a resource (e.g., a Secret) in a target namespace. If the Operator reconciles this resource without checking the user's permissions for the target namespace, it will use its own elevated privileges to fetch the secret.
- Insecure Cluster-Scoped Resource Reference: An attacker uses a local resource to trigger the creation or modification of cluster-wide resources, such as
ClusterRoleBindings, effectively escalating their privileges across the entire cluster.
The root cause is a scope mismatch: while Kubernetes treats the initial resource as restricted to one namespace, the Operator's logic treats it as a pointer to any resource in the cluster.
Methodology: Large-Scale Static Analysis
To quantify this threat, the authors developed a custom static analysis suite using CodeQL. They modeled five major Kubernetes Go libraries (including client-go and controller-runtime) to perform interprocedural taint tracking. The tool identifies "sources"—fields in namespace-scoped resources that an attacker can control—and tracks if that data flows into "sinks," which are the namespace parameters of sensitive API calls.
The analysis was performed on a dataset of 2,268 open-source Kubernetes Operators crawled from GitHub. To ensure accuracy, the authors manually validated a subset of results, finding a high precision rate with very few false positives.
Evaluation and Real-World Impact
The findings reveal a systemic security gap in the Kubernetes ecosystem:
- Prevalence: 318 Operators (14.0%) were flagged as potentially vulnerable.
- Critical Impact: The study led to 8 confirmed vulnerabilities and 7 CVEs in products from industry leaders such as Red Hat, NVIDIA, Kong, and Grafana.
- Common Targets: Secrets were the most frequently targeted resource (102 cases), followed by Namespaces and ClusterRoleBindings.
Mitigation and Conclusion
Fixing every individual Operator is a daunting task. Instead, the authors propose a more scalable defense: a Validating Admission Webhook. This interceptor acts as a gatekeeper, checking if the user who created the initial request actually possesses the RBAC permissions required for the referenced resource before the Operator processes it. Testing showed this mitigation successfully blocks attacks with a negligible average latency increase of only 4.1ms.
This research underscores that while Operators simplify DevOps, they introduce a significant and often overlooked attack surface. Developers must be vigilant in ensuring that their "automated engineers" do not inadvertently punch holes in the very isolation boundaries Kubernetes is designed to maintain.
Summary updated