Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2024-21626 PoC — runc container breakout through process.cwd trickery and leaked fds

Source
Associated Vulnerability
Title:runc container breakout through process.cwd trickery and leaked fds (CVE-2024-21626)
Description:runc is a CLI tool for spawning and running containers on Linux according to the OCI specification. In runc 1.1.11 and earlier, due to an internal file descriptor leak, an attacker could cause a newly-spawned container process (from runc exec) to have a working directory in the host filesystem namespace, allowing for a container escape by giving access to the host filesystem ("attack 2"). The same attack could be used by a malicious image to allow a container process to gain access to the host filesystem through runc run ("attack 1"). Variants of attacks 1 and 2 could be also be used to overwrite semi-arbitrary host binaries, allowing for complete container escapes ("attack 3a" and "attack 3b"). runc 1.1.12 includes patches for this issue.
Readme
# CVE-2024-21626-POC

# 使用说明
仅供教育/研究使用,任何与教育/研究无关的行为所产生的风险自行负责

# 使用
```bash
docker build . -t cve-2024-21626
docker run -it --rm cve-2024-21626 bash /poc.sh
# 另起一个terminal
/bin/bash.copy
```

# 注意
不同docker/runc版本使用的具体文件描述符有所不同,例如docker server:20.10.17 && runc version 1.1.2 的情况下使用 /proc/self/fd/9,实际的 fd 可能根据文件打开顺序而改变,官方文档中指出大多数情况下应该使用 /proc/self/fd/7

修改:在Dockerfile中修改WORKDIR为对应的值

# 前置条件
同时满足以下条件:
```
1. 可以创建容器并指定执行命令
2. 可以指定容器使用的镜像
```

# 漏洞原理
TODO


# 参考
https://github.com/opencontainers/runc/security/advisories/GHSA-xr7r-f8xq-vfvv

https://github.com/opencontainers/runc/commit/2a4ed3e75b9e80d93d1836a9c4c1ebfa2b78870e
File Snapshot

[4.0K] /data/pocs/179361e2f82040791196f721014678fe7c68f68e ├── [ 113] Dockerfile ├── [ 212] poc.sh └── [ 948] README.md 0 directories, 3 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →