Banzai

Gaining Access

Nmap scan:

$ nmap -p- --min-rate 3000 -Pn 192.168.160.56
Starting Nmap 7.93 ( https://nmap.org ) at 2023-07-13 12:04 +08
Nmap scan report for 192.168.160.56
Host is up (0.17s latency).
Not shown: 65528 filtered tcp ports (no-response)
PORT     STATE  SERVICE
21/tcp   open   ftp
22/tcp   open   ssh
25/tcp   open   smtp
5432/tcp open   postgresql
8080/tcp open   http-proxy
8295/tcp open   unknown

FTP Weak Creds -> RCE

The FTP service has weak credentials of admin:admin:

$ ftp 192.168.160.56
Connected to 192.168.160.56.
220 (vsFTPd 3.0.3)
Name (192.168.160.56:kali): admin
331 Please specify the password.
Password: 
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> passive
Passive mode: off; fallback to active mode: off.
ftp> ls
200 EPRT command successful. Consider using EPSV.
150 Here comes the directory listing.
drwxr-xr-x    2 1001     0            4096 May 26  2020 contactform
drwxr-xr-x    2 1001     0            4096 May 26  2020 css
drwxr-xr-x    3 1001     0            4096 May 26  2020 img
-rw-r--r--    1 1001     0           23364 May 27  2020 index.php
drwxr-xr-x    2 1001     0            4096 May 26  2020 js
drwxr-xr-x   11 1001     0            4096 May 26  2020 lib

Within it, there seem to be web application folders. Since index.php is present, I placed cmd.php shell and tested it with the web service runnign on port 8080 and port 8295:

We now have RCE, and we can easily get a reverse shell.

Privilege Escalation

MySQL Raptor -> Root

Within the machine, we find that MySQL is listening on port 3306:

When checking which user was running it, I found that it was the root user:

Conveniently, MySQL creds were also present within the machine:

I wanted to use the UDF Raptor exploit, but we first need to find the Plugins directory and whether there are any protections over the files:

The above means that it is vulnerable!

This method exploits the access that the root user has over the system using MySQL, which allows for malicious shared objects to be loaded and gives an attacker RCE as root using the MySQL instance.

First, compile the exploit accordingly on the machine itself:

Then, transfer the shared object to the machine and run the following commands in MySQL:

Afterwards, we can just execute a command as root:

We can then easily get a root shell:

Last updated