HackTheBoxActiveDirectoryWindows

Certified

Abuse ACL misconfigs to chain WriteOwner→GenericAll→Shadow Credentials, recover an NT hash, then exploit ESC9 via UPN spoofing to enroll an Admin certificate and pwn the DC.

Difficulty: Medium OS: Windows Server 2019 Domain: certified.htb / DC01.certified.htb IP: 10.129.231.186


Overview

Certified is a Windows Active Directory machine centred around certificate-based attacks (ADCS) and ACL abuse. The attack chain runs as follows:

  1. Enumerate the domain with valid low-privileged credentials (judith.mader)

  2. Abuse WriteOwner over the Management group to gain GenericAll

  3. Add judith.mader to Management, then perform a Shadow Credentials attack against management_svc to obtain its NT hash

  4. Use management_svc's privileges to change the ca_operator password and pivot to an ESC9 ADCS exploit

  5. Temporarily alter ca_operator's userPrincipalName to [email protected], enroll a certificate, and authenticate as Administrator to retrieve the root flag


Enumeration

Nmap

The scan reveals a Windows Domain Controller exposing the standard AD service stack

Key findings:

  • Domain: certified.htb

  • DC hostname: DC01

  • OS: Windows 10 / Server 2019 Build 17763

  • SMB signing is enforced (relay attacks not viable)

  • Clock skew of ~7 hours (important for Kerberos — sync time before attacking)

SMB Share Enumeration

Initial credentials judith.mader:judith09 are valid. The account has read access to IPC$, NETLOGON, and SYSVOL — standard for any domain user. No interesting shares beyond defaults.

Kerberoasting

A TGS-REP hash is returned for management_svc, which has an SPN registered against DC01. The account is a member of CN=Management,CN=Users,DC=certified,DC=htb.

Note: The hash (etype 23 / RC4) was not crackable offline — a different path was required to compromise this account.

BloodHound

BloodHound ingestion found:

  • 10 users, 53 groups, 1 computer, 2 GPOs, 1 OU, 0 trusts

The graph reveals a critical ACL chain:

This means:

  • judith.mader can take ownership of the Management group

  • After taking ownership, she can grant herself GenericAll

  • With GenericAll on the group she can add herself to it

  • Management has GenericWrite over management_svc, enabling a Shadow Credentials attack


Foothold — Exploiting ACL Chain to Compromise management_svc

Step 1 — Take Ownership of the Management Group

Step 2 — Grant GenericAll to judith.mader

Step 3 — Add judith.mader to the Management Group

judith.mader now inherits GenericWrite over management_svc through group membership.

Step 4 — Shadow Credentials Attack against management_svc

The Shadow Credentials technique writes a KeyCredential to a target account's msDS-KeyCredentialLink attribute. When GenericWrite is held over an account, this attribute can be modified to add an attacker-controlled certificate, which can then be used for PKINIT authentication (bypassing the password entirely).

Step 5 — Obtain a TGT via PKINIT

Step 6 — WinRM Shell as management_svc

Configure Kerberos for the target realm:

Connect via Evil-WinRM using Kerberos authentication:

User flag obtained.


Privilege Escalation — ESC9 ADCS Abuse to Administrator

Background — What is ESC9?

ESC9 targets certificate templates that have the CT_FLAG_NO_SECURITY_EXTENSION flag set (i.e., NoSecurityExtension in the msPKI-Enrollment-Flag attribute). When this flag is present, the issued certificate does not embed a Security Identifier (SID), meaning authentication is determined purely by the userPrincipalName (UPN) in the certificate's Subject Alternative Name. If an attacker can temporarily modify the UPN of an enrollable account to match a privileged user's UPN, they can obtain a certificate that authenticates as that privileged user.

Prerequisites for ESC9:

  • The attacker has GenericWrite (or equivalent) over an account that can enroll in the vulnerable template

  • The CA does not enforce SID binding (pre-May 2022 patch level, or StrongCertificateBindingEnforcement = 0)

Step 1 — Change ca_operator's Password

management_svc has GenericAll over ca_operator

Step 2 — Enumerate Certificate Templates

The CertifiedAuthentication template stands out:

Property
Value

Template Name

CertifiedAuthentication

CA

certified-DC01-CA

Client Authentication

✅ True

Enrollment Rights

CERTIFIED.HTB\operator ca

Certificate Name Flag

SubjectAltRequireUpn, SubjectRequireDirectoryPath

Enrollment Flag

PublishToDs, AutoEnrollment, NoSecurityExtension

Vulnerability

ESC9

The NoSecurityExtension flag is the critical indicator — certificates issued from this template will not contain a SID, making them vulnerable to UPN spoofing.

Step 3 — Recover the NT Hash

TICKET GOT EXPIRED SO HAD TO TAKE ANOTHER ONE

Step 4 — Spoof the Administrator UPN

Using management_svc's NT hash, temporarily update ca_operator's UPN to impersonate Administrator:

Step 5 — Enroll a Certificate as ca_operator

The certificate is issued with UPN [email protected] embedded in the SAN, and no SID to contradict it.

Step 6 — Restore ca_operator's UPN (Cleanup)

Operational note: Restoring the UPN immediately after enrollment is best practice — it reduces the detection window and avoids breaking ca_operator's legitimate authentication.

Step 7 — Authenticate as Administrator

Step 7 — Shell as Administrator

Root flag obtained.


Attack Chain Summary


Tools Used

Tool
Purpose

nmap

Port scanning and service enumeration

NetExec (nxc)

SMB authentication and share enumeration

GetUserSPNs.py (Impacket)

Kerberoasting

bloodhound-python

AD enumeration and graph data collection

BloodHound

ACL path analysis

bloodyAD

ACL manipulation (ownership, GenericAll, Shadow Credentials)

PKINITtools

PKINIT authentication and NT hash extraction

Certipy

ADCS enumeration and ESC9 exploitation

Evil-WinRM

Remote shell via WinRM


Key Takeaways

  • ACL abuse chains are a recurring theme in AD environments. WriteOwner is deceptively powerful — taking ownership of a group opens the door to GenericAll and everything that follows.

  • Shadow Credentials is a stealthy technique that avoids modifying passwords; it only writes to msDS-KeyCredentialLink, which may not be monitored in many environments.

  • ESC9 is subtle because the template itself doesn't have misconfigured permissions — the vulnerability is the absence of the security extension, combined with the ability to temporarily change a UPN. Defenders should audit msPKI-Enrollment-Flag for NoSecurityExtension on any template allowing client authentication.

  • Always sync your clock with the target DC when attacking Kerberos — a skew over 5 minutes will cause all ticket requests to fail.

Last updated