Back to skills
SKILL.md
Container Escape
BSecurityContainer-to-host breakout testing (Tier 1) — mounted Docker/containerd socket, privileged containers, hostPath/host-namespace mounts, dangerous Linux capabilities, cgroups release_agent abuse, and runtime CVE classes (runc Leaky Vessels, CVE-2019-5736). Use when you have code execution inside a container and host compromise is in scope. Chains from k8s-attacks and to linux-discovery on the node.
- 16 stars
- 0 votes
- 0 copies
- 3 views
- Added November 17, 2026
Security analysis
75/100- Accesses sensitive system or user directories
npx -y skills add AnandJogawade/Zazy-Pentest-Plugin-for-Claude --skill container-escape --agent claude-codeAre you the author of Container Escape?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-container-escape)---
name: container-escape
description: Container-to-host breakout testing (Tier 1) — mounted Docker/containerd socket, privileged containers, hostPath/host-namespace mounts, dangerous Linux capabilities, cgroups release_agent abuse, and runtime CVE classes (runc Leaky Vessels, CVE-2019-5736). Use when you have code execution inside a container and host compromise is in scope. Chains from k8s-attacks and to linux-discovery on the node.
---
# Container Escape (container → host)
From inside a container, escape to the host via an exposed runtime socket, excessive privileges/capabilities, host mounts, or a runtime vulnerability. Authorized hosts only; breakout can affect other tenants — stay in RoE.
## Trigger phrases
`container escape, docker socket, privileged container, hostpath, capabilities, cap_sys_admin, runc, cgroups, release_agent, breakout, nsenter`
## Method
1. **Fingerprint the container:** `cat /proc/1/cgroup`, `/.dockerenv`, `hostname`, `cat /proc/self/status | grep Cap`, `capsh --print`, `mount`, `env` (leaked creds/tokens), `id`.
2. **Mounted runtime socket (fastest):** if `/var/run/docker.sock` (or containerd/`crictl`) is present/writable → `docker -H unix:///var/run/docker.sock run -v /:/host --privileged -it <img> chroot /host sh` = root on host.
3. **Privileged container / CAP_SYS_ADMIN:** classic cgroups v1 `release_agent` escape — create a cgroup, set `notify_on_release`, write a host-path `release_agent` script, trigger it. CAP_SYS_ADMIN also allows mounting host devices.
4. **Host namespaces / mounts:** `hostPID` → `nsenter --target 1 --mount --uts --ipc --net --pid sh`; `hostPath`/`-v /:/host` → chroot; host `/dev` (`CAP_MKNOD`) → read raw disk (`debugfs`).
5. **Dangerous capabilities:** `CAP_SYS_PTRACE`+hostPID (inject into host proc), `CAP_DAC_READ_SEARCH` (CVE-2014-9357/shocker-style file read), `CAP_SYS_MODULE` (load kernel module = host root), `CAP_NET_RAW`.
6. **Writable host files / docker group:** host `/` mount or membership in `docker` group → trivially root.
7. **Runtime CVE classes (version-gated):** check runc/containerd/Docker versions.
## Modern / rare techniques
- **[NEW] Leaky Vessels — runc CVE-2024-21626**: `WORKDIR`/process cwd leaks a host fd (`/proc/self/fd/<n>`) during container setup → write/read host filesystem; affects runc <1.1.12. Related: CVE-2024-23651/23652/23653 (BuildKit).
- **[RARE] CVE-2019-5736 (runc `/proc/self/exe` overwrite)**: a process exec in a container overwrites the host runc binary → root on next `docker exec`.
- **[NEW] CVE-2022-0492 (cgroups v1 `release_agent`)**: escape from an unprivileged container when user namespaces/AppArmor don't block `release_agent` writes.
- **[RARE] Kata/gVisor assumptions**: note when a sandbox runtime neutralizes socket/capability escapes.
## Escalation / chaining
Host root → `linux-discovery` / `linux-privesc` on the node → cluster control (`k8s-attacks`) → cloud metadata (`cloud`/`cloud-pivot-finder`) → lateral movement.
## Backend & tooling
Kali/WSL-Kali/HexStrike run inside the foothold. Enumerators: `deepce`, `amicontained`, `cdk` (Container DucK), `peirates` (k8s context), `linpeas`. Validate runtime versions against vendor advisories.
## Verification (background, before reporting)
Prove breakout by reading a host-only file or obtaining a host UID shell, then confirm from a second technique where feasible. For CVE-class escapes, confirm the vulnerable version AND demonstrate a non-destructive PoC (read a host marker file) rather than assuming. Report confirmed escapes only.
## Evidence
Capability/socket/mount enumeration, the escape command, and host-side proof (host `/etc/hostname`, `/etc/shadow` existence as root, or host process list). Remediation: never mount the Docker socket, drop `--privileged`, drop capabilities to least-set, no host namespaces/paths, user namespaces + seccomp/AppArmor, patch runc/containerd, read-only rootfs.
Attribution
Related skills
View all in security →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.