Sitemap
InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/

TryHackMe Reset Writeup

7 min readJul 8, 2024

--

Press enter or click to view image in full size

In this walkthrough, we are going to attack a hard-rated Active Directory machine on TryHackMe, utilizing various advanced techniques. The journey began with an Nmap scan and exploring SMB shares. Initial attempts with ExifTool yielded no results, but we discovered a user and password in a PDF file. Progress seemed stalled until employing RID brute-forcing and Kerbrute for user enumeration, leading to a successful AS-REP roasting attack. Using Hashcat, we cracked the hash for user Tabatha but struggled with others.

Examining Tabatha’s privileges via SMB revealed writable access, setting the stage for a phishing technique known as SCF. After setting up the payload and placing it on the SMB server, we launched Responder and captured an NTLMv2 hash, which was cracked with Hashcat.

With updated credentials, we verified users via rpcclient and tested privileges over various protocols using NXC. Gaining access through WinRM and RDP, we encountered active antivirus protection, which blocked typical post-exploitation tools. Adapting our approach, we utilized BloodHound to map the AD environment, identifying a path from Tabatha to Darla. By exploiting constrained delegation rights, we ultimately escalated to Domain Admin. Without speaking too much, let’s jump in!

Scenario:

Press enter or click to view image in full size

1. Enumeration

As always we start with an nmap scan. -sV to get the version data, -sC to run default scripts and -o to save the output.

Press enter or click to view image in full size

It looks like we are dealing with a classical AD built, nothing intresting here. We saved the hostname that we got from nmap scan to our /etc/hosts file and let’s check the SMB.

Press enter or click to view image in full size

We’ve found 3 files under onboarding directory, let’s check whether if we can find anything interesting in them or not.

Press enter or click to view image in full size

Indeed we’ve got a possible username and a password, but unfortunately I wasn’t able to proceed with these credentials in any protocol or login interface.

We used NetExec’s --rid-brute function to obtain possible usernames from the machine.

Press enter or click to view image in full size

We got a bunch of usernames, let’s check whether they are real or not with Kerbrute.

Press enter or click to view image in full size

It looks like these users actually does exist. Now let’s make an Asrep-Roasting attack to see if we can get anything with the users we have.

Press enter or click to view image in full size

We got Tabatha’s hash as well as 2 others, but no matter which wordlist I used or which rule I used, I couldn’t crack the other two.

Press enter or click to view image in full size

But at least I was able to crack Tabatha’s hash. Now let’s check what she is can do with these credentials.

Press enter or click to view image in full size

2. Exploitation

In looks like we can write or upload stuff to the smb server. Here in this case we can do a Phising attack. We are going to make a SCF File Attack to get possible hashes of other users. This technique is taught in OSCP — Pen200. It can be summarized like this:

SCF (Shell Command File) attacks exploit a feature in Windows that automatically executes commands in SCF files when they are viewed in a directory. Here’s a brief overview of how these attacks work:

1. Crafting the SCF File:
— An attacker creates an SCF file containing a command to connect to a malicious server, like \\attacker-server\share

2. Placing the SCF File:
— The attacker places the SCF file in a location the victim will access, such as a shared drive or an email attachment.

3. Capturing Credentials:
— When the victim’s system processes the SCF file, it attempts to authenticate to the attacker’s server, sending hashed credentials.
— The attacker captures these hashes.

4. Cracking the Hash:
— Using tools like Hashcat, the attacker cracks the captured hash to obtain the victim’s password.

Get Firat Demir’s stories in your inbox

Join Medium for free to get updates from this writer.

We’ll firstly create a file ,name it randomly and Put an @ at the beginning of its name to make it on top of the files list.

Now we're going to apply stage 2. Upload the file.

Press enter or click to view image in full size

Now that we are ready to go, we can lauch responder to capture the hashes.

Press enter or click to view image in full size

After a short while ,we got a click on our “Gift” :)

Press enter or click to view image in full size

looks like user “automation” just ran our .url file now we have it’s hash in NTLMv2 . Let’s crack it!

Press enter or click to view image in full size

We have got the password, let’s add it to our passwords list and proceed to attack.

Press enter or click to view image in full size

Checking what can we do on which protocol, I see we can log into Winrm.

Press enter or click to view image in full size

As well as we can login rdp via Tabatha user

Press enter or click to view image in full size

Let’s log in winrm with automation’s account and check our privileges.

Press enter or click to view image in full size

No dangerous token, no any interesting file, server is fully patched and up to date as what TryHackMe stated.

Press enter or click to view image in full size

And the AV is running too, blocking our PE tools. Let’s check whether the Real-Time Protection is on or not.

Yes, it is working. Tried to shut it down too. But Access Denied

Press enter or click to view image in full size

After so many tries to bypass the AV and get my things working I finally decided to continue our operations remotely, not on the windows. We’ll firstly use bloodhound-python remotely to map out the target.

Press enter or click to view image in full size

Let’s start to analyze what we have here.

3. Privilege Escalation

Well, the situation looks a bit “unfortunate” :D

Press enter or click to view image in full size

After some research, we discovered that the user “TABATHA_BRITT” has GenericAll privileges over “SHAWNA_BRAY”. This means that “TABATHA_BRITT” has full control over “SHAWNA_BRAY”.

In turn, “SHAWNA_BRAY” has ForceChangePassword control over “CRUZ_HALL”, allowing “SHAWNA_BRAY” to change “CRUZ_HALL”’s password.

Finally, “CRUZ_HALL” has GenericWrite permissions over “DARLA_WINTERS”, giving “CRUZ_HALL” the ability to modify properties of “DARLA_WINTERS”

Thankfully, bloodhound also explains to us how to exploit these kinds of misconfigurations. So let’s get into work! : )

We’ll “reset” the password of those users, name of the machine suggests.

Press enter or click to view image in full size

Now we’ve got RDP control ever “DARLA_WINTERS” she is able to make Constrained Delegations.

At this point, we’ll use Impacket’s getST.py tool to perform this attack.

Press enter or click to view image in full size

We’ll make the syntax up for our case and use cifs as service and export the ticket.

Press enter or click to view image in full size

Boom, we elevated our privileges to the Administrator.

Press enter or click to view image in full size

This was one of the best machine for me in THM, I enjoined it a lot. It was a fantastic experience for me, and I had a lot of fun solving the challenge and writing the walkthrough. Thanks for reading, and I hope you enjoyed it!

Please do not hesitate if you have any questions, you can reach me out from:

LinkedIN — https://www.linkedin.com/in/f%C4%B1rat-demir/

Discord — @ rootofnull

E-Mail — Firat.Demir1337@gmail.com

--

--

InfoSec Write-ups
InfoSec Write-ups

Published in InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/