ManageCertificates
Summary
Description
Identification
PowerShell
function Find-ManageCertificates {
[CmdletBinding()]
param( [string] $OutputPath = "ManageCertificates.csv", [string[]]$RightsToMatch = @('ManageCertificates'),[string] $Target = $null )
Import-Module PSPKI -ErrorAction Stop
Import-Module ActiveDirectory -ErrorAction Stop
$Allow = [System.Security.AccessControl.AccessControlType]::Allow
$results = [System.Collections.Generic.List[object]]::new()
function Test-HasWantedRight {
param($ace, [string[]]$wanted)
$parts = ($ace.Rights.ToString() -split ',') | ForEach-Object { $_.Trim() } | Where-Object { $_ }
return [bool]($parts | Where-Object { $wanted -contains $_ })
}
$publishedCAs = $null
try {
if ($Target) {
Write-Host "Using specified CA target: $Target"
$publishedCAs = Get-CertificationAuthority -ComputerName $Target -ErrorAction Stop
}
else {
Write-Host "Enumerating all published Enterprise CAs from AD..."
$publishedCAs = Get-CertificationAuthority -ErrorAction Stop
}
} catch {
Write-Error "Failed to enumerate CAs: $($_.Exception.Message)"
return
}
if (-not $publishedCAs) {
Write-Host "No Certification Authorities found."
return
}
foreach ($ca in $publishedCAs) {
$acl = $null
try {
$acl = $ca | Get-CertificationAuthorityAcl -ErrorAction Stop
} catch {
Write-Warning "Failed to read CA ACL on '$($ca.ComputerName)' ('$($ca.DisplayName)'): $($_.Exception.Message)"
continue
}
if (-not $acl -or -not $acl.Access) { continue }
foreach ($ace in $acl.Access) {
if ($ace.AccessControlType -ne $Allow) { continue }
if ($ace.IsInherited) { continue }
if (Test-HasWantedRight -ace $ace -wanted $RightsToMatch) {
$results.Add([pscustomobject]@{
'CA Host' = $ca.ComputerName
'CA Name' = $ca.DisplayName
'Identity' = $ace.IdentityReference.ToString()
'Rights' = $ace.Rights.ToString()
})
}
}
}
if ($results.Count -gt 0) {
try {
$results | Export-Csv -Path $OutputPath -NoTypeInformation -Encoding UTF8
Write-Host "Results exported to '$OutputPath'"
} catch { Write-Warning "Export failed: $($_.Exception.Message)"}
} else { Write-Host "No matching ACEs found for rights: $($RightsToMatch -join ', ')."}}Certification Authority console

Exploitation
Mitigation

Detection
Event ID
Description
Fields/Attributes
References
References
Last updated
Was this helpful?