Kubernetes: exposed workload to cluster-admin
From an exploitable pod, through a container escape and a service-account token, to control of the whole cluster — mapped to the MITRE ATT&CK Containers matrix.
Scenario
An authorized assessment of a Kubernetes platform. A public-facing application running in a pod has an exploitable flaw. The objective is to show whether a compromised workload can take over the cluster.
- 1
Initial Access
Compromise a workload
Exploit the in-scope application flaw to obtain command execution inside its container — the starting point is an ordinary pod, not the host.
DetectionWeb-tier exploitation signatures plus a container process spawning a shell are visible to admission/runtime security tooling.
MitigationPatch workloads, run them read-only and non-root, and enforce the Restricted Pod Security Standard.
- 2
Discovery
Survey the container and its identity
Examine the container for its mounted service-account token, environment, capabilities and whether host namespaces or sensitive mounts are exposed — the inputs that decide if escape is possible.
DetectionReads of the service-account token path and in-pod enumeration can be caught by runtime sensors (Falco-style rules).
MitigationSet automountServiceAccountToken: false where not needed, drop capabilities, and forbid hostPath/host namespaces via policy.
- 3
Privilege Escalation
Escape to the node (if misconfigured)
Where the pod is privileged or over-permissioned (privileged flag, host mounts, dangerous capabilities), demonstrate a break-out to the underlying node; otherwise, document that escape was not possible as a positive finding.
DetectionA container process acting on the host (mount, nsenter-like behaviour, writes to host paths) is a high-severity runtime alert.
MitigationNever run privileged pods for workloads, block hostPath mounts and CAP_SYS_ADMIN, and enforce Pod Security Admission.
- 4
Credential Access
Use the service-account token against the API
Query the Kubernetes API with the pod's service-account token to learn exactly what the identity may do — the real privilege boundary in a cluster.
DetectionAPI-server audit logs show the service account's requests; unusual verbs (secrets list, pods/exec) stand out.
MitigationLeast-privilege RBAC per service account, no wildcard verbs, and tight control over secrets and pods/exec.
References kubernetes-pentest - 5
Lateral Movement / Impact
Leverage RBAC to control the cluster
If the identity (or a reachable one) holds powerful RBAC, demonstrate control by scheduling a workload onto other nodes or reading cluster-wide secrets, proving the blast radius and then cleaning up.
DetectionCreation of privileged pods/daemonsets, cronjobs, and cluster-wide secret reads are critical API-audit events.
MitigationSeparate workload and admin RBAC, restrict pod-creation rights, use namespaces plus NetworkPolicies, and alert on privileged pod creation.
References kubernetes-pentest
Key takeaways
- A pod is only a weak boundary when it is privileged or over-permissioned — configuration decides everything.
- The service-account token and its RBAC are the true privilege boundary; scope them tightly.
- Pod Security Admission (Restricted), no privileged pods, and least-privilege RBAC break this chain early.