Hack the Box (HTB) machine walkthrough series: Vault
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 Vault.
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 Vault, 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 “Vault” machine IP is 10.10.10.109.
- We will adopt our usual methodology of performing penetration testing. Let’s start with enumeration in order to learn as much information as possible.
- As usual, let’s start with the Nmap scan to gather more information about the services running on this machine. [CLICK IMAGES TO ENLARGE]
nmap -sC -sV -oA Vault 10.10.10.109
- Let’s start the enumeration with port 80. Below is the page we get on port 80.
- Based on the above, it looks like Sparklays can be a sub-directory under root.
- We’ll add that to the base URL and brute-force the directory names, using Gobuster.
- We got a design under Sparklays. Enumerating that further, we got uploads and design.html also.
- Except design.html, we got access denied on all the pages. On design.html, we have a way to upload a logo and we can try to see if we can upload a reverse shell to it.
- Intercepting the responses using Burp, we can fuzz the PHP extension (as shown below) and all the variants of possible PHP formats.
- After triggering, we can see the response length of php5 is different and it shows the message of a successful upload.
- After modifying the file extension to php5 and accessing it under uploads directly, we got a reverse shell back:
- Enumerating the directory under Dave’s, we got folders. Under shh, we got a phrase.
- Using that to SSH as “dave” worked.
- Continuing the enumeration under Dave’s home directory, we got a key and servers list.
- Interestingly, the servers list is on a different interface, which means the further enumeration needs to happen on the devices on that interface.
- We need to start the enumeration further on the above two IPs. We got hits on port 80.
- In order to access that, we need to do the port forwarding locally.
- Let’s access it now. We can see that we got two links to modify and test the VPN configurations.
- We can abuse it, as shown below with the listed reverse shell.
- Let’s open a listener on the Ubuntu box, as shown below. After execution of above, it throws a reverse shell back.
- We can enumerate to collect the user.txt flag.
- Let’s try to SSH from Ubuntu to the DNS server as Dave.
- Once we are in DNS server, then we can see that Dave is part of the sudo group and can execute all as root.
- On the DNS box, we have the following entries. It connects to the Vault box as well.
- Enumerating the Vault box from DNS results in the following services hits.
- Looking into the log events, it turns out that the it is listed how the Ncat command should run, i.e., with source port of 4444 and then trying to connect to port 53.
- Enumerating the services with source port 4444 reveals the expected port 987.
- Checking the service behind port reveals SSH service.
- From the DNS machine, we can run the SSH with the switch to run a proxy command by connecting to the machine as Dave.
- As we are in a Vault machine, we got a root flag in GPG format encrypted with an RSA key.
- Back in the Ubuntu machine, we have got some GPG keys.
- So, we have to bridge the gap from Ubuntu to DNS to Vault. Let’s do port forwarding from DNS to Vault and then access the forwarded port on DNS to fetch the GPG back to Ubuntu.
- Once we have the root.txt.gpg locally on the Ubuntu box, we can decrypt it with the key under Dave’s home directory. Finally, we got the root flag.
Wow, what a fantastic box! This involves a lot of enumeration and more: right from directory enumeration to extension fuzzing to hopping to multiple boxes to collect the flags, this box covers it all.
We will continue our HTB series with more examples of machines very soon.
We've encountered a new and totally unexpected error.
Get instant boot camp pricing
A new tab for your requested boot camp pricing will open in 5 seconds. If it doesn't open, click here.