{"id":1108,"date":"2024-11-18T19:34:57","date_gmt":"2024-11-18T18:34:57","guid":{"rendered":"https:\/\/blog.chrisse.se\/?p=1108"},"modified":"2024-12-03T22:06:17","modified_gmt":"2024-12-03T21:06:17","slug":"when-your-enterprise-pki-becomes-one-of-your-enemies-part-1","status":"publish","type":"post","link":"https:\/\/blog.chrisse.se\/?p=1108","title":{"rendered":"When your Enterprise PKI becomes one of your enemies (Part 1)"},"content":{"rendered":"\n<p>Last week I presented my session &#8220;When your Enterprise PKI becomes one of your enemies&#8221; at the Hybrid Identity Protection (HIP) Conference 2024 in New Orleans &#8211; Thanks to all who attended my session and for all of the follow up questions I got later during the conference and now also on social media and e-mail &#8211; I&#8217;m very sorry that my two last demos didn&#8217;t work, the reason for that was some issues with the CDP in my demo environment the KDC didn&#8217;t consider it&#8217;s own certificate valid for PKINIT hence the problem.<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-4-1024x576.png\" alt=\"\" class=\"wp-image-1158\" srcset=\"https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-4-1024x576.png 1024w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-4-300x169.png 300w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-4-768x432.png 768w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-4-1536x864.png 1536w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-4.png 2016w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p><br>The first part of the presentation outlined something very common and dangerous that we already see today, Enterprise CA&#8217;s trusted for authentication against Active Directory &#8211; publishing certificate templates that allow the subject to be supplied in the request (SITR)<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"553\" src=\"https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-1024x553.png\" alt=\"\" class=\"wp-image-1109\" srcset=\"https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-1024x553.png 1024w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-300x162.png 300w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-768x415.png 768w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image.png 1384w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>But how can you determine if a CA is trusted for authentication against Active Directory? It&#8217;s either trusted in NTAuth + Leaf certificates and KDC certificates have their full chain trusted and is valid &#8211; this allows for implicit\/explicit UPN mapping e.g. the SAN in the certificate matches the userPrincipalName attribute of the user within Active Directory. If the CA is not trusted in NTAuth only explicit mapping is available using the altSecurityIDs attribute + Leaf certificates and KDC certificates have their full chain trusted and is valid.<\/p>\n\n\n\n<p>By default if you install an Enterprise CA using Active Directory Certificate Services (AD CS) &#8211; it will be trusted in NTAuth.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"663\" src=\"https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-1-1024x663.png\" alt=\"\" class=\"wp-image-1110\" srcset=\"https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-1-1024x663.png 1024w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-1-300x194.png 300w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-1-768x497.png 768w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-1.png 1165w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>Above you can see the requirements to be trusted to authenticate to Active Directory using certificates &#8211; Note that Schannel in the S4U2Self scenarios involves the KDC and the authentication part contains to either NTAuth (implicit mapping) or AltSecID (explicit mapping)<br><br>The methods with blue color are required to be considered strong according to the Strong Certificate Binding Enforcement (more on that later <sub><sup>1<\/sup><\/sub>)<\/p>\n\n\n\n<p><strong>Active Directory<\/strong><br>So let&#8217;s have a look how NTAuth &#8211; CA&#8217;s trusted in NTAuth are stored at the following location &#8216;CN=NTAuth,CN=Public Key Services,CN=Services,DC=Configuration,DC=X&#8217; in Active Directory and their thumbprint in the multi-valued attribute &#8216;cACertificate&#8217; <br><br><strong>Clients<\/strong><br>On every domain joined computer a copy of all the trusted CA&#8217;s in the above attribute are stored in the registry at the following location: &#8216;HKLM\\SOFTWARE\\Microsoft\\EnterpriseCertificates\\NTAuth\\Certificates&#8217; where one key for each CA is created and named after the thumbprint of the CA certificate.<\/p>\n\n\n\n<p><strong>Group Policy Autoenrollment Client Side Extension (CSE)<\/strong><br>Supposed to cache the content from AD to the Registry on each domain joined machine within the forest (Including DCs).<\/p>\n\n\n\n<p>So who is validating that the CA is trusted in NTAuth?<\/p>\n\n\n\n<ul class=\"wp-block-list indent40\">\n<li class=\".indent40{padding-left: 40px;}\">Domain Controllers \/ KDC (if not explicit mapping using AltSecID)<\/li>\n\n\n\n<li>Network Policy Server (NPS)<\/li>\n\n\n\n<li>LDAP-STARTTLS<\/li>\n\n\n\n<li>IIS &#8211; SCHANNEL<\/li>\n\n\n\n<li>ADFS &#8211; SCHANNEL (Even if explicit mapping exist using AltSecID)<\/li>\n\n\n\n<li>Enrollment of templates that have private key archival enabled<\/li>\n<\/ul>\n\n\n\n<p><strong>So how is the validation that the CA is trusted in NTAuth performed?<\/strong><br>If we\u2019re online we\u2019re taking a trip to &#8216;CN=NTAuth,CN=Public Key Services,CN=Services,DC=Configuration,DC=X&#8217; using LDAP right?<br><br>Nope &#8211; Verification is done using a API: We\u2019re calling into crypt32.dll?<a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-certverifycertificatechainpolicy\">CertVerifyCertificateChainPolicy <\/a>with the \u2018CERT_CHAIN_POLICY_NT_AUTH\u2019 flag<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"214\" src=\"https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-2-1024x214.png\" alt=\"\" class=\"wp-image-1130\" srcset=\"https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-2-1024x214.png 1024w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-2-300x63.png 300w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-2-768x160.png 768w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-2.png 1278w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>Note: You can test this using PowerShell: Test-Certificate -Cert $cert -Policy NTAUTH<\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-certverifycertificatechainpolicy\">CertVerifyCertificateChainPolicy <\/a>with the \u2018CERT_CHAIN_POLICY_NT_AUTH\u2019 flag will validate two things:<\/p>\n\n\n\n<ol class=\"wp-block-list indent40\">\n<li>If the certificate chain is valid from Leaf Certificate to the Root CA Certificate and that the full chain is trusted.<\/li>\n\n\n\n<li>Verify that the CA directly above the Leaf Certificate is trusted in NTAuth &#8211; this check is done locally by looking in the registry on the client &#8216;HKLM\\SOFTWARE\\Microsoft\\EnterpriseCertificates\\NTAuth\\Certificates&#8217; &#8211; the API never asks Active Directory.<\/li>\n<\/ol>\n\n\n\n<p><strong>What is Strong Certificate Binding Enforcement?<\/strong><br>Strong Certificate Binding is a response to CVE-2022-34691, CVE-2022-26931 and CVE-2022-26923 address an elevation of privilege vulnerability that can occur when the Kerberos Key Distribution Center (KDC) is servicing a certificate-based authentication request. Before the May 10, 2022 security update, certificate-based authentication would not account for a dollar sign ($) at the end of a machine name. This allowed related certificates to be emulated (spoofed) in various ways. Additionally, conflicts between User Principal Names (UPN) and sAMAccountName introduced other emulation (spoofing) vulnerabilities that we also address with this security update.<br>More information can be found here: <a href=\"https:\/\/support.microsoft.com\/en-us\/topic\/kb5014754-certificate-based-authentication-changes-on-windows-domain-controllers-ad2c23b0-15d8-4340-a468-4d4f3b188f16\" data-type=\"link\" data-id=\"https:\/\/support.microsoft.com\/en-us\/topic\/kb5014754-certificate-based-authentication-changes-on-windows-domain-controllers-ad2c23b0-15d8-4340-a468-4d4f3b188f16\">KB5014754: Certificate-based authentication changes on Windows domain controllers<\/a> and here: <a href=\"https:\/\/research.ifcr.dk\/certifried-active-directory-domain-privilege-escalation-cve-2022-26923-9e098fe298f4\">Certifried: Active Directory Domain Privilege Escalation (CVE-2022\u201326923) | by Oliver Lyak | IFCR<\/a><br><br>Specifically this protects from the following four scenarios:<\/p>\n\n\n\n<ol class=\"wp-block-list indent40\">\n<li>dNSHostName\/servicePrincipalName computer owner abuse, Remove DNS SPNs from servicePrincipalName, steal DNS hostname of a DC, put it in your computer accounts dNSHostName attr and request a cert, auth with the cert and you&#8217;re a DC.<\/li>\n\n\n\n<li>Overwrite userPrincipalName of user to be of target to hijack user account since the missing domain part does not violate an existing UPN<\/li>\n\n\n\n<li>Overwrite userPrincipalName of user to be @ of target to hijack machine account since machine accounts don\u2019t have a UPN<\/li>\n\n\n\n<li>Delete userPrincipalName of user and overwrite sAMAccountName to be without a trailing $ to hijack a machine account<br><br>Note: 2-4 would require permissions to write to the &#8216;userPrincipalName&#8217; attribute<\/li>\n<\/ol>\n\n\n\n<p><strong>So how is Strong Certificate Binding Enforcement implemented?<\/strong><br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"515\" src=\"https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-3-1024x515.png\" alt=\"\" class=\"wp-image-1131\" srcset=\"https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-3-1024x515.png 1024w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-3-300x151.png 300w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-3-768x386.png 768w, https:\/\/blog.chrisse.se\/wp-content\/uploads\/2024\/11\/image-3.png 1237w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>As outlined in <a href=\"https:\/\/support.microsoft.com\/en-us\/topic\/kb5014754-certificate-based-authentication-changes-on-windows-domain-controllers-ad2c23b0-15d8-4340-a468-4d4f3b188f16\" data-type=\"link\" data-id=\"https:\/\/support.microsoft.com\/en-us\/topic\/kb5014754-certificate-based-authentication-changes-on-windows-domain-controllers-ad2c23b0-15d8-4340-a468-4d4f3b188f16\">KB5014754: Certificate-based authentication changes on Windows domain controllers<\/a> once we&#8217;re in Full Enforcement mode there is only 3 ways to stay compliant &#8211; otherwise certificate based authentication is going to fail against Active Directory &#8211; Full Enforcement mode is planned to February 11, 2025 by default with an option to opt-out until September 10, 2025 by explicit configuring your domain controllers to be in Compatibility Mode. But if you have NOT already by yourself rolled into Enforcement Mode  -It means your <span style=\"text-decoration: underline;\">Active Directory is still vulnerable to those CVEs<\/span><\/p>\n\n\n\n<p>Options to be compliant with Strong Certificate Binding Enforcement<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-table tdtop\"><table><thead><tr><th>Method<\/th><th>Requirements<\/th><th>Certificate Re-issue<\/th><\/tr><\/thead><tbody><tr><td>Certificate SID Extension<\/td><td>Certificate must contain the &#8216;1.3.6.1.4.1.311.25.2&#8217; SID Extensions that encodes the user or computers SID hat the certificate issued for\/to be used for authentication with<\/td><td>Yes<\/td><\/tr><tr><td>SAN URL<\/td><td>The SAN of the certificate must contain one entry of the type URL and have a value of &#8220;\u2022tag:microsoft.com,2022-09-14:sid:&lt;value&gt;&#8221; where &lt;value&gt; is the user or computers SID that the certificate issued for\/to be used for authentication with, this is only accepted on the KDC for Windows Server 2025-Windows Server 2019 DCs<\/td><td>Yes<\/td><\/tr><tr><td>AltSecID<\/td><td>Using the &#8216;altSecurityIDs&#8217; attribute to strongly map the certificate to the user or computer the certificatre is issued for\/to be used for authentication with &#8211; only the following mapping methods are considered strong:<br>&#8211; X509IssuerSerialNumber<br>\u201cX509:&lt;I&gt;IssuerName&lt;SR&gt;1234567890\u201d<br>-X509SKI<br>\u201cX509:&lt;SKI&gt;123456789abcdef\u201d<br>-X509SHA1PublicKey<br>\u201cX509:&lt;SHA1-PUKEY&gt;123456789abcdef\u201d<\/td><td>No<\/td><\/tr><tr><td>Issuer-OID-MappingType triplet<\/td><td>More information will be available shortly.<\/td><td>No, if Issuer OID is present<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n<p><strong>Supply in the request (SITR) without Client Authentication EKU in the template<\/strong><\/p>\n\n\n\n<p>One of the requirements for the KDC to accept a certificate for authentication using PKINIT is that the EKU is containing either Client Authentication (1.3.6.1.5.5.7.3.2) or id-pkinit-KPClientAuth (1.3.6.1.5.2.3.4) or Smart Card Logon (1.3.6.1.4.1.311.20.2.2)<br><br>Microsoft have a proprietary extension called a Certificate Application Policy and it&#8217;s used as an EKU &#8211; Defined by this attribute on certificate templates <a href=\"https:\/\/learn.microsoft.com\/en-us\/openspecs\/windows_protocols\/ms-crtd\/44012f2d-5ef3-440d-a61b-b30d3d978130\" data-type=\"link\" data-id=\"https:\/\/learn.microsoft.com\/en-us\/openspecs\/windows_protocols\/ms-crtd\/44012f2d-5ef3-440d-a61b-b30d3d978130\">&#8220;msPKI-Certificate-Application-Policy Attribute&#8221;<\/a> as this attribute isn&#8217;t populated (is empty) on certificate templates that are v1 templates, this attribute can be supplied in the request exactly the same way as we could supply a SAN.<br><br>Microsoft issued a statement on this just the day before my presentation on the Hybrid Identity Protection (HIP) Conference 2024 in New Orleans &#8211; the statement from MSRC can be found here: <a href=\"https:\/\/msrc.microsoft.com\/update-guide\/vulnerability\/CVE-2024-49019\" data-type=\"link\" data-id=\"https:\/\/msrc.microsoft.com\/update-guide\/vulnerability\/CVE-2024-49019\">Active Directory Certificate Services Elevation of Privilege Vulnerability &#8211; CVE-2024-49019<\/a> but it&#8217;s not telling you the entire truth about how this works, peer see this has nothing to with if the template is v1 or not, it has to do with and only with if the <a href=\"https:\/\/learn.microsoft.com\/en-us\/openspecs\/windows_protocols\/ms-crtd\/44012f2d-5ef3-440d-a61b-b30d3d978130\" data-type=\"link\" data-id=\"https:\/\/learn.microsoft.com\/en-us\/openspecs\/windows_protocols\/ms-crtd\/44012f2d-5ef3-440d-a61b-b30d3d978130\">&#8220;msPKI-Certificate-Application-Policy<\/a>&#8221; attribute is populated or not, if you copy a v1 template let&#8217;s say you copy the default &#8216;WebServer&#8217; template, its upgraded and the values in &#8216;pKIExtendedKeyUsage&#8217; are copied by the &#8216;Certificate Template&#8217; MMC into &#8216;msPKI-Certificate-Application-Policy&#8217; and you&#8217;re safe &#8211; so what is not being told here:<\/p>\n\n\n\n<ol class=\"wp-block-list indent40\">\n<li>If you populate all your v1 templates with the same values in &#8216;pKIExtendedKeyUsage&#8217; into &#8216;<a href=\"https:\/\/learn.microsoft.com\/en-us\/openspecs\/windows_protocols\/ms-crtd\/44012f2d-5ef3-440d-a61b-b30d3d978130\" data-type=\"link\" data-id=\"https:\/\/learn.microsoft.com\/en-us\/openspecs\/windows_protocols\/ms-crtd\/44012f2d-5ef3-440d-a61b-b30d3d978130\">msPKI-Certificate-Application-Policy<\/a>&#8216; you&#8217;re safe.<\/li>\n\n\n\n<li>If you have a v2 template let&#8217;s say and don&#8217;t define EKUs or having <a href=\"https:\/\/learn.microsoft.com\/en-us\/openspecs\/windows_protocols\/ms-crtd\/44012f2d-5ef3-440d-a61b-b30d3d978130\" data-type=\"link\" data-id=\"https:\/\/learn.microsoft.com\/en-us\/openspecs\/windows_protocols\/ms-crtd\/44012f2d-5ef3-440d-a61b-b30d3d978130\">msPKI-Certificate-Application-Policy<\/a> empty &#8211; you&#8217;re as well subject to having EKUs supplied in the request and this is regardless template version. Is there any real world scenarios for this &#8211; well here is an example of a vendor who guides certificate templates to be created this way: <a href=\"https:\/\/docs.vmware.com\/en\/VMware-Cloud-Foundation\/5.2\/vcf-admin\/GUID-194B5856-8B2C-40D3-AEC2-DD4324980C05.html\">Create and Add a Microsoft Certificate Authority Template<\/a><\/li>\n<\/ol>\n\n\n\n<p>Note all my demos uses &#8216;<a href=\"https:\/\/github.com\/CarlSorqvist\/PsCertTools\/tree\/main\/CertReqTools\">CertRequestTools<\/a>&#8216; from Carl S\u00f6rqvist<br><br>Let&#8217;s try using this by showing some sample code &#8211; For this to work we assume that the default template &#8216;WebServer&#8217; is published at an Enterprise CA named &#8216;nttest-ca-01.nttest.chrisse.com\\Chrisse Issuing CA 1&#8217; and that it is trusted in NTAuth in a forest with a root domain named nttest.chrisse.com and that the built-in administrator account exists by it&#8217;s default name &#8211; to utilize this the enrollment permissions needs to be granted either to a user or computer within the forest. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#f2f2f2;color:#2f363c\">1. WebServer-AppPolicy.ps1<\/span><span role=\"button\" tabindex=\"0\" data-code=\"Import-Module -Name CertRequestTools\n#CA1 IS Trusted in NTAuth\n$CA1 = &quot;nttest-ca-01.nttest.chrisse.com\\Chrisse Issuing CA 1&quot;\n$ApplicationPoliciesExtension = New-Object -ComObject X509Enrollment.CX509ExtensionMSApplicationPolicies\n$ApplicationPolicyOids = New-Object -ComObject X509Enrollment.CCertificatePolicies.1\n$ApplicationPolicyOid = New-Object -ComObject X509Enrollment.CObjectId\n$ApplicationPolicyOid.InitializeFromValue('1.3.6.1.5.5.7.3.2') #Client Authentication EKU\n$CertificatePolicy = New-Object -ComObject X509Enrollment.CCertificatePolicy\n$CertificatePolicy.Initialize($ApplicationPolicyOid)\n$ApplicationPolicyOids.Add($CertificatePolicy)\n\n\n$ApplicationPoliciesExtension.InitializeEncode($ApplicationPolicyOids)\n$ManagedApplicationPoliciesExtension = \n[System.Security.Cryptography.X509Certificates.X509Extension]::new($ApplicationPoliciesExtension.ObjectId.Value,`\n[Convert]::FromBase64String($ApplicationPoliciesExtension.RawData(1)), $ApplicationPoliciesExtension.Critical)\n\nNew-PrivateKey -RsaKeySize 2048 -KeyName ([Guid]::NewGuid()) | New-CertificateRequest -Subject &quot;CN=DEMO1&quot; `\n -UserPrincipalName administrator@nttest.chrisse.com `\n -OtherExtension $ManagedApplicationPoliciesExtension | `\n Submit-CertificateRequest -ConfigString $CA1 -Template WebServer | `\n Install-Certificate -Name My -Location CurrentUser\" style=\"color:#24292eff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki min-light\" style=\"background-color: #ffffff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6F42C1\">Import-Module<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">Name CertRequestTools<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C2C3C5\">#CA1 IS Trusted in NTAuth<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$CA1 <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;nttest-ca-01.nttest.chrisse.com\\Chrisse Issuing CA 1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPoliciesExtension <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ComObject X509Enrollment.CX509ExtensionMSApplicationPolicies<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPolicyOids <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ComObject X509Enrollment.CCertificatePolicies.<\/span><span style=\"color: #1976D2\">1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPolicyOid <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ComObject X509Enrollment.CObjectId<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPolicyOid.InitializeFromValue(<\/span><span style=\"color: #22863A\">&#39;1.3.6.1.5.5.7.3.2&#39;<\/span><span style=\"color: #24292EFF\">) <\/span><span style=\"color: #C2C3C5\">#Client Authentication EKU<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$CertificatePolicy <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ComObject X509Enrollment.CCertificatePolicy<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$CertificatePolicy.Initialize($ApplicationPolicyOid)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPolicyOids.Add($CertificatePolicy)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPoliciesExtension.InitializeEncode($ApplicationPolicyOids)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ManagedApplicationPoliciesExtension <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">[<\/span><span style=\"color: #D32F2F\">System.Security.Cryptography.X509Certificates.X509Extension<\/span><span style=\"color: #24292EFF\">]::new($ApplicationPoliciesExtension.ObjectId.Value<\/span><span style=\"color: #D32F2F\">,`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">[<\/span><span style=\"color: #D32F2F\">Convert<\/span><span style=\"color: #24292EFF\">]::FromBase64String($ApplicationPoliciesExtension.RawData(<\/span><span style=\"color: #1976D2\">1<\/span><span style=\"color: #24292EFF\">))<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> $ApplicationPoliciesExtension.Critical)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6F42C1\">New-PrivateKey<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">RsaKeySize <\/span><span style=\"color: #1976D2\">2048<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">KeyName ([<\/span><span style=\"color: #D32F2F\">Guid<\/span><span style=\"color: #24292EFF\">]::NewGuid()) <\/span><span style=\"color: #D32F2F\">|<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-CertificateRequest<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">Subject <\/span><span style=\"color: #22863A\">&quot;CN=DEMO1&quot;<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">UserPrincipalName administrator@nttest.chrisse.com <\/span><span style=\"color: #D32F2F\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">OtherExtension $ManagedApplicationPoliciesExtension <\/span><span style=\"color: #D32F2F\">|<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">Submit-CertificateRequest<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ConfigString $CA1 <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">Template WebServer <\/span><span style=\"color: #D32F2F\">|<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">Install-Certificate<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">Name My <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">Location CurrentUser<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>So now we have a certificate with the UPN of the built-in administrator (RID 500) and we supplied the required Client Authentication EKU in the request using the &#8216;Web Server&#8217; template so our certificate with the subject &#8220;CN=DEMO1&#8221; should be able to authenticate and become the Administrator account RID500. To do this we use another script to perform LDAP-STARTTLS &#8211; select the certificate issued by the previous script when prompted:<br><sup>Note: Change the domain controller from &#8216;nttest-dc-01.nttest.chrisse.com&#8217; to your own DC, the KDC on the must be capable of performing PKINIT e.g. have valid KDC certificate.<\/sup> <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#f2f2f2;color:#2f363c\">LDAP-TLSv2.ps1<\/span><span role=\"button\" tabindex=\"0\" data-code=\"Add-Type -AssemblyName System.DirectoryServices.Protocols\nAdd-Type -AssemblyName System.Security\n# Change the domain controller to your own DC instead of 'nttest-dc-01.nttest.chrisse.com'\n$Id = New-Object -TypeName System.DirectoryServices.Protocols.LdapDirectoryIdentifier -ArgumentList 'nttest-dc-01.nttest.chrisse.com', 389, $true, $false\n$Ldap = New-Object -TypeName System.DirectoryServices.Protocols.LdapConnection -ArgumentList $Id, $null, ([System.DirectoryServices.Protocols.AuthType]::External)\n$Ldap.AutoBind = $false\n&quot;Certificate selection&quot; | Write-Host\n$Location = [System.Security.Cryptography.X509Certificates.StoreLocation]::CurrentUser\n$Name = [System.Security.Cryptography.X509Certificates.StoreName]::My\n$Store = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Store -ArgumentList $Name, $Location\n$Store.Open(&quot;ReadOnly, MaxAllowed, OpenExistingOnly&quot;)\n$Cert = [System.Security.Cryptography.X509Certificates.X509Certificate2UI]::SelectFromCollection($Store.Certificates.Find(&quot;FindByKeyUsage&quot;, 0xa0, $true).Find(&quot;FindByExtension&quot;, &quot;2.5.29.35&quot;, $true), &quot;Certificate selection&quot;, &quot;Select a certificate&quot;, &quot;SingleSelection&quot;)\n$Store.Dispose()\n$Ldap.ClientCertificates.Clear()\n[void]$Ldap.ClientCertificates.Add($Cert[0])\n$Ldap.SessionOptions.QueryClientCertificate = {\n    param(\n        [System.DirectoryServices.Protocols.LdapConnection]\n        $Connection\n        , [Byte[][]]\n        $TrustedCAs\n    )\n    return $Cert[0]\n}\n \n&quot;Starting TLS&quot; | Write-Host\n$Ldap.SessionOptions.StartTransportLayerSecurity($null)\n \n$RootDseSearchRequest = New-Object -TypeName System.DirectoryServices.Protocols.SearchRequest -ArgumentList '', &quot;(&amp;(objectClass=*))&quot;, &quot;Base&quot;\nTry\n{\n    $RootDseSearchResponse = $null\n    $RootDseSearchResponse = $Ldap.SendRequest($RootDseSearchRequest)\n}\nCatch\n{\n    $Ldap.Dispose()\n    throw $_\n}\n&quot;Default naming context: {0}&quot; -f $RootDseSearchResponse.Entries[0].Attributes[&quot;defaultNamingContext&quot;].GetValues([String])\n \n&quot;Binding&quot; | Write-Host\nTry\n{\n    $Ldap.Bind()\n}\nCatch\n{\n    throw\n}\n \n# Send an Extended WHOAMI request\n$ExtReq = New-Object -TypeName System.DirectoryServices.Protocols.ExtendedRequest -ArgumentList &quot;1.3.6.1.4.1.4203.1.11.3&quot;\n$ExtRes = [System.DirectoryServices.Protocols.ExtendedResponse] $Ldap.SendRequest($ExtReq)\n&quot;Bound as identity: '{0}'&quot; -f [System.Text.Encoding]::UTF8.GetString($ExtRes.ResponseValue)\n# Change to a user you want to add to domain admins \n$UserDN = &quot;CN=Guest,CN=Users,DC=nttest,DC=chrisse,DC=com&quot;\n&quot;Adding '{0}' to Domain Admins&quot; -f $UserDN\n$Modify = [System.DirectoryServices.Protocols.ModifyRequest]::new(&quot;CN=Domain Admins,CN=Users,DC=nttest,DC=chrisse,DC=com&quot;, &quot;Add&quot;, &quot;member&quot;, $UserDN)\n\nTry\n{\n    $Response = $Ldap.SendRequest($Modify)\n}\nCatch\n{\n    $Response = $_.Exception.GetBaseException().Response\n}\n&quot;Result: {0}&quot; -f $Response.ResultCode\n$Ldap.Dispose()\" style=\"color:#24292eff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki min-light\" style=\"background-color: #ffffff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6F42C1\">Add-Type<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">AssemblyName System.DirectoryServices.Protocols<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6F42C1\">Add-Type<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">AssemblyName System.Security<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C2C3C5\"># Change the domain controller to your own DC instead of &#39;nttest-dc-01.nttest.chrisse.com&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Id <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">TypeName System.DirectoryServices.Protocols.LdapDirectoryIdentifier <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ArgumentList <\/span><span style=\"color: #22863A\">&#39;nttest-dc-01.nttest.chrisse.com&#39;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">389<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">$true<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">$false<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Ldap <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">TypeName System.DirectoryServices.Protocols.LdapConnection <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ArgumentList $Id<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">$null<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> ([<\/span><span style=\"color: #D32F2F\">System.DirectoryServices.Protocols.AuthType<\/span><span style=\"color: #24292EFF\">]::External)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Ldap.AutoBind <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">$false<\/span><\/span>\n<span class=\"line\"><span style=\"color: #22863A\">&quot;Certificate selection&quot;<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">|<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">Write-Host<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Location <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> [<\/span><span style=\"color: #D32F2F\">System.Security.Cryptography.X509Certificates.StoreLocation<\/span><span style=\"color: #24292EFF\">]::CurrentUser<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Name <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> [<\/span><span style=\"color: #D32F2F\">System.Security.Cryptography.X509Certificates.StoreName<\/span><span style=\"color: #24292EFF\">]::My<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Store <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">TypeName System.Security.Cryptography.X509Certificates.X509Store <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ArgumentList $Name<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> $Location<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Store.Open(<\/span><span style=\"color: #22863A\">&quot;ReadOnly, MaxAllowed, OpenExistingOnly&quot;<\/span><span style=\"color: #24292EFF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Cert <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> [<\/span><span style=\"color: #D32F2F\">System.Security.Cryptography.X509Certificates.X509Certificate2UI<\/span><span style=\"color: #24292EFF\">]::SelectFromCollection($Store.Certificates.Find(<\/span><span style=\"color: #22863A\">&quot;FindByKeyUsage&quot;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">0xa0<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">$true<\/span><span style=\"color: #24292EFF\">).Find(<\/span><span style=\"color: #22863A\">&quot;FindByExtension&quot;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;2.5.29.35&quot;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">$true<\/span><span style=\"color: #24292EFF\">)<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;Certificate selection&quot;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;Select a certificate&quot;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;SingleSelection&quot;<\/span><span style=\"color: #24292EFF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Store.Dispose()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Ldap.ClientCertificates.Clear()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">[<\/span><span style=\"color: #D32F2F\">void<\/span><span style=\"color: #24292EFF\">]$Ldap.ClientCertificates.Add($Cert[<\/span><span style=\"color: #1976D2\">0<\/span><span style=\"color: #24292EFF\">])<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Ldap.SessionOptions.QueryClientCertificate <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    <\/span><span style=\"color: #D32F2F\">param<\/span><span style=\"color: #24292EFF\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">        [<\/span><span style=\"color: #D32F2F\">System.DirectoryServices.Protocols.LdapConnection<\/span><span style=\"color: #24292EFF\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">        $Connection<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">        <\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> [<\/span><span style=\"color: #D32F2F\">Byte<\/span><span style=\"color: #24292EFF\">[][]]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">        $TrustedCAs<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    )<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    <\/span><span style=\"color: #D32F2F\">return<\/span><span style=\"color: #24292EFF\"> $Cert[<\/span><span style=\"color: #1976D2\">0<\/span><span style=\"color: #24292EFF\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #22863A\">&quot;Starting TLS&quot;<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">|<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">Write-Host<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Ldap.SessionOptions.StartTransportLayerSecurity(<\/span><span style=\"color: #1976D2\">$null<\/span><span style=\"color: #24292EFF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$RootDseSearchRequest <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">TypeName System.DirectoryServices.Protocols.SearchRequest <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ArgumentList <\/span><span style=\"color: #22863A\">&#39;&#39;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;(&amp;(objectClass=*))&quot;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;Base&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D32F2F\">Try<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    $RootDseSearchResponse <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">$null<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    $RootDseSearchResponse <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> $Ldap.SendRequest($RootDseSearchRequest)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D32F2F\">Catch<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    $Ldap.Dispose()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    <\/span><span style=\"color: #D32F2F\">throw<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">$_<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #22863A\">&quot;Default naming context: {0}&quot;<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-f<\/span><span style=\"color: #24292EFF\"> $RootDseSearchResponse.Entries[<\/span><span style=\"color: #1976D2\">0<\/span><span style=\"color: #24292EFF\">].Attributes[<\/span><span style=\"color: #22863A\">&quot;defaultNamingContext&quot;<\/span><span style=\"color: #24292EFF\">].GetValues([<\/span><span style=\"color: #D32F2F\">String<\/span><span style=\"color: #24292EFF\">])<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #22863A\">&quot;Binding&quot;<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">|<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">Write-Host<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D32F2F\">Try<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    $Ldap.Bind()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D32F2F\">Catch<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    <\/span><span style=\"color: #D32F2F\">throw<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #C2C3C5\"># Send an Extended WHOAMI request<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ExtReq <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">TypeName System.DirectoryServices.Protocols.ExtendedRequest <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ArgumentList <\/span><span style=\"color: #22863A\">&quot;1.3.6.1.4.1.4203.1.11.3&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ExtRes <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> [<\/span><span style=\"color: #D32F2F\">System.DirectoryServices.Protocols.ExtendedResponse<\/span><span style=\"color: #24292EFF\">] $Ldap.SendRequest($ExtReq)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #22863A\">&quot;Bound as identity: &#39;{0}&#39;&quot;<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-f<\/span><span style=\"color: #24292EFF\"> [<\/span><span style=\"color: #D32F2F\">System.Text.Encoding<\/span><span style=\"color: #24292EFF\">]::UTF8.GetString($ExtRes.ResponseValue)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C2C3C5\"># Change to a user you want to add to domain admins <\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$UserDN <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;CN=Guest,CN=Users,DC=nttest,DC=chrisse,DC=com&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #22863A\">&quot;Adding &#39;{0}&#39; to Domain Admins&quot;<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-f<\/span><span style=\"color: #24292EFF\"> $UserDN<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Modify <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> [<\/span><span style=\"color: #D32F2F\">System.DirectoryServices.Protocols.ModifyRequest<\/span><span style=\"color: #24292EFF\">]::new(<\/span><span style=\"color: #22863A\">&quot;CN=Domain Admins,CN=Users,DC=nttest,DC=chrisse,DC=com&quot;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;Add&quot;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;member&quot;<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> $UserDN)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D32F2F\">Try<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    $Response <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> $Ldap.SendRequest($Modify)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D32F2F\">Catch<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">    $Response <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #1976D2\">$_.Exception.GetBaseException<\/span><span style=\"color: #24292EFF\">().Response<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #22863A\">&quot;Result: {0}&quot;<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-f<\/span><span style=\"color: #24292EFF\"> $Response.ResultCode<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$Ldap.Dispose()<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>Supply in the request (SITR)  with Strong Certificate Binding Enforcement<\/strong><\/p>\n\n\n\n<p>If we now enable Strong Certificate Binding Enforcement on our KDCs \/ Domain Controllers by setting\/creating the following registry key:<br>&#8220;HKLM\\SYSTEM\\CurrentControlSet\\Services\\Kdc\\StrongCertificateBindingEnforcement&#8221; as type DWORD and set the value to &#8220;2&#8221; &#8211; Strong Certificate Binding Enforcement is now enabled<br><br>We can verify this by trying to authenticate with the certificate already issued above, with the subject CN=DEMO1 &#8211; simply run LDAP-STARTTLS &#8211; select the certificate issued by the previous script when prompted.<\/p>\n\n\n\n<p>This time the authentication should fail, this is expected as the certificate would not be compliant with Strong Certificate Binding Enforcement, It doesn&#8217;t contain the SID extension, neither a SAN with the SID or are being explicit mapped in the altSecID attribute.<br><br>So this means that once we reach Strong Certificate Binding Enforcement on all our KDCs \/ Domain Controllers we&#8217;re safe from this supply in the request madness right? Absolutely NOT. Because what if the SID extension could also be supplied in the request?<br><br>Let&#8217;s issue a certificate once again using the same template &#8216;WebServer&#8217; but supply a SID as well.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#f2f2f2;color:#2f363c\">2. WebServer-AppPolicySCBE.ps1<\/span><span role=\"button\" tabindex=\"0\" data-code=\"Import-Module -Name CertRequestTools\n#CA1 IS Trusted in NTAuth\n$CA1 = &quot;nttest-ca-01.nttest.chrisse.com\\Chrisse Issuing CA 1&quot;\n# Insert the SID as szOID_NTDS_CA_SECURITY_EXT certificate extension\n$SidExtension = New-SidExtension -NTAccount NTTEST\\Administrator\n$ApplicationPoliciesExtension = New-Object -ComObject X509Enrollment.CX509ExtensionMSApplicationPolicies\n$ApplicationPolicyOids = New-Object -ComObject X509Enrollment.CCertificatePolicies.1\n$ApplicationPolicyOid = New-Object -ComObject X509Enrollment.CObjectId\n$ApplicationPolicyOid.InitializeFromValue('1.3.6.1.5.5.7.3.2') #Client Authentication EKU\n$CertificatePolicy = New-Object -ComObject X509Enrollment.CCertificatePolicy\n$CertificatePolicy.Initialize($ApplicationPolicyOid)\n$ApplicationPolicyOids.Add($CertificatePolicy)\n\n\n$ApplicationPoliciesExtension.InitializeEncode($ApplicationPolicyOids)\n$ManagedApplicationPoliciesExtension = \n[System.Security.Cryptography.X509Certificates.X509Extension]::new($ApplicationPoliciesExtension.ObjectId.Value,`\n[Convert]::FromBase64String($ApplicationPoliciesExtension.RawData(1)), $ApplicationPoliciesExtension.Critical)\n\nNew-PrivateKey -RsaKeySize 2048 -KeyName ([Guid]::NewGuid()) | `\nNew-CertificateRequest -Subject &quot;CN=DEMO2&quot; `\n -UserPrincipalName administrator@nttest.chrisse.com `\n -OtherExtension $SidExtension,$ManagedApplicationPoliciesExtension | `\n Submit-CertificateRequest -ConfigString $CA1 -Template WebServer | `\n Install-Certificate -Name My -Location CurrentUser\" style=\"color:#24292eff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki min-light\" style=\"background-color: #ffffff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6F42C1\">Import-Module<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">Name CertRequestTools<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C2C3C5\">#CA1 IS Trusted in NTAuth<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$CA1 <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #22863A\">&quot;nttest-ca-01.nttest.chrisse.com\\Chrisse Issuing CA 1&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C2C3C5\"># Insert the SID as szOID_NTDS_CA_SECURITY_EXT certificate extension<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$SidExtension <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-SidExtension<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">NTAccount NTTEST\\Administrator<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPoliciesExtension <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ComObject X509Enrollment.CX509ExtensionMSApplicationPolicies<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPolicyOids <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ComObject X509Enrollment.CCertificatePolicies.<\/span><span style=\"color: #1976D2\">1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPolicyOid <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ComObject X509Enrollment.CObjectId<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPolicyOid.InitializeFromValue(<\/span><span style=\"color: #22863A\">&#39;1.3.6.1.5.5.7.3.2&#39;<\/span><span style=\"color: #24292EFF\">) <\/span><span style=\"color: #C2C3C5\">#Client Authentication EKU<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$CertificatePolicy <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">New-Object<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ComObject X509Enrollment.CCertificatePolicy<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$CertificatePolicy.Initialize($ApplicationPolicyOid)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPolicyOids.Add($CertificatePolicy)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ApplicationPoliciesExtension.InitializeEncode($ApplicationPolicyOids)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">$ManagedApplicationPoliciesExtension <\/span><span style=\"color: #D32F2F\">=<\/span><span style=\"color: #24292EFF\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">[<\/span><span style=\"color: #D32F2F\">System.Security.Cryptography.X509Certificates.X509Extension<\/span><span style=\"color: #24292EFF\">]::new($ApplicationPoliciesExtension.ObjectId.Value<\/span><span style=\"color: #D32F2F\">,`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\">[<\/span><span style=\"color: #D32F2F\">Convert<\/span><span style=\"color: #24292EFF\">]::FromBase64String($ApplicationPoliciesExtension.RawData(<\/span><span style=\"color: #1976D2\">1<\/span><span style=\"color: #24292EFF\">))<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\"> $ApplicationPoliciesExtension.Critical)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6F42C1\">New-PrivateKey<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">RsaKeySize <\/span><span style=\"color: #1976D2\">2048<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">KeyName ([<\/span><span style=\"color: #D32F2F\">Guid<\/span><span style=\"color: #24292EFF\">]::NewGuid()) <\/span><span style=\"color: #D32F2F\">|<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6F42C1\">New-CertificateRequest<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">Subject <\/span><span style=\"color: #22863A\">&quot;CN=DEMO2&quot;<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">UserPrincipalName administrator@nttest.chrisse.com <\/span><span style=\"color: #D32F2F\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">OtherExtension $SidExtension<\/span><span style=\"color: #D32F2F\">,<\/span><span style=\"color: #24292EFF\">$ManagedApplicationPoliciesExtension <\/span><span style=\"color: #D32F2F\">|<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">Submit-CertificateRequest<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">ConfigString $CA1 <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">Template WebServer <\/span><span style=\"color: #D32F2F\">|<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">`<\/span><\/span>\n<span class=\"line\"><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #6F42C1\">Install-Certificate<\/span><span style=\"color: #24292EFF\"> <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">Name My <\/span><span style=\"color: #D32F2F\">-<\/span><span style=\"color: #24292EFF\">Location CurrentUser<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Now you should have a issued certificate with the subject &#8220;CN=DEMO2&#8221; &#8211; Now use the LDAP-STARTTLS script again to authenticate using the new certificate, make sure you select the right certificate, if you want to be sure you can just open certmgr.msc and delete &#8220;CN=DEMO1&#8221;<br><br>You should now have been authenticated and the KDC \/ Domain Controller is in Strong Certificate Binding Enforcement mode.<br><br>To wrap up this first blog post that is an attempt to cover what is presented in the first part of my session &#8220;When your Enterprise PKI becomes one of your enemies&#8221; at the Hybrid Identity Protection (HIP) Conference 2024 in New Orleans last week there is some key take aways.<\/p>\n\n\n\n<ul class=\"wp-block-list indent40\">\n<li> &#8220;Strong Certificate Binding Enforcement&#8221; will not help you with bad certificate template hygien at all it was designed to prevent CVE-2022-34691, CVE-2022-26931 and CVE-2022-26923.<\/li>\n\n\n\n<li>Certificate Templates without the &#8216;msPKI-Certificate-Application-Policy&#8217; is subject to EKUs being supplied in the request regardless of template version.<\/li>\n\n\n\n<li>Equally &#8211; Certificate Templates with at least one EKU in &#8216;msPKI-Certificate-Application-Policy&#8217; is protected. (You can patch the default v1 &#8216;WebServer&#8217; if you want) &#8211; I&#8217;m not in any way recommending to use v1 templates .<\/li>\n<\/ul>\n\n\n\n<p><a href=\"https:\/\/blog.chrisse.se\/?p=1162\" data-type=\"link\" data-id=\"https:\/\/blog.chrisse.se\/?p=1162\">Next part<\/a> will look into how all this can be mitigated by choosing the right design and how templates can be optimally configured &#8211; but after that I&#8217;m going to cover some of the real bad scenarios.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I presented my session &#8220;When your Enterprise PKI becomes one of your enemies&#8221; at the Hybrid Identity Protection (HIP) Conference 2024 in New Orleans &#8211; Thanks to all who attended my session and for all of the follow up questions I got later during the conference and now also on social media and &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.chrisse.se\/?p=1108\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;When your Enterprise PKI becomes one of your enemies (Part 1)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":"[]"},"categories":[36],"tags":[6,32,37,30,31],"class_list":["post-1108","post","type-post","status-publish","format-standard","hentry","category-public-key-infrastructure-pki","tag-active-directory","tag-adcs","tag-ntauth","tag-pki","tag-sitr"],"_links":{"self":[{"href":"https:\/\/blog.chrisse.se\/index.php?rest_route=\/wp\/v2\/posts\/1108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chrisse.se\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chrisse.se\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chrisse.se\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chrisse.se\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1108"}],"version-history":[{"count":24,"href":"https:\/\/blog.chrisse.se\/index.php?rest_route=\/wp\/v2\/posts\/1108\/revisions"}],"predecessor-version":[{"id":1269,"href":"https:\/\/blog.chrisse.se\/index.php?rest_route=\/wp\/v2\/posts\/1108\/revisions\/1269"}],"wp:attachment":[{"href":"https:\/\/blog.chrisse.se\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chrisse.se\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chrisse.se\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}