Skip to content

Commit 1a69d51

Browse files
authored
Merge pull request #265 from jakehildreth/testing
2025.9.8 - Reduced False Positives!
2 parents 9607c80 + 3fa75b6 commit 1a69d51

14 files changed

+206
-114
lines changed

Invoke-Locksmith.ps1

Lines changed: 143 additions & 92 deletions
Large diffs are not rendered by default.

Locksmith.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
FunctionsToExport = 'Invoke-Locksmith'
99
GUID = 'b1325b42-8dc4-4f17-aa1f-dcb5984ca14a'
1010
HelpInfoURI = 'https://raw.githubusercontent.com/jakehildreth/Locksmith/main/en-US/'
11-
ModuleVersion = '2025.5.26'
11+
ModuleVersion = '2025.9.8'
1212
PowerShellVersion = '5.1'
1313
PrivateData = @{
1414
PSData = @{

Locksmith.psm1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ $Assembly = @(
5353
}
5454
)
5555
$FoundErrors = @(
56-
Foreach ($Import in @($Assembly)) {
56+
foreach ($Import in @($Assembly)) {
5757
try {
5858
Write-Verbose -Message $Import.FullName
5959
Add-Type -Path $Import.Fullname -ErrorAction Stop
@@ -77,10 +77,10 @@ $FoundErrors = @(
7777
}
7878
}
7979
#Dot source the files
80-
Foreach ($Import in @($Classes + $Enums + $Private + $Public)) {
81-
Try {
80+
foreach ($Import in @($Classes + $Enums + $Private + $Public)) {
81+
try {
8282
. $Import.Fullname
83-
} Catch {
83+
} catch {
8484
Write-Error -Message "Failed to import functions from $($import.Fullname): $_"
8585
$true
8686
}

Private/Find-ESC1.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@
5656
} else {
5757
$SID = ($Principal.Translate([System.Security.Principal.SecurityIdentifier])).Value
5858
}
59-
if ( ($SID -notmatch $SafeUsers) -and ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -or ($entry.ActiveDirectoryRights -match 'GenericAll') ) ) {
59+
if (
60+
($SID -notmatch $SafeUsers) -and
61+
( ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -and
62+
( $entry.ObjectType -match '0e10c968-78fb-11d2-90d4-00c04f79dc55|00000000-0000-0000-0000-000000000000' ) ) -or
63+
($entry.ActiveDirectoryRights -match 'GenericAll') )
64+
) {
6065
$Issue = [pscustomobject]@{
6166
Forest = $_.CanonicalName.split('/')[0]
6267
Name = $_.Name

Private/Find-ESC13.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ function Find-ESC13 {
5656
} else {
5757
$SID = ($Principal.Translate([System.Security.Principal.SecurityIdentifier])).Value
5858
}
59-
if ( ($SID -notmatch $SafeUsers) -and ($entry.ActiveDirectoryRights -match 'ExtendedRight') ) {
59+
if (
60+
($SID -notmatch $SafeUsers) -and
61+
( ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -and
62+
( $entry.ObjectType -match '0e10c968-78fb-11d2-90d4-00c04f79dc55|00000000-0000-0000-0000-000000000000' ) ) -or
63+
($entry.ActiveDirectoryRights -match 'GenericAll') )
64+
) {
6065
$Issue = [pscustomobject]@{
6166
Forest = $_.CanonicalName.split('/')[0]
6267
Name = $_.Name

Private/Find-ESC15.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ function Find-ESC15 {
4444
} else {
4545
$SID = ($Principal.Translate([System.Security.Principal.SecurityIdentifier])).Value
4646
}
47-
if ( ($SID -notmatch $SafeUsers) -and ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -or ($entry.ActiveDirectoryRights -match 'GenericAll') ) ) {
47+
if (
48+
($SID -notmatch $SafeUsers) -and
49+
( ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -and
50+
( $entry.ObjectType -match '0e10c968-78fb-11d2-90d4-00c04f79dc55|00000000-0000-0000-0000-000000000000' ) ) -or
51+
($entry.ActiveDirectoryRights -match 'GenericAll') )
52+
) {
4853
$Issue = [pscustomobject]@{
4954
Forest = $_.CanonicalName.split('/')[0]
5055
Name = $_.Name

Private/Find-ESC16.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
if ($_.DisableExtensionList -eq 'Yes') {
4141
$Issue.Issue = @"
4242
The Certification Authority (CA) $($_.CAFullName) has the szOID_NTDS_CA_SECURITY_EXT security extension disabled. When
43-
this extension is disabled, every certificate issued by this CA will be unable to to reliably map a certificate to a
43+
this extension is disabled, every certificate issued by this CA will be unable to reliably map a certificate to a
4444
user or computer account's SID for authentication.
4545
4646
More info:

Private/Find-ESC2.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@
4646
} else {
4747
$SID = ($Principal.Translate([System.Security.Principal.SecurityIdentifier])).Value
4848
}
49-
if ( ($SID -notmatch $SafeUsers) -and ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -or ($entry.ActiveDirectoryRights -match 'GenericAll') ) ) {
49+
if (
50+
($SID -notmatch $SafeUsers) -and
51+
( ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -and
52+
( $entry.ObjectType -match '0e10c968-78fb-11d2-90d4-00c04f79dc55|00000000-0000-0000-0000-000000000000' ) ) -or
53+
($entry.ActiveDirectoryRights -match 'GenericAll') )
54+
) {
5055
$Issue = [pscustomobject]@{
5156
Forest = $_.CanonicalName.split('/')[0]
5257
Name = $_.Name

Private/Find-ESC3C1.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@
4646
} else {
4747
$SID = ($Principal.Translate([System.Security.Principal.SecurityIdentifier])).Value
4848
}
49-
if ( ($SID -notmatch $SafeUsers) -and ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -or ($entry.ActiveDirectoryRights -match 'GenericAll') ) ) {
49+
if (
50+
($SID -notmatch $SafeUsers) -and
51+
( ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -and
52+
( $entry.ObjectType -match '0e10c968-78fb-11d2-90d4-00c04f79dc55|00000000-0000-0000-0000-000000000000' ) ) -or
53+
($entry.ActiveDirectoryRights -match 'GenericAll') )
54+
) {
5055
$Issue = [pscustomobject]@{
5156
Forest = $_.CanonicalName.split('/')[0]
5257
Name = $_.Name

Private/Find-ESC3C2.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@
4747
} else {
4848
$SID = ($Principal.Translate([System.Security.Principal.SecurityIdentifier])).Value
4949
}
50-
if ( ($SID -notmatch $SafeUsers) -and ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -or ($entry.ActiveDirectoryRights -match 'GenericAll') ) ) {
50+
if (
51+
($SID -notmatch $SafeUsers) -and
52+
( ( ($entry.ActiveDirectoryRights -match 'ExtendedRight') -and
53+
( $entry.ObjectType -match '0e10c968-78fb-11d2-90d4-00c04f79dc55|00000000-0000-0000-0000-000000000000' ) ) -or
54+
($entry.ActiveDirectoryRights -match 'GenericAll') )
55+
) {
5156
$Issue = [pscustomobject]@{
5257
Forest = $_.CanonicalName.split('/')[0]
5358
Name = $_.Name

0 commit comments

Comments
 (0)