Monteverde – HackTheBox Walkthrough

Introduction:

The purpose of this blog is to document the steps I took to complete hacking task of Monteverde machine from Hack The Box (HTB).

Resources/Tools Used:

Process Followed:

After connecting HTB lab through VPN, started Monteverde (10.10.10.172) machine. To check the available services, I scanned the machine with nmap scanning all ports and doing a quick scan as follows:

nmap quick scan

Quick scan showed quite a few open ports including DNS(53), Kerberos (88), RPC (135), LDAP(389), SMB (445) and WSMAN (5985). To detect services running on these ports and OS scanned using -A option as follows:

nmap aggressive scan

Scanned LDAP scripts against the target machine that identified domain name as “MEGABANK.LOCAL”.

nmap script (ldap) scan

Tried anonymously connecting and listing SMB shares but listing was denied for anonymous user. Ran enum4liux to further enumerate information from the server.

enum4linux

Extracted domain users from enum4linux output and copied them to a file “usernames.txt”.

Domain user list

Tried brute forcing smb service to identify password using Metasploit auxiliary module ”scanner/smb/smb_login”. This is to identify if we have any users with username as password. For this we used same file “usernames.txt” (consisting of domain users identified from enum4linux) for user and password files.

SMB Brute force attack

Upon executing this module, identified “SABatchJobs” using id as password.

SABatchJobs password found

Using this we used smbclient to list SMB shares.

SMB shares listing

Connected using SABatchJobs to browse, download and find some interesting information from files shared on “users$”.

user$ share

Found one interesting file “azure.xml” under mhope directory. Upon reading contents of this file found a password.

azure.xml

To check the password, used Metasploit auxiliary module “scanner/smb/smb_login”. Tried the identified password (from azure.xml file) against domain users.

User mhope password found

The password found belonged to user mhope. As port 5985 for Windows Remote Management was open so tried connecting using Evil-WinRM with user mhope.

Accessing target machine with user mhope

Browsed to Desktop folder to capture the user flag.

User flag

Uploaded winPEAS to check what options are available for privilege escalation from user mhope to Administrator. Ran winPEAS but did not find any useful information.

Upload winPEAS.exe

Noticed that user mhope is member of “Azure Admins” group.

mhope group membership

Referred to following article and corresponding PowerShell script for privilege escalation to Administrator:

https://blog.xpnsec.com/azuread-connect-for-redteam/

https://github.com/Hackplayers/PsCabesha-tools/blob/master/Privesc/Azure-ADConnect.ps1

Above article and corresponding script highlight using “Azure-ADConnect.ps1” PowerShell script to get Administrator password. This is done by extracting credentials from the Azure AD Connect service.

Firstly, uploaded “Azure-ADConnect.ps1” PowerShell script to target machine.

Upload Azure-ADConnect.ps1 script

Imported the script and then executed the script to be run on local host as it is executed on target machine.

Administrator password

After getting Administrator password logged in using Evil-WinRM. Then browsed to Desktop folder under Administrator user and there was “root.txt” file stored in this directory. Read the contents of file root.txt to capture the root flag.

Root flag

Alternatively, as Administrator password is known we can use smbclient to login and download “root.txt” from the Administrator’s Desktop directory to our local/attack machine. Once downloaded we can read contents of “root.txt” to get the root flag.

Root flag using smbclient

Submitted the flags (user and root) on HTB website to own machine and increase our owned machine count.

I hope this helped. Thanks.

Leave a comment

Design a site like this with WordPress.com
Get started