> For the complete documentation index, see [llms.txt](https://dmcxblue.gitbook.io/red-team-notes-2-0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dmcxblue.gitbook.io/red-team-notes-2-0/active-directory/active-directory-attacks/active-directory-certificate-services.md).

# Active Directory Certificate Services

AD CS is Microsoft PKI implementation that integrates with existing Active Directory forests, and provides everything from encrypting file systems to digital signatures, to user authentication. While AD CS is not installed by default it is widely deployed.

Attackers con request or renew certificates for users and computers, providing the same persistence approach as other techniques.

The certutil binary is a command line tool which can be used to quickly discover if there is a certificate authority on the domain.

&#x20;

<figure><img src="/files/i46ElpyBoOQW5Xu0f4n0" alt=""><figcaption></figcaption></figure>

We can verify the server has been identified as adcs.dominioncyber.local

<figure><img src="/files/6u20WxBTZudtCN5cnn1K" alt=""><figcaption></figcaption></figure>

I'll proceed with utilizing ntlmrelay from impacket suite we can capture the authentication of the Domain Controller machine Account and relay it to the Certification Authority Server

`ntlmrelay -t` [`http://IPOFADCS/certsrv/certfnsh.asp`](http://IPOFADCS/certsrv/certfnsh.asp)`-smb2support --adcs --template DomainController`

<figure><img src="/files/vNfrPZ6LvlxdURxjxtDK" alt=""><figcaption></figcaption></figure>

We can force authentication via PetitPotam this will make an API call (EfsRpcOpenFileRaw) that will trigger the machine account to authenticate to another system

We can see a successful attack since we can monitor that the Certificate was captured, when passing credentials onto Petitpotam we notice the authentication was successful

<figure><img src="/files/s7KYhnCKNsTUGDOUJrgf" alt=""><figcaption></figcaption></figure>

Here the tool mentioning it has been successful

<figure><img src="/files/jWxrSbaGeOjwRwemtj8V" alt=""><figcaption></figcaption></figure>

The certificate will be generated in Base64 format

<figure><img src="/files/GH0gAdDSXJh0drZ6PoEU" alt=""><figcaption></figcaption></figure>

Moving back to the Windows Workstation we can utilize Rubeus to pass the Ticket

<figure><img src="/files/j3WfbhYZvz44iK5oaCto" alt=""><figcaption></figcaption></figure>

Successfully passing the ticket can be verified by using the klist command on the cmd

<figure><img src="/files/plcIxMzYCwQPsfBMN3s1" alt=""><figcaption></figcaption></figure>

We can DCSync the Domain with these permissions

<figure><img src="/files/76zDAHvtlogTBFpf5J3a" alt=""><figcaption></figcaption></figure>
