fix(detection): tri-state certutil-backed CA properties so query failure is not a finding - #103
Merged
Merged
Conversation
…ure is not a finding - make LS2AdcsObject.AuditingIncomplete [Nullable[bool]]; failure leaves $null, not $false (GH #92) - set $null on throw/empty-result paths in Set-CAAuditFilter, Set-CAEditFlags, Set-CAInterfaceFlags, Set-CADisableExtensionList - fix Set-CADisableExtensionList catch block setting properties on the ErrorRecord ($_) instead of the CA object - add failure-path tests for all four cmdlets and a Find-LS2VulnerableCA regression test (null AuditingIncomplete emits no Auditing issue) - generic condition evaluator already treats $null as non-match; ESCDefinitions unchanged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(detection): tri-state certutil-backed CA properties so query failure is not a finding
Closes #92, together with jakehildreth/PSCertutil#2.
Root cause (two layers)
PSCertutil (the actual trigger):
parseAuditFilterran[int]$AuditFilter = $nullon certutil failure, coercing$nullto0, then always emitted@{ AuditFilter = 0 }. A failed-getreg CA\AuditFilterreturned a real0, so Locksmith2 computedAuditingIncomplete = (0 -ne 127) = $true→ "auditing not enabled" on a query failure. Fixed in fix(parse): emit nothing on certutil failure instead of fabricated 0 PSCertutil#2 (parser now emits nothing on parse failure).Locksmith2 (the design gap, this PR): the four certutil-backed detection properties had no "unknown" state.
AuditingIncompletewas a non-nullable[bool], so a failed/absent query was indistinguishable from "queried, clean." Defense-in-depth even with a fixed parser.What changed
Classes/LS2AdcsObject.ps1:AuditingIncomplete→[Nullable[bool]];$null= unknown/never queried.Set-CA*cmdlets (AuditFilter,EditFlags,InterfaceFlags,DisableExtensionList): set their detection properties to$nullon both throw and empty-result paths, so failure is never clean and a stale rescan value cannot survive.Set-CADisableExtensionListcatch block: it set properties on$_(the ErrorRecord insidecatch), so the failure path had never worked.Set-CA*suites, PSCertutil stub forSet-CADisableExtensionList, Find-level regression proving a CA withAuditingIncomplete = $nullemits noAuditingissue.Verification
main(no Windows Principal/System.DirectoryServicesAPIs); zero new failures.powershell.exe) before merge.Not in this change
-Verbose; a visible warning/dashboard state is possible follow-up, deliberately out of scope.