From d82a658afbd2e4ddf66791a24d999d30ad4365d8 Mon Sep 17 00:00:00 2001 From: Sven Frank <82213858+FiraSenax@users.noreply.github.com> Date: Sat, 21 Nov 2026 00:31:27 +0100 Subject: [PATCH] fix(ad): discover AD CS regressions and validate native metadata --- ...tTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 | 2 +- tests/ad/security/Test.AD-CS-01.md | 8 ++++++-- tests/ad/security/Test.AD-CS-01.ps1 | 14 +++++++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) rename powershell/tests/{ad/collection => functions}/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 (98%) diff --git a/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 b/powershell/tests/functions/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 similarity index 98% rename from powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 rename to powershell/tests/functions/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 index a4ff0adaac..0f1d837994 100644 --- a/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 +++ b/powershell/tests/functions/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 @@ -1,5 +1,5 @@ BeforeAll { - $repoRoot = Resolve-Path (Join-Path $PSScriptRoot '../../../..') + $repoRoot = Resolve-Path (Join-Path $PSScriptRoot '../../..') . (Join-Path $repoRoot 'powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1') function ConvertFrom-MtLdapValue { param($Value) return $Value } } diff --git a/tests/ad/security/Test.AD-CS-01.md b/tests/ad/security/Test.AD-CS-01.md index 852e5f7f9b..11e0acfdc8 100644 --- a/tests/ad/security/Test.AD-CS-01.md +++ b/tests/ad/security/Test.AD-CS-01.md @@ -4,7 +4,7 @@ Evaluates whether an enterprise CA publishes certificate templates whose collect **Operational** -#### Security Recommendation +#### Remediation action - Review every published template that supports client authentication and lets the requester supply subject information. - Require manager approval or authorized signatures where business workflows permit. @@ -24,5 +24,9 @@ The test deliberately distinguishes observed prerequisites from exploitability. - **PotentiallyEligible**: dangerous template and publication conditions exist, with ACL evidence available for follow-up. - **Inconclusive**: required configuration or authorization evidence is unavailable. +#### Related links + +- [AD CS overview](https://learn.microsoft.com/windows-server/identity/ad-cs/active-directory-certificate-services-overview) + -%TestResult% \ No newline at end of file +%TestResult% diff --git a/tests/ad/security/Test.AD-CS-01.ps1 b/tests/ad/security/Test.AD-CS-01.ps1 index b34fee172c..6f97ca0925 100644 --- a/tests/ad/security/Test.AD-CS-01.ps1 +++ b/tests/ad/security/Test.AD-CS-01.ps1 @@ -1,4 +1,11 @@ -function Test-MtAdcsPublishedTemplatePrerequisites { +function Test-MtAdcsPublishedTemplatePrerequisite { + <# + .SYNOPSIS + Reviews published AD CS templates for modeled enrollment prerequisites. + .DESCRIPTION + Correlates CA publication, authentication EKUs, subject supply, manager approval and available authorization + evidence. Candidate results require review and do not establish effective enrollment rights. + #> [MaesterTest( Id = 'AD-CS-01', Title = 'Published AD CS templates should not expose dangerous enrollment prerequisites', @@ -12,7 +19,8 @@ Mitre = 'T1649', Service = 'ActiveDirectory', Permission = ('ActiveDirectory:Ldap:Configuration/*:ReadProperty'), - Author = 'Mario Contestabile' + Author = 'rolling-code', + Contributor = 'FiraSenax' )] [CmdletBinding()] [OutputType([bool])] @@ -44,4 +52,4 @@ Add-MtTestResultDetail -Result "Published template candidates require authorization review. Configuration prerequisites do not prove exploitation.`n`n$result" -Investigate return $null -} \ No newline at end of file +}