• We just launched and are currently in beta. Join us as we build and grow the community.

Hack the Box: Heist Walkthrough

burrito45

Malware Analyst
B Rep
0
0
0
Rep
0
B Vouches
0
0
0
Vouches
0
Posts
58
Likes
80
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 500 XP
Hello! Everyone and Welcome to yet another CTF challenge from Hack the Box, called ā€˜Heist,ā€™ which is available online for those who want to increase their skills in penetration testing and Black box testing. Heist is a retired vulnerable lab presented by Hack the Box for making online penetration testing practice suitable to your experience level; they have a large collection of vulnerable labs as challenges ranging from beginner to expert level.

Level: Easy

Task: Find user.txt and root.txt in the victimā€™s machine

Penetration Methodologies

Scanning

  • Nmap

Enumeration

  • Browsing HTTP service
  • Extracting and decrypting User Information from config.txt

Exploitation

  • Bruteforcing more users using impacket tool

Privilege Escalation

  • Using WinRm to get Root Access
  • Uploading Procdump64.exe to dump process
  • Capturing the flag

Walkthrough

Network Scanning

Letā€™s get started then!

Since these labs have a static IP, the IP address for Heist is 10.10.10.149. Let us scan the VM with the most popular port scanning tool, nmap.

Code:
nmap -sC -sV -p- 10.10.10.149

We learned from the scan that we have the port 80 open which is hosting Microsoft IIS httpd 10.0 service, and we have the port 135,445,5985,49669 open. This tells us that we have the Microsoft windows Rpc and Microsoft HTTP API service running on the target machine respectively.

1.png


Enumeration

For more details, we will navigate to a web browser for exploring HTTP service since port 80 is open, which has a login portal.

2.png


Thereā€™s also an option to login as a guest so letā€™s try that.

3.png


From the picture above, We can see while login as a guest there is a user called hazard has posted an issue with his cisco router and has attached the configuration of it. Letā€™s open the file in the browser and see what information we get.

4.png


By reading the configuration files we can see that it contains two cisco type 7 and one cisco type 5 passwords.

We can decrypt type 7 passwords using a tool online tool. Following link :

Code:
http://ibeast.com/tools/CiscoPassword

5.png


So here are the credentials we have collected till now:

Code:
rout3r: $uperP@ssword

5a.png


Code:
admin: Q4)sJu\Y8qz*A3?d

Also, we decrypted Cisco type 5 hash using hashcat command below

Code:
hashcat -m 500 pass.txt /usr/share/wordlists/rockyou.txt --force --outfile output.txt

5b.png


Which successfully cracked hash $1$pdQG$o8nrSzsGXeaduXrjlvKc91 : stealth1agent

We tried all the combinations as well as to use these credentials on login portal but we failed to login.

Coming back to nmap scan. We can see that port 5895 is open which is used by Microsoft Windows Remote Management), which is basically a service/protocol used to manage remote systems.

So we tried to bruteforce more users with the tool Impacket. You can read more about the tool from here. And download the tool from https://github.com/SecureAuthCorp/impacket

Code:
python lookupsid.py Hazard:[email protected]

6.png


So to try these users with the combination of passwords we got earlier. We use a very great tool available WinRm shell for hacking/pentesting.

Code:
https://github.com/Hackplayers/evil-winrm

We tried all these users with the password and the pair below worked.

Code:
"Chase:Q4)sJu\Y8qz*A3?d"

Also, make sure to create ps1_scripts and exe_files directories in your home otherwise the tool wonā€™t work. (mkdir ps1_scripts & mkdir exe_files)

Code:
evil-winrm -i 10.10.10.149 -u chase -p 'Q4)sJu\Y8qz*A3?d' -s './ps1_scripts/' -e './exe_files/'
whoami
cd ..
cd Desktop
cat user.txt

Here we managed to get user.txt as our first flag.

7.png


Privilege Escalation

Now that we had a user.txt we have to find root.txt. So, after searching for a while we found that firefox instance was running.

Code:
cd appdata\Roaming\Mozilla\firefox

8.png


We uploaded procdump64.exe to dump one of the processes. You can download procdump64.exe from here.

Code:
upload /var/www/html/procdump64.exe
ps

After uploading procdump64.exe. We saw that there was 4 firefox process were running. So we took the having the highest CPU usage.

9.png


Code:
./procdump64.exe -ma 7024

This created a dump file and to analyse and search for sensitive information from dump file we used Winrm shell itself.

As the dump file has a lot of information so we use Select-String to filter the information as Select-String in PowerShell is similar to grep in Linux.

Code:
Firefox.exe_191291_111009.dmp | Select-String "username="

10.png


Here we got administrator credentials. So we try to login as administrator in WinRm shell and try to capture the root flag.

Code:
evil-winrm -i 10.10.10.149 -u administrator -p '4dD!5}x/re8]FBuZ' -s './ps1_scripts/' -e './exe_files/'
whoami
cd ..
cd Desktop
cat root.txt

11.png


Author: Prabhjot Dunglay is a Cyber Security Enthusiast with 2 years of experience in Penetration Testing at Hacking Articles. Contact here.
 

431,509

312,456

312,465

Top