Capture the flag (CTF)

Hack the Box (HTB) machines walkthrough series — Traverxec

May 21, 2020 by Security Ninja

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.


The walkthrough

Let’s start with this machine.

  1. Download the VPN pack for the individual user and use the guidelines to log into the HTB VPN.
  2. The Traverxec machine IP is
  3. 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.
  4. 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>>

  5. It can be seen that it used nostromo with version 1.9.6. A quick search revealed an exploit for it as well.
  6. We download the exploit and get a shell with it below.
  7. We can see that we got the shell back with user www-data.
  8. We cannot read the user flag with this permission, so we need to escalate our permissions.
  9. After enumerating a bit more, we could see the following httpd.conf file.
  10. Below are the contents of the httpd.conf file. As we can see, the home directory whitelisting has been done.
  11. We can go to public_www under david’s directory.
  12. Downloading it to the attacking machine and unzipping the above backup file reveals a key pair.
    <<tar zxvf daidfile.tgz>>

  13. But the key is encrypted.
  14. We use ssh2john to convert the key for brute-force by john.
    <<python /usr/share/john/ id_rsa > david.hash>>

  15. Running john against the david.hash, we got the password for it.
    <<john david.hash –wordlist=rockyou.txt>>

  16. Using the key and recovered password to log into the machine as david.
  17. Grabbing the user.txt file.
  18. Let’s escalate the permissions to grab the root.txt file. The below file suggests we can run journalctl with sudo.
  19. Referring to GTFObins for journalctl, we spawn a new shell with appropriate size and run the below command. We got root shells.
  20. 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.

Posted: May 21, 2020
Security Ninja
View Profile