How a URL Parser Differential Broke Kyverno's Namespace Isolation
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.
Inside Kyverno’s architecture: Where parser boundaries break
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 the core flaw and demonstrate the attack from scratch.
Establishing the baseline: Testing namespace boundaries
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
The attacker's goal is to steal that data.
, 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:
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?”
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:
The vulnerability: Injecting unsafe queries by abusing a parser differential
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 it (in fact, the patch for a 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:
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/
How Kyverno's validation processes the payload
path.Clean() normalizes the string. Because it treats ? as a normal character, it outputs the exact same string: /api/v1/configmaps?x=/namespaces/default/ .
The validation regex scans the string. It finds the substring /namespaces/default/ sitting directly inside the x= query parameter.
The regex extracts default as the target namespace. The extracted namespace matches the policy namespace, so it’s allowed .
How the Kubernetes Client processes the payload
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:
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:
Cool! The ConfigMap creation has failed, but thanks to the error message we have leaked the target secret.
Remediation and key lessons for defenders
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.
