Tre
Ran a TCP scan via NMAP

Ports 22,80 and 8082 were open. I checked the webpage at port 80 and found the following image.

I checked the target at port 8082 and found the same web page as above.
The next step was to brute-force directories which I did using Gobuster.
This process was easy yet pretty time consuming for me because the wordlists I was using did not have the keywords for subdirectories which were needed. I had to refer a writeup for this and then used a different wordlist.
I found a
/cmdsubdirectory and visiting it returned the following website.

I enumerated the website but found nothing of use. Later after changing the wordlist I ran the directory scan again using the following.
gobuster dir -u /usr/share/wordlists/dirb/big.txt -w 192.168.197.84Out of all the subdirectories found, two of them could be put to use.
/adminer.php /mantisbtI visited
adminer.phpand found the following.

Adminer is (or was) a database management tool solely written in PHP. Here I had a login page for the same.
Next I visited the
mantisbtdirectory and found the following login page.

Apparently, mantisbt referred to Mantis Bug Tracker which is a bug tracking tool written in PHP too.
I tried logging in via default mantisbt credentials which were
adminstrator:rootbut it didn't work.Next I ran a directory brute-force scan inside the
mantisbtdirectory and found aconfigdirectory.

Here
a.txtseemed a little off relative to the other files present here.Upon opening the file I found the following database credentials.

Bingo! I could use these credentials in
adminer.phpnow. Initially I also tried to login to Mantis BT using the username and password here but it didn't work.
Here I had logged into adminer and could see the above interface. I scrolled through the long list of tables and viewed the data inside
mantis_user_table.
I tried using the
administratorandtrecredentials in the Mantis login but none of them worked.Next I tried using both the credentials in SSH but it didn't work too.
After a while I tried logging in to SSH again but this time using the
realnamevalues as the password.

I was able to get SSH on the target for
treuser. I also found the first flag in the working directory.
Privilege Escalation and root
Next, I ran
sudo -land found the following.

The file didn't really have anything of use and all the data was encoded. I viewed the data using
strings shutdownbut found nothing that I could comprehend.After that I ran
pspyhttps://github.com/DominicBreuker/pspy , to check the running processes on the target.

A file named
check-systeminside/usr/binwas running every second. This seemed interesting.I listed out the code inside the file and got the following.

It also had write permissions.
I overwrote the file with
chmod +s /bin/bashwhich would give the SUID sticky bit to/bin/bashand hence I could then access the shell as root.I ran
echo "chmod +x /bin/bash" > /usr/bin/check-systemand then shutdown the system usingsudo /sbin/shutdown -r nowAfter starting the system again I used
/bin/bash -pwith-pfor privileged mode and immediately got a proper root shell.The only step left was to get the root flag from
proof.txt.
Last updated