Summary
In Kyverno v1.18.0 and v1.18.1, the NamespacedMutatingPolicy CEL compiler unintentionally exposes the generator library to match condition expressions. A tenant who can create a NamespacedMutatingPolicy in their own namespace can invoke generator.apply(namespace, resources) in a matchConditions CEL expression with an arbitrary namespace string. The namespace argument arrives unvalidated at pkg/cel/libs/context.go, and the side effect executes with the admission controller's cluster-wide RBAC privileges, causing resources to be generated in any namespace the attacker specifies.
Impact
A namespace-scoped user with create on NamespacedMutatingPolicy in Kyverno v1.18.0 or v1.18.1 can create ConfigMaps, NetworkPolicies, Secrets, and other resources in any namespace using the admission controller's cluster-wide RBAC. This enables injecting sensitive configuration into protected namespaces such as kube-system, disrupting cluster networking via NetworkPolicies, and potential privilege escalation via RoleBinding creation. The CVSS score of 9.6 reflects the network-accessible, low-privilege, no-interaction path to a cross-scope critical confidentiality and integrity impact.
Detection
Audit all NamespacedMutatingPolicy objects in the cluster for matchConditions expressions that reference generator.apply() with namespace arguments that differ from the policy's own namespace. On affected Kyverno versions, any such expression is a potential indicator of exploitation or misconfiguration:
kubectl get namespacedmutatingpolicies -A -o json | \
grep -i "generator.apply"
Review the Kyverno admission controller logs for resource creation events in namespaces other than those where tenant policies are installed.
Mitigation
Upgrade Kyverno to v1.18.2 or later, which adds namespace scope enforcement on generator.apply() arguments to prevent cross-namespace resource generation.
Only Kyverno v1.18.0 and v1.18.1 are affected. Clusters running earlier Kyverno versions are not vulnerable because NamespacedMutatingPolicy was not present. Restricting create permissions on the namespacedmutatingpolicies.policies.kyverno.io resource to trusted users limits the exposure on clusters that cannot upgrade immediately.
Related Security Guidance
References
- GHSA-79gf-7frw-68m9 — GitHub Security Advisory
- NVD CVE-2026-54523 — National Vulnerability Database