4 min readOct 13, 2025
–
Press enter or click to view image in full size
By: Kavin Jindal (@Klevr)
- This is a detailed write-up of **Tre **which is an intermediate-level lab on Offensive Security’s PG Play.
 
- 0x01 — Initial Recon :
- Started by running a TCP scan on the target via NMAP.
 
Press enter or click to view image in full size
- Ports 22,80 and 8082 were open. I checked the webpage at port 80 and found the following image.
 
Press enter or click to view image in full size
- 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 k…
 
4 min readOct 13, 2025
–
Press enter or click to view image in full size
By: Kavin Jindal (@Klevr)
- This is a detailed write-up of **Tre **which is an intermediate-level lab on Offensive Security’s PG Play.
 
- 0x01 — Initial Recon :
- Started by running a TCP scan on the target via NMAP.
 
Press enter or click to view image in full size
- Ports 22,80 and 8082 were open. I checked the webpage at port 80 and found the following image.
 
Press enter or click to view image in full size
- 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 to a write-up for this and then used a different wordlist.
 - I found a 
/cmdsubdirectory and visiting it returned the following website. 
Press enter or click to view image in full size
- I enumerated the website but found nothing of use. Later, after changing the wordlist I ran the directory scan again using the following command.
 
gobuster dir -u /usr/share/wordlists/dirb/big.txt -w 192.168.197.84
- Out of all the subdirectories found, only two of them seemed useful.
 
/adminer.php/mantisbt
- I visited 
adminer.phpand found the following. 
Press enter or click to view image in full size
- Next, I visited the 
mantisbtdirectory and found the following login page. 
Press enter or click to view image in full size
- Apparently, mantisbt referred to Mantis Bug Tracker which is a bug tracking tool written in PHP.
 - I tried logging in via the default MantisBT credentials which were 
adminstrator:rootbut it didn’t work. - Next, I brute-forced the directories inside the 
mantisbtdirectory and foundconfig. 
Press enter or click to view image in full size
- Here 
a.txtseemed a little off relative to the other files present in the directory. - Upon opening the file, I found the following database credentials.
 
Press enter or click to view image in full size
- Bingo! I could use these credentials in 
adminer.php. Initially, I also tried to log in to Mantis BT using the username and password here, but it didn’t work. 
Press enter or click to view image in full size
- 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. 
Press enter or click to view image in full size
- I tried using the 
administratorandtrecredentials in the Mantis login, but none of them worked. - Next, I tried using both credentials in SSH, but it didn’t work either.
 - After a while, I tried logging in to SSH again, but this time using the 
realnamevalues as the password. 
Press enter or click to view image in full size
- I was able to get SSH on the target for the 
treuser. I also found the first flag in the working directory. 
- 0x02— Privilege Escalation and Root :
- Next, I ran 
sudo -land found the following. 
Press enter or click to view image in full size
- 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 pspy to check the running processes on the target.
 
Press enter or click to view image in full size
- 
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.
 - 
The file also had write permissions.
 - 
I overwrote the file with
chmod +s /bin/bashthat 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 shut down the system usingsudo /sbin/shutdown -r now. - 
After starting the system again, I used
/bin/bash -pwith-pfor privileged mode and immediately got a proper root shell. - 
The only step left now was to get the root flag from
proof.txt. 
With that, I was able to root the lab successfully. I hope you found this write-up useful. Don’t forget to subscribe to Avyukt Security for more quality content on cybersecurity.
Happy Hacking!