Sauna HTB Walkthrough

Nov 3, 2024    #box   #htb   #easy   #windows   #ldap   #kerberos   #active-directory   #kerberoasting   #asreproasting   #printnightmare   #cve-2021-1675  

Sauna Hack The Box Walkthrough/Writeup:

How I use variables & Wordlists:

1. Enumeration:

NMAP:

Basic Scans:

Comprehensive Scans:

LDAP 389:

Using LDAP to enumerate further:

Updating ETC/HOSTS & Variables

Syncing Clocks for Kerberos Exploitation:

DNS 53:

RPC:

Kerberos 88:

Using Kerbrute to bruteforce Usernames:

Trying Usernames as Passwords:

ASREPRoasting:

Using netexec for ASReproasting:
Using Impacket-GetNPUsers for asreproasting:

Cracking fsmiths asrep hash using hashcat:

SMB 445:

Attempting to connect with NULL & Guest sessions:

Web 80:

Enumerating Injection Points:

Verb Tampering Enumeration:

Dirbusting the webserver using ffuf:

2. Foothold:

Enumerating as fsmith:

Enumerating shares:

Enumerating the host via evil-winrm:

Checking privileges and group membership:

Enumerating users:

Enumerating Users & Groups on the domain using impacket-lookupsid:

Using smbclient to enumerate shares:

Kerberoasting hsmith:

As we have credentials we can perform kerberoasting:

Cracking hsmith’s password with hashcat:

Enumerating as hsmith:

Creating an LNK file on the rico share:

LNK attack Explanation:

Performing a bloodhound scan:

Enumerating description fields using rpcclient:

3. Privilege Escalation:

Privilege escalation Route 1 PrintNightmare:

Discovering the host is susceptible to PrintNightmare vulnerability:

Privilege escalation Route 2 svc_loanmgr:

Approach 1: Using winpeas to find clear-text creds stored in Registry Keys:

Approach 2: Manually Enumerating Registry Keys for Valuable Information:

Discovering svc_loanmgr has DC-Sync privileges:

Overview of these rights:

Replicating Directory Change (GetChanges):
Replicating Directory Changes All (GetChangesAll):

4. Ownership:

Privilege escalation Route 1 PrintNightmare:

Creating a new administrator user using CVE-2021-1675 (PrintNightmare exploit):

  1. Download POC:

    • git clone https://github.com/calebstewart/CVE-2021-1675.git
    • This is the exploit I have used before so will use again.
  2. Using our existing fsmith credentials upload the script via evil-winrm:

  3. Bypass Execution Policy:

    • Set-ExecutionPolicy Bypass -Scope Process
  4. Import the exploit Module:

    • Import-Module .\CVE-2021-1675.ps1
  5. Add our new user with PrintNightmare PowerShell PoC:

    • Invoke-Nightmare -NewUser "bloodstiller" -NewPassword "Pwnd1234!" -DriverName "PrintIt"
  6. Confirm our user added is added:

    • net user bloodstiller
    • We can see we have local admin privs.

Connecting as our new local-admin user:

Privilege escalation Route 2 svc_loanmgr:

Performing a DC-SYNC attack as svc_loanmgr:

5. Persistence:

Dumping NTDS.dit/DC-SYNC attack:

Creating a Kerberos Golden Ticket:

Why create a golden ticket?

Lessons Learned:

What did I learn?

  1. I should always check for password re-use even between accounts!
  2. It was good to attack this from a privilege escalation point of view from 2 different angles, showing the more recent PrintNightmare as well as the intended route of WinLogon clear-text creds.

What silly mistakes did I make?

  1. Should have copied and pasted, ended up writing suana instead of sauna in my /etc/hosts

Sign off:

Remember, folks as always: with great power comes great pwnage. Use this knowledge wisely, and always stay on the right side of the law!

Until next time, hack the planet!

ā€“ Bloodstiller

ā€“ Get in touch bloodstiller at proton dot me



Next: Active HTB Walkthrough