HTB - Voleur

Description
Assume breach: the compromise begins with access to a shared IT folder containing an encrypted Excel file. After cracking it, multiple credentials were recovered, including two valid domain accounts. one with elevated privileges such as WriteSPN and GenericWrite over a user and an OU. A targeted Kerberoasting attack was performed, resulting in obtaining another user that can access the machine via winRM.
Using RunasCs, the attacker impersonated another user and abused GenericWrite on the OU to restore a deleted user account. This restored user had access to a previously restricted subfolder in the IT share, which contained an archived profile and encrypted DPAPI credentials. With the previously discovered password, the credentials were decrypted, revealing another domain account with access to a different subfolder.
There, a private SSH key and a note file were found, which allowed access to a WSL instance running on the host via SSH. The shared IT folder was mounted within WSL, and inside it, a backup directory was discovered containing the ntds.dit file and the system registry hive. After exfiltrating both files, the attacker extracted the hashes and Kerberos keys of domain users, ultimately gaining Domain Admin access.
Enumeration
As is common in real life Windows pentests, you will start the Voleur box with credentials for the following account:
ryan.naylor / HollowOct31Nyt
Before I began, I exported IP, Username, Password, Domain to variables for easy usage
Then, I started with normal Nmap scan to find all open ports
Nmap Scan
Exported all open ports to a variable and ran the script and version detection scans
Summary
I always update /etc/hosts before I attack the domain to avoid any tooling issues
Using valid domain credentials, I began by enumerating SMB shares but encountered a STATUS_NOT_SUPPORTED error. This indicated that authentication to the domain had failed. I also noticed NTLM:False, meaning only Kerberos authentication was allowed.
When I switched to kerberos authentication -k flag, I found shares folder including accessible IT folder with READ access

Alternatively, you can ask TGT from the DC, export it to KRB5CCNAME, and auth with it to dc

Inside the shared folder, there is interesting file Access_Review.xlsx, so I downloaded it to examine to in my kali machine
Note: for
smbclient.pyto work with kerberos authentication, you must supply the target host as FQDN (dc.voleur.htb)

The file appeared to be encrypted, so I used office2john tool to extract the hash and try to crack it offline
The hash was cracked successfully using hashcat
Then, I opened the file with Miscrosoft Office and inside the file there was list of usernames with note corresponding to each of them.
todd.wolfeuser appears to be deleted and his password is in the notelacey&Jeremy&svc_winrmare members inRemote Management UsersThere are passwords for
svc_ldap&svc_iisusers

I tried to check if any password of them worked and I managed to get two users svc_iis & svc_ldap

Looking at
Bloodhound-GUI, I foundsvc_iishas no privileges butsvc_ldaphas:He is a member in
Restore_UsersGroupGenericWriteonSECOND LINE SUPPORTOU andlaceyuserWriteSPNonsvc_winrmuser


To summarize the steps I did:
With
GenericWriteon OU and from group namedRestore_users, I thought that I could restore any deleted object from this OU.With
WriteSPNonsvc_winrmandGenericWriteonlacey, I could assign them a Service Principal Name (SPN), then request service ticket to crack it offline and get their passwords
Foothold
WriteSPN
Perform kerberoasting attack

I hash of svc_winrm was cracked successfully but lacey wasn't :((
Since kerberos authentication is enforced, I had to edit /etc/krb5.conf to able to use kinit and evil-winrm
Get a ticket for svc_winrm

User Flag: 8bbbc0ca204f9f6xxxxxxxxxxxxxxxxxxx
Lateral Movement
I found nothing interesting or any escalation paths from svc_winrm shell, So I had to get the shell as svc_ldap to try abusing GenericWrite permission on the OU.
I used Invoke-RunasCs.ps1 to get a session as svc_ldap

Next, I enumerated deleted objects in the domain and found the user todd.wolfe, which matched the deleted account listed in the Excel sheet. According to the same sheet, he was a member of the "Second Line Support" group. Since I had GenericWrite permissions on the "Second Line Support" OU through membership in the "Restore Users" group, I suspected I could restore the account.

Then, I ran restore-ADObject with GUID of the user to restore it
Confirm
With todd.wolfe credentials, I looked at IT share again and Inside it, I found archived user folder:

When landing in User's folder, I always search for hardcoded passwords, DPAPI credentials, PowerShell History and more. I didn't find any of them except DPAPI
There are DPAPI credentials under AppData\Roaming\Miscrosoft\Credentials\772275FAD58525253490A9B0039791D3 and the masterkey location is AppData\Roaming\Microsoft\Protect\S-1-5-21-3927696377-1337352550-2781715495-1110\08949382-134f-4c63-b93c-ce52efc0aa88

Download the two files
I extracted the masterkey using dpapi.py after supplying it with User's SID, Password I found in xlsx sheet and key file

Finally, extract the secrets using masterkey from the previous step

Privilege Escalation
With jeremy credentials, I could access Third Line Support in IT share and downloaded the files inside it

The first file was private key and the second one was a note to jeremy telling him that he configured windows subsystem for Linux (WSL) for the backup operations.
I noticed from the nmap results that an SSH service was running on port 2222, which likely indicated a WSL instance. I attempted to connect using the private key but wasn’t sure which username to use. I tried jeremy and root, but both attempts failed.
The note.txt file written by someone handling backups on the server. Since there was a domain account named svc_backup, I tried connecting with that and it worked! I successfully accessed the WSL environment.

The user is sudo group, so I escalated to root easily
After enumerating the Linux server, the only notable finding was the svc_backup hash in /etc/shadow, which couldn’t be cracked. However, since WSL runs within a Windows environment, I knew its file system would be mounted somewhere on the Windows host—and conversely, parts of the Windows file system might also be accessible from within WSL.
Then, I looked for /mnt folder (Commonly used for mounting) and I found c folder is mounted there. Inside IT share, there is Backups folder only accessible by svc_backup user containing system registry key and DC database ntds

Download the two files:

Extract administrator hash and kerberos keys
Get root flag

Root Flag: 05f6ba8cf4caf09exxxxxxxxxxxxxxx
Last updated