TryHackMe - Tomghost
Last updated
Last updated
Step 1 - Reconnaissance
First step is to enumerate the machine. A simple nmap scan will do it:
Step 2 - Web Exploitation
From the following Nmap scan, we can see that the box is vulnerable to CVE-2020-1938. Simple research revealed that this version of Apache Tomcat appears to be vulnerable to File Reading/Inclusion. The following exploit can allow us to read sensitive information, such as login credentials.
Article: nvd.nist.gov/vuln/detail/CVE-2020-1938 Exploit: exploit-db.com/exploits/48143
Download the exploit and run it using
You should see a similar output:
You should see the credentials at the end of the output.
Step 3 - User.txt
Use the following credentials to log into the machine via ssh.
After that, you can immediately get user.txt by browsing to **/home**
and visiting another user's directory.
Step 4 - Horizontal privilege escalation
Go back to the initial user's home folder and take a look at what we got there. We can see that there are exactly 2 files: **credential.pgp**
and **tryhackme.asc**
. As we can easily guess, those files will reveal us some credentials (most likely for the second user).
A simple google search on PGP cracking led me to this article. This small guide tells us to crack the **.asc**
file with john the ripper and then use it to open up the PGP.
Let's first convert the **.asc**
file into a suitable format by running:
Then, what we need to do is simply run a rockyou-powered cracking process on the **hash**
file:
A password is going to be revealed in a couple of seconds and we can finally use it to open up the **.pgp**
file. Run the following command and enter the password:
You can now easily open the PGP file after importing the key.
Bingo! We got the credentials. Now let's ssh into the box and enumerate there.
Step 5 - Root
**sudo -l**
reveals that we can run **/usr/bin/zip**
as sudo. A given configuration is relatively famous and is covered by GTFOBins.
Link: https://gtfobins.github.io/gtfobins/zip/#sudo
Let's follow the guide from GTFO and get the root shell!
Done! We now have root access and can finally read the **/root/root.txt**
.
Thank you for reading!