Added option to Enumerate Templates via HTTP Relaying to /certsrv/certreqxt.asp Endpoint #143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While testing a network's AD CS environment, I had traffic I was able to relay, but default templates were disabled. I performed some testing on what other endpoints you could relay to, and discovered that several ADCS web enrollment endpoints contain a list of templates the authenticated user can enroll in. One of these endpoints, /certsrv/certrqxt.asp, conveniently has them listed in a dropdown box between tags:
If we relay credentials to this endpoint with ntlmrelayx while capturing network traffic, then analyze that traffic in wireshark and follow the TCP stream, we can see that the templates are returned in the response HTML source:
In the case of this test, I did not have valid credentials and hadn't determined a way to acquire them, so this was used to obtain initial domain access by relaying for a certificate that I deduced was likely able to be used for authentication. I think this technique may be helpful in situations where:
As I can see this being a useful technique in the future, I modified certipy to add a
-enum-templates
options that will relay to the /certsrv/certreqxt.asp endpoint, obtain the response, parse out the valid templates using BeautifulSoup, and then print them to the terminal:I would like to expand this in the future, including storing the template names in a file for later reference, and possibly look into either prompting for an additional relay to obtain a certificate, or just yoloing obtaining a certificate for each template (perhaps an option?), but wanted to submit this first before working on it more!