Kubernetes Service Account Token Abuse
service-account-token-abuse is a critical severity check in the
devops category, written in go.
Its source is templates/devops/kubernetes/service-account-token-abuse.go in
cert-x-gen-templates.
What it checks
Section titled “What it checks”Detects Kubernetes misconfigurations that expose service account tokens to unauthenticated or minimally-privileged attackers. Checks for: unauthenticated Secrets API access, Kubelet /pods endpoint token path exposure, token-based API pivoting to kube-system secrets, and default service account over-permission. Token extraction and lateral movement (pivoting) are simulated in read-only detection mode.
Header
Section titled “Header”| Field | Value |
|---|---|
| Id | service-account-token-abuse |
| Severity | critical |
| Language | go |
| Category | devops |
| Author | BugB Technologies |
| Template version | not recorded |
| Confidence | 95 |
| CVSS | not recorded |
| Weakness | CWE-522 |
| Tags | kubernetes, service-account, token-abuse, secrets, kubelet, privilege-escalation, lateral-movement, k8s, cloud-native |
| Target kind | not recorded |
| Oracle | not recorded |
References
Section titled “References”Declared in the header. cxg parses @references and then discards it, and
nothing at scan time reads it, so this is the only place the links a
template cites are surfaced.
- https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
- https://attack.mitre.org/techniques/T1528/
- https://www.cncf.io/blog/2021/08/20/kubernetes-rbac-least-privilege/
- https://owasp.org/www-project-kubernetes-top-ten/2022/en/src/K01-insecure-workload-configurations
Run it
Section titled “Run it”To see what the copy on your machine says about itself, and to confirm it is installed at all:
cxg template info service-account-token-abuseThe id it prints is the one to pass anywhere a template is selected. See
cxg template for the rest of
the subcommand, Scan a target for running
a scan, and
A match is not a finding for how
to read what comes back.
Related
Section titled “Related”- Template catalog is the whole corpus.
- devops is the rest of this category.
- Templates by weakness class groups checks by the defect they look for.
- Contribute a template is the route from a check you needed and could not find to a merged one.

