Most Kubernetes attacks start from a single compromised pod and climb. A pod carries an identity (a service-account token), sits on a flat network, and runs on a node that holds credentials for the whole cluster. The path is familiar: enumerate, reach exposed components, escalate through RBAC, escape to the node, move laterally, and persist. Escaping the pod to its node uses the runtime-agnostic primitives in Container escape; this area is the cluster-level attack model around them.
First moves from a pod#
These few commands decide which branch of the area applies next:
# 1. identity and what it can do (drives the RBAC and lateral branches)
T=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
echo "$T" | cut -d. -f2 | base64 -d 2>/dev/null | python3 -m json.tool # whoami
kubectl --token="$T" --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
--server=https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT auth can-i --list
# 2. am I in an over-privileged pod? (drives pod-escape-to-node)
grep -E 'CapEff|Seccomp' /proc/self/status; cat /proc/self/uid_map
mount | grep -vE 'overlay|proc|sysfs|tmpfs|cgroup' | head # hostPath
# 3. what is reachable? (drives exposed-components, network, cloud)
curl -sk https://$KUBERNETES_SERVICE_HOST/version
curl -s http://169.254.169.254/latest/meta-data/ 2>/dev/null | head # cloud metadata
Read the results: broad can-i output points at RBAC privilege escalation; a privileged or host-mounting pod points at Pod escape to node; a reachable kubelet, etcd, or dashboard points at Exposed components; a reachable metadata endpoint points at the cloud, via Cloud metadata from pod.
Subtopics#
- Cluster enumeration: mapping the cluster and your identity from a pod.
- Exposed components: unauthenticated or reachable control-plane and node components.
- RBAC privilege escalation: turning limited permissions into more.
- Pod escape to node: breaking out of a pod to its node.
- Lateral movement: moving between workloads, namespaces, and into the cloud.
- Persistence: keeping access across restarts and remediation.
- Network: attacking the cluster network and service mesh.
- Supply chain: Helm, operators, and admission as deployment paths.