VulnNet
https://tryhackme.com/room/vulnnet1
Nmap
Web Server
Investigating port 80, we are welcomed over to the Vulnnet Entertainment landing page.
Path Traversal
Starting enumeration with ZAP's active scan feature, we detect a high alert for a path traversal vulnerability.
Whilst the path traversal works, the results are not visible unless looking at the source of the /index.php
page.
Enumeration
From /etc/passwd
we obtain the username server-management. For further information we use the path traversal vulnerability to acquire even further information about the /index.php
page located in /var/www/html/
.
As per the image shown below, we can now see even further information and that the page is running ClipBucket version 4.0.
A quick search with searchsploit
reveals multiple vulnerabilities for version 4.0.0.
Exploit-db: https://www.exploit-db.com/exploits/44250
However, I was unable to successfully complete any of the suggested exploits due inaccessible and required directories.
Sub Domain Enumeration
Taking the enumeration further we start fuzzing for subdomains on http://vulnnet.thm.
Looking at the results below we get the response code 401 (Unauthorized) for the sub domain http://broadcast.vulnnet.thm.
Appending the braodcast sub domain to our /etc/hosts
file we then browse to the new domain and are prompted for credentials.
Brute forcing the login page with the server-management user and Hydra provided unsuccessful. Likewise, admin and root did not work either.
Back to enumeration...
Further Enumeration
Building on further from the LFI vulnerability discovered by ZAP earlier we start fuzzing for further files. We get a valid hit on /etc/apache2
.
Fuzzing for further files within the /etc/apache2
directory we soon get a hit for .htapasswd
.
Using curl
we read the contents of .htpasswd
and discover credentials within the file.
Hashcat
Using hashcat against the rockyou.txt wordlist we are soon able to crack the Apache2 encrypted password.
Accessing ClipBucket
Using the newley discovered credentials for the user developers on the http://boradcast.vulnnet.thm
web page we are able to proceed and are greeted with the index page for Clipbucket.
Arbitary File Upload / Shell
Going back to Exploit-DB we can begin again, to look at the various vulnerabilities. In this instance I have chosen to proceed with the Unauthenticated Arbitary File Upload.
Using the PHP Monkey reverse shell generated from RevShells I then used the command below to perform a file upload.
The response message includes the directory and name of the uploaded file. Using this information we start a netcat listener and browse to the uploaded reverse shell.
Gaining access as www-data.
From here we give ourselves a better shell experience.
Crontab
Performing basic enumeration steps on the target system we find the file /var/opt/backupsrv.sh
is executed by root every two minutes.
Viewing the contents of the file we see that all files within /home/server-management/Documents
are archived using tar
everytime the scipt is run.
Reading the script we see that tar
is backing up files and ending the command in a wildcard. I have previously document performing privilege escalation in the TryHackMeRoom Marketplace using tar
wildcard injection
However, we have no permissions over the destination path of /home/server-management/Documents
.
Archive Exctration
Looking at the files already backed up and archived to /var/opt/backups
we notice two archived files of interest;
Extract these to a writeable directory:
Viewing the id_rsa
is of interest.
Transferring the id_rsa
key over to my attacking system we are prompted for a password when trying to use it when connecting as the user server-management.
Hashing and Cracking
Using ssh2john we can hash the key file and then, perform password cracking to reveal the plain text password.
SSH as server-management
With the now discovered credentials we are able to login over SSH
with the user server-management.
Tar wildcard injection
Revisiting the /var/opt/backupsrv.sh
file we should now be able to perform privilege escalation as /home/server-management/Documents
is within our home directory.
Referring again to the steps I performed for the Marketplace room. Ensuring we are running from the Documents folder.
Shell as root
Start a netcat listener, wait a couple of minutes and obtain a root shell and then grab the root.txt flag.
Last updated