Active Directory Certificate Services (AD CS) is Microsoft’s implementation of a Public Key Infrastructure (PKI) integrated with Active Directory. This technology enables the use of public key cryptography across the Active Directory forest, facilitating digital signatures, code signing, and the issuance of certificates, among other features.
An AD CS Certificate is an X.509 certificate that is issued and managed by Microsoft’s AD CS, which is a role within Windows Server used to create and manage PKI within an organisation. These certificates are employed for various purposes, including authentication, encryption, digital signatures, and secure communication within an Active Directory environment.
Key Fields in an AD CS Certificate
- Version – Specifies the X.509 version (typically v3 for enhanced security features).
- Serial Number – A unique identifier assigned by the AD CS Certificate Authority (CA).
- Issuer – The AD CS CA that issued the certificate.
- Subject – The entity to whom the certificate is issued (e.g., user, device, service).
- Public Key – The public key used for encryption and signature verification.
- Validity Period – Defines the certificate’s start and expiration dates.
- Signature Algorithm – The cryptographic algorithm used to sign the certificate (e.g., SHA-256).
- Certificate Templates – AD CS certificates are based on predefined templates that define certificate policies and settings.
- Certificate Extensions (X.509 v3) – Includes specific attributes like Key Usage (e.g., encryption, digital signature), Enhanced Key Usage (e.g., Smart Card Logon, Server Authentication), and Subject Alternative Name (SAN).
- Signature – The digital signature from the AD CS CA that verifies the certificate’s authenticity.
To request certificates, users go through a process known as enrolment. This involves clients identifying an Enterprise CA, generating a private and public key pair, and inserting the public key along with any relevant information into a Certificate Signing Request (CSR). The CSR is then signed with the user’s private key and sent to the Enterprise CA.
After receiving the CSR, the CA conducts checks based on the provided information, such as verifying the user’s permissions to request a specific certificate template and confirming if the user is authorised to enrol. If these checks are completed successfully, the CA uses the user-supplied information to fill in the certificate template, signs the certificate with its private key, and then sends the completed certificate back to the user.
Misconfigurations
Active Directory Certificate Services misconfigurations refer to improper settings, weak access controls, or insecure certificate policies that can be exploited by attackers to gain unauthorised access, escalate privileges, or impersonate users and devices within an Active Directory (AD) environment. These misconfigurations often arise due to mismanagement, lack of security best practices, or legacy configurations that expose the organisation to threats.
Common AD CS Misconfigurations and Their Causes
- Overly Permissive Certificate Templates: Misconfigured certificate templates allow low privileged users to request certificates with elevated privileges (e.g., certificates with Client Authentication and Smart Card Logon). Attackers could obtain certificates that allow unauthorized authentication as privileged users.
- Weak Enrolment Policies: Any authenticated user can enrol in sensitive certificate templates without proper access control restrictions. Attackers could request certificates that enable privilege escalation or persistence.
- Misconfigured Certificate Authority (CA) Permissions: Poorly configured CA ACLs (Access Control Lists) allow unauthorised users to manage certificates, modify templates, or issue new certificates. Attackers could create fraudulent certificates or manipulate existing ones.
- Unrestricted Enrolment Agent Templates: Enrolment Agents are allowed to request certificates on behalf of other users, but if unrestricted, any user can abuse this role. Attackers could generate certificates for privileged accounts, leading to full domain compromise.
- Vulnerable NTLM and Kerberos Certificate Mappings: Weak mappings could allow attackers to use certificates for authentication without verifying identity properly. Enables pass-the-certificate attacks, where an attacker can authenticate as a high-privileged user.
- Allowing Certificates with Weak or Deprecated Cryptography: Use of outdated cryptographic algorithms (e.g., MD5, SHA-1) or weak key sizes. Increases the risk of cryptographic attacks that compromise certificate integrity.
- Lack of Certificate Revocation Checking: Improper configuration of CRL (Certificate Revocation List) and OCSP (Online Certificate Status Protocol). Expired or compromised certificates remain valid, allowing continued misuse.
How These Misconfigurations Occur
- Default or Legacy Configurations left unchanged after AD CS deployment.
- Lack of Awareness among administrators regarding certificate-based attack vectors.
- Over-permissive policies granting unnecessary certificate enrolment rights.
- Failure to implement least privilege and restrict sensitive templates.
- Poor auditing and monitoring of issued certificates and CA activities.
While there are a number of vulnerabilities in the ESC, THEFT or PERSIST categories [1], that can affect AD CS, the focus of the article will be on privilege escalation, more specifically, ESC1, ESC2, ESC3, ESC4 & ESC6 misconfigurations.
Lab Setup
In order to demonstrate some of these misconfigurations and how these impact security of an Active Directory forest, an environment was deployed. This was based on the Game of Active Directory (GoAD v3) project [2].
The environment consists of three domain controllers (DC01, DC02, DC03) and two servers (SRV02, SRV03). We’ll be investigating D03 (192.168.56.12) and specifically SRV03 (ESSOS-CA / 192.168.56.23) to see if any misconfigurations exist.
Additionally, a previously compromised user account (khal.drogo@essos.local) will serve as an entry point and will be used to perform enumeration in the following section.
ESC1
For the certificate template to be vulnerable to ESC1, the following properties must exist in the template:
- The Enterprise CA grants low-privileged users enrolment rights.
- Manager approval is disabled.
- No authorised signatures are required.
- An overly permissive certificate template security descriptor grants certificate enrolment rights to low-privileged users.
- The certificate template defines Extended Key Usages (EKUs) that enable authentication.
- The certificate template allows requesters to specify a subjectAltName (SAN) in the CSR.
So, first aspect is to enumerate certificate templates and review their parameters. The Certipy tool [3] can be used to find vulnerable certificate templates, by supplying valid domain user credentials or running the tool from a domain-attached computer.