Summary
A policy exception handling flaw in Kyverno can cause a less restrictive exception to take precedence when an enforce-mode policy is combined with multiple PolicyExceptions. An attacker who can submit a resource with a carefully chosen name may bypass intended policy controls, including restrictions on hostPath volumes.
Affected context
The issue occurs in Kyverno deployments that use enforce-mode policies together with multiple PolicyExceptions. It becomes risky when exception matching permits a resource name to satisfy a broader or less restrictive pattern, such as a wildcard containing a term like "ingress", while another exception provides tighter restrictions. The resulting precedence behavior may allow a resource to pass validation despite the intended policy requirement.
Exploit preconditions
- Attack surface: Kubernetes resource admission through a Kyverno-protected cluster
- Required access: Permission to create or modify resources subject to the affected policy
- Configuration requirement: An enforce-mode policy must be combined with multiple PolicyExceptions whose matching rules differ in restrictiveness
- Trigger point: Policy evaluation for a resource whose name matches the less restrictive exception pattern
- Why exploitation is possible: Exception precedence can select the less restrictive result, allowing the resource to avoid enforcement that should otherwise apply
Why this happens
The underlying bug is an authorization and policy-evaluation error in the handling of multiple exceptions. When exception matching produces more than one applicable result, the implementation can select a less restrictive exception rather than applying the strongest relevant restriction or an unambiguous precedence rule. This maps to CWE-284: Improper Access Control, because a resource can receive permissions or policy treatment beyond what the configured controls intend.
Potential impact
- Policy enforcement may be bypassed
- Restricted resources could be admitted into the cluster
- HostPath restrictions may be circumvented
- Workloads could gain access to host files or host resources
- Cluster confidentiality, integrity, or availability could be affected
General mitigation guidance
Mitigation generally focuses on making exception evaluation deterministic, restrictive by default, and resistant to ambiguous matches.
Common defensive patterns include:
- Applying the most restrictive applicable exception when multiple exceptions match
- Avoiding overlapping or broad wildcard patterns in PolicyExceptions
- Requiring explicit, narrowly scoped resource and identity matching
- Treating ambiguous exception resolution as a policy failure rather than an allowance
- Limiting who can create, modify, or approve PolicyExceptions
- Reviewing high-impact controls, such as hostPath restrictions, with independent admission policies
- Testing exception precedence and denial behavior as part of policy validation and deployment review
How teams detect issues like this
Organizations can look for this issue through:
- Static and configuration analysis that identifies overlapping PolicyException match patterns
- Code review checks for precedence rules that select permissive outcomes
- Admission testing with resources whose names match multiple exception patterns
- Audit-log analysis for resources admitted under unexpected exceptions
- Policy-as-code tests that verify restricted resources remain denied when exceptions overlap
- Governance rules requiring security review for wildcard exceptions and changes to enforcement policies
Automated policy testing and code review tools may help identify ambiguous matching behavior before deployment.

