ESC4 is a common ADCS vulnerability where a misconfigured Certificate Template grants dangerous permissions to a given user or group. This allows them to rewrite the template to become vulnerable to ESC1.
🔍 Discovery
Certipy is the go to tool for findings and exploiting many common ADCS vulnerabilities.
Running certipy will require a domain user, and it will generate multiple output files including JSONs, these can be manually examined or put into BloodHound.
In the JSON output, certipy will flag a given template as vulnerable:
📌 Exploitation
To exploit this, you’ll need to have access to the user or group with write permissions over the template, and temporarily rewrite it to be vulnerable to ESC1.
This will make the template vulnerable to ESC1, and create a backup that we can restore later. Next, we can exploit ESC1 by requesting a certificate as the administrator.
We can then use this to authenticate and get the administrator’s hash.
✨ Post-Exploitation
Afterwards, we can restore the original template to clean up.