Today, we will be continuing with our exploration of Hack the Box (HTB) machines as seen in previous articles. This walkthrough is of an HTB machine named Traverxec.
HTB is an excellent platform that hosts machines belonging to multiple OSes. It also has some other challenges as well. Individuals have to solve the puzzle (simple enumeration plus pentest) in order to log into the platform and download the VPN pack to connect to the machines hosted on the HTB platform.
Note: Only write-ups of retired HTB machines are allowed. The machine in this article, named Traverxec, is retired.
Let’s start with this machine.
- Download the VPN pack for the individual user and use the guidelines to log into the HTB VPN.
- The Traverxec machine IP is 10.10.10.165.
- We will adopt our usual methodology of performing penetration testing. Let’s start with enumeration in order to gain as much information about the machine as possible.
- As usual, let’s start with the nmap scan to gather more information about the services running on this machine. [CLICK IMAGINES TO ENLARGE]
<<nmap -sC -sV -oA Traverxec 10.10.10.165>>
- It can be seen that it used nostromo with version 1.9.6. A quick search revealed an exploit for it as well.
- We download the exploit and get a shell with it below.
- We can see that we got the shell back with user www-data.
- We cannot read the user flag with this permission, so we need to escalate our permissions.
- After enumerating a bit more, we could see the following httpd.conf file.
- Below are the contents of the httpd.conf file. As we can see, the home directory whitelisting has been done.
- We can go to public_www under david’s directory.
- Downloading it to the attacking machine and unzipping the above backup file reveals a key pair.
<<tar zxvf daidfile.tgz>>
- But the key is encrypted.
- We use ssh2john to convert the key for brute-force by john.
<<python /usr/share/john/ssh2john.py id_rsa > david.hash>>
- Running john against the david.hash, we got the password for it.
<<john david.hash –wordlist=rockyou.txt>>
- Using the key and recovered password to log into the machine as david.
- Grabbing the user.txt file.
- Let’s escalate the permissions to grab the root.txt file. The below file suggests we can run journalctl with sudo.
- Referring to GTFObins for journalctl, we spawn a new shell with appropriate size and run the below command. We got root shells.
- Finally, we grab the root password.
This was a straightforward machine with an easy initial hold and then a straightforward but tricky privilege escalation.
We will continue this series with more such interesting HTB machines.