Summary
A namespace-scoped tenant who can create a NamespacedMutatingPolicy can author a targetMatchConstraints.expression CEL program that emits a literal target object naming a resource in another tenant's namespace. Kyverno's background controller re-fetches and mutates that resource using the cluster-wide background-controller ServiceAccount, because the CEL mutate-existing expression path has none of the namespace clamps present on the legacy v1, deleting, and non-expression code paths. This yields cross-namespace privilege escalation and integrity and availability impact against other tenants.
Impact
The background-controller ServiceAccount holds an aggregated ClusterRole with cluster-wide create/update/patch/delete on roles, rolebindings, networkpolicies, ingresses, ingressclasses, configmaps, resourcequotas, limitranges, and resourceclaims. An attacker can patch an existing RoleBinding in a victim namespace to add themselves as a subject, or rewrite an existing Role's rules to grant broad verbs, gaining read/write access in the victim namespace. Additional impact includes corrupting NetworkPolicies to break network isolation, overwriting ConfigMaps to inject configuration, and rewriting ResourceQuotas in other tenants' namespaces.
Detection
Monitor Kyverno background-controller logs for UpdateRequest objects where the target resource namespace does not match the issuing policy's namespace. Review audit logs for mutations on RoleBinding, Role, NetworkPolicy, or ConfigMap objects that were not initiated by an expected operator identity. Inspect existing NamespacedMutatingPolicy objects for use of spec.targetMatchConstraints.expression with mutateExisting: true, particularly expressions that construct target objects with literal namespace fields.
Mitigation
Upgrade Kyverno to version 1.19.2 or later, which adds namespace clamps to the CEL expression code path in the background controller, bringing it to parity with the guarded paths in the deleting controller and legacy v1 mutate-existing handler. If an immediate upgrade is not possible, restrict who can create NamespacedMutatingPolicy objects in multi-tenant environments by tightening RBAC on the namespacedmutatingpolicies.kyverno.io resource.
Related Security Guidance
References
- GHSA-f96w-622v-rqpq — GitHub Security Advisory