trio.so
Explained

Active Directory Certificate Services (AD CS): Best Practices and Security

What AD CS is, best practices for a Microsoft certificate authority, and how to close the known AD CS attack paths such as ESC1.

Mountain landscape representing leadership perspective and vision
Written by
Atena Ladchartabi

Content writer, trio.so

Published on
Modified on

Active Directory Certificate Services (AD CS) is the Windows Server role that runs a Microsoft certificate authority (CA). It issues the certificates that machines, users and services use to prove who they are and to encrypt traffic. The best practices that matter most: use a two-tier hierarchy with an offline root, treat every CA as a Tier 0 asset like a domain controller, lock down certificate templates and who can enroll, and audit the CA configuration for the known misconfigurations (ESC1 to ESC8) listed below.

What is AD CS?

Microsoft describes AD CS as a Windows Server role for issuing and managing public key infrastructure (PKI) certificates used in secure communication and authentication. The certificates give you confidentiality (encryption), integrity (digital signatures) and authentication (binding a key to a user, computer or device account).

Microsoft lists these role services:

  • Certification authorities. Root and subordinate CAs that issue and manage certificates.
  • Web enrollment. A browser page to request certificates and download revocation lists.
  • Online Responder. Answers revocation status requests (OCSP).
  • Network Device Enrollment Service (NDES). Lets routers and other devices without domain accounts get certificates.
  • Certificate Enrollment Policy and Enrollment Web Services. Policy-based enrollment for computers that are not domain joined or are off the network.
  • TPM key attestation. Lets the CA check that a private key sits in a trusted TPM.

What does an AD CS server issue?

Typical uses, per Microsoft: user and computer authentication, smart card sign-in, secure Wi-Fi and VPN (802.1X and IPsec), S/MIME email, Encrypting File System, web server (TLS) certificates, code and document signing, and device certificates through NDES. Active Directory group policy can control who gets which certificate type, using certificate templates.

Do you need AD CS?

Run AD CS if you need certificates for internal systems and want them tied to your Active Directory identities: domain-joined PCs signing in to Wi-Fi, internal web apps, smart card or Windows Hello for Business certificate trust, and so on. Use a public CA for anything customers or browsers outside your network must trust.

You may not need it if you have only a few internal servers and no certificate-based authentication, or if you are moving away from on-premises Windows infrastructure. In that case cloud PKI services or a managed CA can replace it (see "AD CS alternatives" below). Remember that a CA is a high-value target. A small, unmaintained AD CS install can be worse than none.

Active Directory Certificate Services best practices

Design the hierarchy properly

  • Two tiers. An offline root CA that issues only to subordinate CAs, and one or more online issuing CAs that issue to users and machines. A single online root that issues everything is easy to build and hard to recover from if compromised.
  • Keep the root offline and powered off except when you issue a subordinate certificate or publish a new CRL.
  • Do not install the CA on a domain controller or share the server with other roles.
  • Plan names and lifetimes up front. The CA name cannot be changed after installation. Make the root valid long enough to outlive its subordinates.

Protect the keys and the servers

  • Store CA private keys in a hardware security module (HSM) where you can, or at least on a locked-down server.
  • Treat CA servers, including subordinate CAs, as Tier 0 assets with the same protections as domain controllers. SpecterOps makes this point in its AD CS research.
  • Limit who can log on to the CA and who holds the CA Administrator and Certificate Manager roles. Keep them separate.
  • Patch the CA servers and back up the CA database, the CA private key and the CA configuration. Test a restore, and keep a copy of the backups offsite.
  • Write down how certificates are issued, renewed and revoked, and include the CA in your disaster recovery plan.

Control templates and enrollment

  • Publish only the certificate templates you actually use. Remove the rest from the CA.
  • Give enrollment rights to specific groups, not to Authenticated Users or Domain Users, unless the template is harmless.
  • For templates that allow the requester to supply the subject name, require manager approval or authorized signatures, or do not allow it at all.
  • Restrict who can write to template objects in the configuration container.
  • Use short validity periods for user and device certificates and automate renewal through autoenrollment. Set expiration alerts for certificates that are not renewed automatically, such as web server certificates.

Make revocation and monitoring work

  • Publish CRL distribution points and Online Responder URLs that clients can reach, with enough overlap that an expired CRL does not break authentication.
  • Turn on CA auditing and send the events to your log platform. Alert on template changes, new CA managers and unusual enrollment spikes.
  • Use current algorithms and key lengths for new certificates (SHA-256 or stronger, RSA 2048 or larger).

Keep up with Microsoft's certificate authentication changes

