escaping-containers-to-host
它能做什么
这个工具可以帮你突破隔离的容器(container),访问运行该容器的宿主机(host)。它用于测试容器的安全性。
适用场景
- ✓在获得授权的前提下测试容器安全性时。
- ✓演示不安全的容器配置会带来哪些风险时。
- ✓验证容器逃逸防护措施是否有效时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/escaping-containers-to-host/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我该如何从这个容器逃逸到宿主机系统?”
每周 5 个新技能,1 分钟读完。
工作原理
它会利用容器管理软件中的安全配置错误或漏洞。找到这样的缺陷之后,就能直接在宿主机上执行命令。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Escaping Containers to Host
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.
Overview
Container 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/SELinux) for isolation. When any of these controls are weakened (a --privileged container, a mounted Docker socket, a hostPath mount of /, excess Linux capabilities such as CAP_SYS_ADMIN) or when a runtime contains a vulnerability, that boundary collapses.
This skill covers the four highest-impact, real-world escape primitives observed by Sysdig, Unit 42, and the runC maintainers:
- Misconfiguration escapes — privileged containers,
CAP_SYS_ADMIN, host PID/IPC/Network namespaces, andhostPathmounts. - Exposed Docker socket (
/var/run/docker.sock) — mounting the daemon socket into a container hands an attacker root on the host via a new privileged container. - The "Leaky Vessels" runC fd leak, CVE-2024-21626 — runC leaks an internal file descriptor (
/proc/self/fd/7/8) referencing the host filesystem beforepivot_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/1.7.13, Docker 25.0.2). - The November 2025 runC procfs write-redirect family — CVE-2025-31133, CVE-2025-52565, CVE-2025-52881 — race/symlink abuse of the
/dev/null,/dev/console, and other bind mounts performed before runC appliesmaskedPaths/readonlyPaths, allowing read-write access to/procentries (e.g./proc/sysrq-trigger,core_pattern) and arbitrary write redirection. Patched in runC 1.2.8, 1.3.3, and 1.4.0-rc.3.
Sources: Palo Alto Networks "Leaky Vessels" advisory; Sysdig "New runc vulnerabilities allow container escape" (2025); opencontainers/runc security advisories GHSA-cgrx-mc8f-2prm and GHSA-9493-h29p-rfm2; Unit 42 container-escape research.
When to Use
- During an authorized container or Kubernetes penetration test after obtaining initial code execution inside a container or pod
- When validating that runtime defenses (Falco, seccomp, AppArmor) detect or block breakout attempts
- When assessing the blast radius of a compromised microservice
- When verifying patch levels of runC/containerd/Docker against the CVEs above
Prerequisites
- Authorization (signed rules of engagement) covering host/node compromise
- A foothold: a shell inside a target container
- Reconnaissance utilities inside the container or staged in:
# deepce - Docker enumeration and escape git clone https://github.com/stealthcopter/deepce.git # amicontained - container introspection (capabilities, seccomp, namespaces) curl -L https://github.com/genuinetools/amicontained/releases/download/v0.4.9/amicontained-linux-amd64 -o amicontained chmod +x amicontained # CDK - zero-dependency K8s/container pentest toolkit curl -L https://github.com/cdk-team/CDK/releases/latest/download/cdk_linux_amd64 -o cdk chmod +x cdk - A lab cluster/host you are permitted to break out of (e.g., kind, minikube, or a dedicated VM)
Objectives
- Enumerate the container's privilege posture (capabilities, namespaces, mounts, seccomp)
- Identify which escape primitive is available
- Execute a host breakout and prove host-level code execution
- Capture evidence (host hostname, host
/etc/shadowaccess, or a host file write) - Document the root-cause misconfiguration or vulnerable runtime version for remediation
MITRE ATT&CK Mapping
| Technique ID | Name | Tactic |
|---|---|---|
| T1611 | Escape to Host | Privilege Escalation |
| T1610 | Deploy Container | Defense Evasion / Execution |
| T1613 | Container and Resource Discovery | Discovery |
| T1068 | Exploitation for Privilege Escalation | Privilege Escalation |
Workflow
Step 1: Enumerate the Container Environment
Determine privilege level, capabilities, namespaces, and mounted host paths.
…
常见问题
什么是“容器”?
容器就像一个隔离的盒子,里面装着程序以及它运行所需的一切。它能保证程序在任何电脑上的运行方式都一致。
“从容器逃逸到宿主机”是什么意思?
指突破隔离的盒子(容器),获得主电脑(宿主机)的访问权限,而这个盒子就运行在宿主机上。
这样做危险吗?
危险。这是一种高级安全技术,只应用于你有权测试的系统上的授权测试,因为它可能让人完全控制宿主机。
详情
作者的原始描述
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, host
热度
- GitHub 星标
- 35k
- 排名
- #7890
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。