Kyverno SSRF Vulnerability in CEL HTTP Library
A Server-Side Request Forgery (SSRF) vulnerability in Kyverno's CEL HTTP library allows users with namespace-scoped policy creation permissions to make arbitrary HTTP requests, enabling unauthorized access to internal services, cloud metadata endpoints, and data exfiltration.
A Server-Side Request Forgery (SSRF) vulnerability has been identified in Kyverno’s CEL HTTP library (pkg/cel/libs/http/), affecting versions >= 1.16.0. This flaw allows users with permissions to create namespace-scoped policies to bypass intended restrictions and make arbitrary HTTP requests from the Kyverno admission controller. This can lead to unauthorized access to internal Kubernetes services in other namespaces, cloud metadata endpoints such as 169.254.169.254 (allowing credential theft), and the exfiltration of sensitive data by embedding it in policy error messages. The vulnerability stems from a lack of URL validation in the http.Get() and http.Post() functions used within CEL policies, contrasting with the namespace enforcement present in the resource.Lib. The reported vulnerability was tested and confirmed on Kyverno v1.16.2 deployed via Helm chart 3.6.2.
Attack Chain
- An attacker gains the ability to create NamespacedValidatingPolicy resources within a specific Kubernetes namespace. This could be achieved through compromised credentials, misconfigured RBAC, or other privilege escalation methods.
- The attacker crafts a malicious NamespacedValidatingPolicy that utilizes the
http.Get()orhttp.Post()function within a CEL expression. The crafted policy is applied to the target Kubernetes cluster. - The CEL expression within the policy is designed to make an HTTP request to an internal service (e.g.,
internal-api.kube-system.svc.cluster.local) or a cloud metadata endpoint (169.254.169.254). - The crafted NamespacedValidatingPolicy is triggered by a specific event, such as the creation of a ConfigMap within the attacker’s namespace, which matches the
matchConstraintsdefined in the policy. - The Kyverno admission controller executes the CEL expression, making the HTTP request to the specified internal service or cloud metadata endpoint.
- The HTTP response from the internal service or cloud metadata endpoint is captured by the CEL expression.
- The attacker crafts a
messageExpressionwithin the NamespacedValidatingPolicy to include the captured data in a validation error message. - The validation error message, containing the exfiltrated data, is returned to the user, effectively leaking sensitive information.
Impact
This SSRF vulnerability allows attackers with limited, namespace-scoped privileges to access sensitive data within a Kubernetes cluster. This includes the ability to access services in other namespaces, potentially compromising sensitive configurations or secrets. Access to cloud metadata endpoints (169.254.169.254) allows the theft of IAM credentials, leading to further escalation of privileges within the cloud environment. Successful exploitation breaks namespace isolation, undermining the security model of Kyverno and Kubernetes.
Recommendation
- Deploy the Sigma rule to detect suspicious usage of
http.Getorhttp.Postfunction inNamespacedValidatingPolicyresources in your SIEM and tune for your environment. - Monitor network connections originating from the Kyverno pods, specifically looking for connections to internal Kubernetes services or cloud metadata endpoints (169.254.169.254), using the
network_connectionlog source. - Apply the suggested fix by adding namespace and URL restrictions to
pkg/cel/libs/http/http.goin Kyverno, similar to howresource.Libenforces namespace boundaries as per the advisory. - Upgrade Kyverno to a patched version >= 1.17 when available, addressing the CVE-2026-4789.
Detection coverage 2
Detect Kyverno NamespacedValidatingPolicy Using http.Get/http.Post
highDetects the creation of a NamespacedValidatingPolicy that uses the http.Get or http.Post functions, which could indicate a potential SSRF attempt.
Detect Outbound Connections from Kyverno Pods to Metadata Endpoint
highDetects network connections originating from Kyverno pods to the cloud metadata endpoint (169.254.169.254), which could indicate SSRF exploitation.
Detection queries are kept inside the platform. Get full rules →
Indicators of compromise
1
domain
2
1
ip
| Type | Value |
|---|---|
| ip | 169.254.169.254 |
| domain | internal-api.kube-system.svc.cluster.local |
| igor.stepansky@orca.security | |
| stepanskyigor@gmail.com |