Microsoft's KB5014754 changed how domain controllers map certificates to accounts. Certificates must carry a strong mapping, such as the SID extension, or authentication is denied once domain controllers run in Full Enforcement mode. Microsoft has ended the compatibility option for KB5014754, so check the KB for the current enforcement state, and make sure your templates add the SID extension.

AD CS security: the known attack paths (ESC1 to ESC8)

In 2021 SpecterOps published "Certified Pre-Owned", the research that named the common AD CS misconfigurations ESC1 to ESC8. They are misconfigurations of templates, permissions and CA settings, not bugs in Windows, so you fix them by configuration. The table gives each class and the check that closes it. There are no exploit steps here, on purpose.

ClassWhat is misconfiguredDefensive check
ESC1A template lets low-privileged users supply their own subject alternative name, has an authentication purpose, and needs no approval.Remove "supply in request" from templates that allow authentication, or require manager approval or authorized signatures.
ESC2A template with the Any Purpose or no EKU is enrollable by low-privileged users.Restrict enrollment to named groups and set specific purposes.
ESC3A template with the Certificate Request Agent purpose is open to low-privileged users and the CA has no enrollment agent restrictions.Limit who can enroll and configure enrollment agent restrictions on the CA.
ESC4Unintended accounts can write to a certificate template object.Audit permissions on template objects and remove write access except for PKI admins.
ESC5Unintended accounts control other PKI objects, such as the CA's computer object or containers under Public Key Services.Review ACLs on all PKI objects and on the CA server.
ESC6The CA has the EDITF_ATTRIBUTESUBJECTALTNAME2 flag set, so any request can include a user-defined subject alternative name.Make sure the flag is off, and check it after every patch cycle.
ESC7Unintended accounts hold the ManageCA or ManageCertificates permission on the CA.Limit those permissions to tightly controlled administrators.
ESC8The CA's HTTP enrollment endpoints accept NTLM authentication without relay protection.Disable unused web enrollment. If needed, require Kerberos, enforce HTTPS with Extended Protection for Authentication, or turn NTLM off for the endpoint.

Researchers have published more classes since (the list is not closed), so audit your CA with a maintained tool and re-run it on a schedule. The same research advises revoking a compromised account's certificates as well as resetting its password, because a certificate can keep working after the password changes. Our guide to Active Directory security covers the surrounding controls, and how to prevent pass-the-hash attacks covers the credential side.

AD CS alternatives

Searching for an "AD CS replacement" usually means one of three things:

  • A cloud PKI service. Cloud services issue certificates for devices without CA servers to run. Microsoft Intune has a Cloud PKI option, and other vendors offer managed PKI. Check what each supports, such as SCEP and device certificates, and its licensing.
  • A commercial or open-source CA platform you run yourself or have hosted. Examples include EJBCA and smallstep, which you evaluate against your own requirements.
  • Re-building AD CS cleanly on a new two-tier design when the old one has grown unsafe. This is a common outcome of an Active Directory migration.

Whichever route you pick, plan the certificate lifecycle: who issues, who renews, who revokes, and how you find certificates that are about to expire. See certificate management best practices.

Ready-to-use Templates

Must-have Template Toolkit for IT Admins

Explore All
Template Toolkit

Manage Windows, Mac, iOS and Android from one console

trio.so manages Windows, macOS, Linux, iOS and Android devices from one console.

Start free trial

Manage Every Device From One Console

trio.so brings device management, patching and security policies for Windows, macOS, Linux, iOS/iPadOS and Android into one console. Enroll a device and see it in the console within minutes.

14-day free trial. No credit card required.

trio.so brings device management, patching and security policies for Windows, macOS, Linux, iOS/iPadOS and Android into one console. Enroll a device and see it in the console within minutes.

Smiling womanAbstract geometric patternAbstract geometric patternSmiling womanSmiling woman

Frequently Asked Questions (FAQ)

Have questions? We've got answers. This section covers some of the most commonly asked questions related to this topic.

AD CS is the Windows Server role that runs a Microsoft certificate authority. It issues certificates for authentication, encryption and signing inside a Windows domain.

You need it if you want internal certificates tied to Active Directory identities, for example for Wi-Fi, VPN, smart cards or internal web servers. You may not need it if you have few internal services or use a cloud PKI.

Use a two-tier hierarchy with an offline root, protect CA servers as Tier 0, publish only needed templates with tight enrollment rights, audit the CA, and keep revocation (CRL and OCSP) reachable.

ESC1 is a template misconfiguration: low-privileged users can supply their own subject alternative name on a template that allows authentication, with no approval. Fix it by removing that option or requiring approval.

Audit templates, CA settings and permissions against ESC1 to ESC8, disable unused web enrollment, protect the CA servers like domain controllers, and monitor CA events.

Related

From the blog

The related industry news, interviews, technologies, and resources.