$npx -y skills add hypnguyen1209/offensive-claude --skill container-k8s-escapeUse when breaking out of a container or escalating inside Kubernetes — runc/BuildKit CVEs, privileged/capability/cgroup misconfig escapes, NVIDIA GPU toolkit escape, K8s RBAC abuse, kubelet RCE, ingress/admission-controller RCE, node-to-cluster pivot
| 1 | # Container Breakout & Kubernetes Escape |
| 2 | |
| 3 | ## When to Activate |
| 4 | |
| 5 | - You have code execution inside a container/pod and want to break out to the host node |
| 6 | - Auditing a Kubernetes cluster for RBAC privilege-escalation and lateral-movement paths |
| 7 | - Assessing runc/containerd/BuildKit/Docker runtime versions against known escape CVEs |
| 8 | - A pod is privileged, has dangerous capabilities, hostPath/hostPID/hostNetwork, or a mounted docker.sock |
| 9 | - Attacking GPU/AI workloads using the NVIDIA Container Toolkit |
| 10 | - Testing ingress-nginx / admission-controller exposure for unauthenticated RCE |
| 11 | - Post-escape: pivoting from one node to full cluster takeover (kubelet, SA tokens, etcd, cloud IMDS) |
| 12 | - Building Falco/Sigma detections for container-escape behavior (defensive validation) |
| 13 | |
| 14 | ## Technique Map |
| 15 | |
| 16 | | Technique | ATT&CK | CWE | Reference | Script | |
| 17 | |-----------|--------|-----|-----------|--------| |
| 18 | | runc working-dir fd leak escape (Leaky Vessels, CVE-2024-21626) | T1611 | CWE-403 | references/runtime-cve-escapes.md | scripts/runc_cwd_escape.py | |
| 19 | | runc masked-path / `/dev/null` symlink escape (CVE-2025-31133) | T1611 | CWE-367 | references/runtime-cve-escapes.md | scripts/runc_cwd_escape.py | |
| 20 | | runc `/dev/console` bind-mount + LSM bypass (CVE-2025-52565/52881) | T1611 | CWE-363 | references/runtime-cve-escapes.md | scripts/escape_enum.sh | |
| 21 | | BuildKit cache/teardown symlink escape (CVE-2024-23651/52/53) | T1611 | CWE-59 | references/runtime-cve-escapes.md | scripts/escape_enum.sh | |
| 22 | | Privileged / `CAP_SYS_ADMIN` cgroup `release_agent` escape | T1611 | CWE-269 | references/privileged-misconfig-escape.md | scripts/release_agent_escape.sh | |
| 23 | | `core_pattern` host-side code exec on crash | T1611 | CWE-269 | references/privileged-misconfig-escape.md | scripts/release_agent_escape.sh | |
| 24 | | `hostPID` + `nsenter` into PID 1 namespace | T1611 | CWE-668 | references/privileged-misconfig-escape.md | scripts/escape_enum.sh | |
| 25 | | Mounted `docker.sock` / `containerd.sock` host takeover | T1610 | CWE-668 | references/privileged-misconfig-escape.md | scripts/escape_enum.sh | |
| 26 | | `hostPath` `/` mount → write host filesystem | T1611 | CWE-22 | references/privileged-misconfig-escape.md | scripts/escape_enum.sh | |
| 27 | | NVIDIAScape `LD_PRELOAD` OCI-hook escape (CVE-2025-23266) | T1611 | CWE-426 | references/nvidia-gpu-escape.md | scripts/nvidiascape_build.sh | |
| 28 | | NVIDIA CT TOCTOU mount escape (CVE-2024-0132 / CVE-2025-23359) | T1611 | CWE-367 | references/nvidia-gpu-escape.md | scripts/nvidiascape_build.sh | |
| 29 | | K8s RBAC privesc (verb/wildcard/escalate, SA token theft) | T1078.001 | CWE-269 | references/k8s-rbac-escalation.md | scripts/k8s_rbac_audit.py | |
| 30 | | `nodes/proxy` GET → kubelet WebSocket exec RCE | T1609 | CWE-863 | references/k8s-rbac-escalation.md | scripts/kubelet_exec.py | |
| 31 | | Anonymous/authed kubelet API exec on :10250 | T1609 | CWE-306 | references/k8s-rbac-escalation.md | scripts/kubelet_exec.py | |
| 32 | | IngressNightmare unauth RCE (CVE-2025-1974 + annotation chain) | T1190 | CWE-94 | references/ingress-admission-attacks.md | scripts/escape_enum.sh | |
| 33 | | Node → cluster pivot (etcd, IMDS, SA-token harvest) | T1613 | CWE-552 | references/node-host-pivot.md | scripts/escape_enum.sh | |
| 34 | |
| 35 | ## Quick Start |
| 36 | |
| 37 | ```bash |
| 38 | # 0. Enumerate the container/pod context: caps, mounts, sockets, runtime versions, K8s creds |
| 39 | bash scripts/escape_enum.sh # run INSIDE the target container |
| 40 | |
| 41 | # 1. Runtime-CVE path: detect vulnerabl |