@@ -6,7 +6,7 @@ function Invoke-Scans {
66 . PARAMETER Scans
77 Specifies the type of scans to perform. Multiple scan options can be provided as an array. The default value is 'All'.
88 The available scan options are: 'Auditing', 'ESC1', 'ESC2', 'ESC3', 'ESC4', 'ESC5', 'ESC6', 'ESC8', 'ESC9', 'ESC11',
9- 'ESC13', 'ESC15, 'EKUwu', 'ESC16', 'All', 'PromptMe'.
9+ 'ESC13', 'ESC15, 'EKUwu', 'ESC16', 'ESC17', ' All', 'PromptMe'.
1010
1111 . NOTES
1212 - The script requires the following functions to be defined: Find-AuditingIssue, Find-ESC1, Find-ESC2, Find-ESC3C1,
@@ -37,6 +37,8 @@ function Invoke-Scans {
3737 [Parameter (Mandatory )]
3838 [string ]$ClientAuthEkus ,
3939 [Parameter (Mandatory )]
40+ [string ]$ServerAuthEkus ,
41+ [Parameter (Mandatory )]
4042 [string ]$DangerousRights ,
4143 [Parameter (Mandatory )]
4244 [string ]$EnrollmentAgentEKU ,
@@ -48,7 +50,7 @@ function Invoke-Scans {
4850 [string ]$SafeUsers ,
4951 [Parameter (Mandatory )]
5052 [string ]$SafeOwners ,
51- [ValidateSet (' Auditing' , ' ESC1' , ' ESC2' , ' ESC3' , ' ESC4' , ' ESC5' , ' ESC6' , ' ESC7' , ' ESC8' , ' ESC9' , ' ESC11' , ' ESC13' , ' ESC15' , ' EKUwu' , ' ESC16' , ' All' , ' PromptMe' )]
53+ [ValidateSet (' Auditing' , ' ESC1' , ' ESC2' , ' ESC3' , ' ESC4' , ' ESC5' , ' ESC6' , ' ESC7' , ' ESC8' , ' ESC9' , ' ESC11' , ' ESC13' , ' ESC15' , ' EKUwu' , ' ESC16' , ' ESC17 ' , ' All' , ' PromptMe' )]
5254 [array ]$Scans = ' All' ,
5355 [Parameter (Mandatory )]
5456 [string ]$UnsafeUsers ,
@@ -133,6 +135,10 @@ function Invoke-Scans {
133135 Write-Host ' Identifying Issuing CAs with szOID_NTDS_CA_SECURITY_EXT disabled (ESC16)...'
134136 [array ]$ESC16 = Find-ESC16 - ADCSObjects $ADCSObjects - UnsafeUsers $UnsafeUsers
135137 }
138+ ESC17 {
139+ Write-Host ' Identifying AD CS templates with dangerous ESC17 configurations...'
140+ [array ]$ESC17 = Find-ESC17 - ADCSObjects $ADCSObjects - SafeUsers $SafeUsers - ServerAuthEKUs $ServerAuthEKUs - Mode $Mode - UnsafeUsers $UnsafeUsers
141+ }
136142 All {
137143 Write-Host ' Identifying auditing issues...'
138144 [array ]$AuditingIssues = Find-AuditingIssue - ADCSObjects $ADCSObjects
@@ -163,10 +169,12 @@ function Invoke-Scans {
163169 [array ]$ESC15 = Find-ESC15 - ADCSObjects $ADCSObjects - SafeUsers $SafeUsers - UnsafeUsers $UnsafeUsers
164170 Write-Host ' Identifying Certificate Authorities with szOID_NTDS_CA_SECURITY_EXT disabled (ESC16)...'
165171 [array ]$ESC16 = Find-ESC16 - ADCSObjects $ADCSObjects - UnsafeUsers $UnsafeUsers
172+ Write-Host ' Identifying AD CS templates with dangerous ESC17 configurations...'
173+ [array ]$ESC17 = Find-ESC17 - ADCSObjects $ADCSObjects - SafeUsers $SafeUsers - ServerAuthEKUs $ServerAuthEkus - Mode $Mode - UnsafeUsers $UnsafeUsers
166174 }
167175 }
168176
169- [array ]$AllIssues = $AuditingIssues + $ESC1 + $ESC2 + $ESC3 + $ESC4 + $ESC5 + $ESC6 + $ESC7 + $ESC8 + $ESC9 + $ESC11 + $ESC13 + $ESC15 + $ESC16
177+ [array ]$AllIssues = $AuditingIssues + $ESC1 + $ESC2 + $ESC3 + $ESC4 + $ESC5 + $ESC6 + $ESC7 + $ESC8 + $ESC9 + $ESC11 + $ESC13 + $ESC15 + $ESC16 + $ESC17
170178
171179 # If these are all empty = no issues found, exit
172180 if ($AllIssues.Count -lt 1 ) {
@@ -191,5 +199,6 @@ function Invoke-Scans {
191199 ESC13 = $ESC13
192200 ESC15 = $ESC15
193201 ESC16 = $ESC16
202+ ESC17 = $ESC17
194203 }
195204}
0 commit comments