Capture the flag (CTF)

Hack the Box (HTB) machines walkthrough series — Nest, part 2

Security Ninja
August 3, 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 Nest. This is the second half of the walkthrough; you can look at part 1 to see the beginning of this walkthrough, and I highly recommend doing so.

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.

Enjoy CTFs? Take our challenge!

Enjoy CTFs? Take our challenge!

Test your hands-on skills, earn bragging rights and win your share of $1,000+ in prizes. Do you accept the challenge?

Note: Only write-ups of retired HTB machines are allowed. The machine in this article, named Nest, is retired.

The walkthrough

As shown in Part 1 of this article series, we have reached the point where we have a .sln file and username (c.smith) and a password hash.

  1. Since this is a VB Project file, I could see that there are encrypt and decrypt functions. I modified the script a bit to only work with the decrypt function. The first parameter to this function was the hash, so I pasted in the hash we have recovered earlier and returned the password to the screen. [CLICK IMAGES TO ENLARGE]
  2. Now let’s try the recovered password for c.smith and perform enumeration again.
  3. As you can see, we can now retrieve the user.txt file.
  4. Let’s now again perform enumeration from this user to escalate privileges. There is a “HQL Reporting” folder and under that, we have some interesting files.
  5. Looking into the xml file reveals some interesting contents. There is a possible service on port 4386. If you look into the Nmap scan results in part 1, it also confirmed the existence of this port.
  6. The .txt file initially looked empty, but in its ADS, we can see some bytes. Downloading those reveals a string, which can be a password.

  7. Now, since service in port 4386 is mentioned, let’s connect to it via Telnet. We can do that successfully. Running the help command reveals some interesting commands and, and the debug command has a password option. Running that command with the recovered password and listing out help gives some more options.
  8. Change directories using the SETDIR command and go to the LDAP directory. Under that, we’ve got LDAP.conf, which reveals the administrator hash.

  9. In the same directory, we have an .exe file as well. After downloading it on a local machine, since it is a compiled file, we have to disassemble it. After doing that, under the LDAP directory, we can see some more encryption and decryption functions. These functions were similar to what we saw in part 1.
  10. I used the existing VB class and changed the parameters as mentioned above, along with the administrator hash.
  11. Once we recovered the password, we can access the SMB shares using the administrator password and can obtain the root flag.

This machine was purely based on just enumeration and shows the importance for the same.

What should you learn next?

What should you learn next?

From SOC Analyst to Secure Coder to Security Manager — our team of experts has 12 free training plans to help you hit your goals. Get your free copy now.

Thanks for following along with me today. We will continue this series with more in the way of interesting HTB machines.

Security Ninja
Security Ninja

THE PLANETS EARTH: CTF walkthrough, part 1

EMPIRE BREAKOUT: VulnHub CTF walkthrough

JANGOW: 1.0.1: CTF walkthrough