Abuse Info
An attacker may perform this attack in the following steps:Step 0.1: Obtain ownership (WriteOwner only)
If you only have WriteOwner on the affected certificate template, then you need to grant your principal ownership over the template.Windows
Use the following PowerShell snippet to check the current ownership on the certificate template:Linux
To check the current owner of the certificate template, you may use Impacket’s owneredit:Step 0.2: Obtain GenericAll (WriteOwner, Owns, or WriteDacl only)
If you only have WriteOwner, Owns, or WriteDacl on the affected certificate template, then you need to grant your principal GenericAll over the template.Windows
Use the following PowerShell snippet to grant the principal GenericAll on the certificate template:Linux
Impacket’s dacledit can be used for that purpose:Step 0.3: Make certificate template ESC1 abusable (Linux only)
If you have an GenericAll edge to the CertTemplate node, or if you have just granted yourself GenericAll, then you can use this step from a Linux host to make the template abuseable to ESC1 using Certipy. If you do not have GenericAll on the CertTemplate or if you are operation from a Windows host, continue to the next step. Overwrite the configuration of the certificate template to make it vulnerable to ESC1:Step 1: Ensure the certificate template allows for client authentication
The certificate template allows for client authentication if the CertTemplate node’s Authentication Enabled (authenticationenabled) is set to True. In that case, continue to the next step.Windows
Use the following PowerShell snippet to check the values of the pKIExtendedKeyUsage and msPKI-Certificate-Application-Policy attributes of the certificate template:Linux
Check the current value of the msPKI-Certificate-Application-Policy and pKIExtendedKeyUsage attribute on the certificate template using ldapsearch and note it down for later:Step 2: Ensure the certificate template requires enrollee to specify Subject Alternative Name (SAN)
The certificate template requires the enrollee to specify SAN if the CertTemplate node’s Enrollee Supplies Subject (enrolleesuppliessubject) is set to True. In that case, continue to the next step. The certificate template requires the enrollee to specify SAN if the CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT flag is enabled in the certificate template’s msPKI-Certificate-Name-Flag attribute.Windows
Use the following PowerShell snippet to check the value of the msPKI-Certificate-Name-Flag attribute of the certificate template and its enabled flags:Linux
Check the current value of the msPKI-Certificate-Name-Flag attribute on the certificate template using ldapsearch and note it down for later:Step 3: Ensure the certificate template does not require manager approval
The certificate template does not require manager approval if the CertTemplate node’s Requires Manager Approval (requiresmanagerapproval) is set to False. In that case, continue to the next step. The certificate template requires manager approval if the CT_FLAG_PEND_ALL_REQUESTS flag is enabled in the certificate template’s msPKI-Enrollment-Flag attribute.Windows
Use the following PowerShell snippet to check the value of the msPKI-Enrollment-Flag attribute of the certificate template and its enabled flags:Linux
Check the current value of the msPKI-Enrollment-Flag attribute on the certificate template using ldapsearch and note it down for later:Step 4: Ensure the certificate template does not require authorized signatures
The certificate template does not require authorized signatures if the CertTemplate node’s Authorized Signatures Required (authorizedsignatures) is set to 0 or if the Schema Version (schemaversion) is 1. In that case, continue to the next step. The certificate template requires authorized signatures if the certificate template’s msPKI-RA-Signature attribute value is more than zero.Windows
Use the following PowerShell snippet to check the value of the msPKI-RA-Signature attribute:Linux
Check the current value of the msPKI-RA-Signature attribute on the certificate template using ldapsearch and note it down for later:Step 5: Ensure the principal has enrollment rights on the certificate template
The principal does have enrollment rights on the certificate template if BloodHound returns a path for this Cypher query (replace “PRINCIPAL@DOMAIN.NAME” and “CERTTEMPLATE@DOMAIN.NAME” with the names of the principal and the certificate template):Windows
Use the following PowerShell snippet to grant the principal Enroll on the certificate template:Step 6: Perform ESC1 attack
See ADCSESC1 for instructions.Opsec Considerations
When the affected certificate authority issues the certificate to the attacker, it will retain a local copy of that certificate in its issued certificates store. Defenders may analyze those issued certificates to identify illegitimately issued certificates and identify the principal that requested the certificate.Edge Schema
Source: User, Group, ComputerDestination: Domain
Traversable: Yes