Reconnaissance and escaping a Pod
The attacker's path from RCE in a container to the node's admin.conf, and the two manifest lines that open it.
The first lesson of the hardening track: the shop in the cluster has a hole that runs commands inside a Pod. You follow the attacker from the first command to cluster admin rights and close the path with a manifest change.
Threat model
The attacker is outside the cluster and has no Kubernetes permissions. All they have is an HTTP request to the storefront that runs their command in the web container. What happens next depends on the privileges that container runs with.
Attack path
- A command through the vulnerable application endpoint.
- A look around the container: user, environment variables, ServiceAccount token, capabilities, mounts.
- Node files through a privileged container and a volume with the node root.
- The admin kubeconfig from the node and API requests with full rights.
Checklist
- Application Pods have no
privileged: trueand nocapabilities.add: ["SYS_ADMIN"]. - No
hostPathto the root,/etc,/var/lib/kubeletor container runtime sockets. - No
hostPID,hostNetworkorhostIPCwithout a stated reason. - Agents that need the node get one specific read-only directory and live in a separate namespace.
- You have a command that finds such Pods across the whole cluster.
Practice
A lab on the shared kind cluster of the track: attack.sh gets admin rights through the hole in web, you remove the extra fields from the Deployment, the repeated attack is blocked, and the shop keeps taking orders.
Done reading?
Mark the lesson as read to move your track progress forward.
Lesson marked as done.
Practice
Fix a local lab. The agent checks your work and gives hints if you get stuck.
Full access to all labs
One payment, no auto-renewal · Terms
Progress saved in this browser
Clear your history or open this on your phone, and the marks will be gone. Leave your email and they'll move to your account. No password needed.
Done. moved to your account. You can see your progress on any device. My progress