@@ -174,15 +174,15 @@ function Find-AuditingIssue {
174
174
Technique = ' DETECT'
175
175
Issue = " Auditing is not fully enabled on $ ( $_.CAFullName ) . Important security events may go unnoticed."
176
176
Fix = @"
177
- certutil.exe -config ` '$ ( $_.CAFullname ) ` ' -setreg `' CA\AuditFilter`' 127
178
- Invoke-Command -ComputerName ` '$ ( $_.dNSHostName ) ` ' -ScriptBlock {
179
- Get-Service -Name ` ' certsvc` ' | Restart-Service -Force
177
+ certutil.exe -config '$ ( $_.CAFullname ) ' -setreg CA\AuditFilter 127
178
+ Invoke-Command -ComputerName '$ ( $_.dNSHostName ) ' -ScriptBlock {
179
+ Get-Service -Name 'certsvc' | Restart-Service -Force
180
180
}
181
181
"@
182
182
Revert = @"
183
- certutil.exe -config $ ( $_.CAFullname ) -setreg CA\AuditFilter $ ( $_.AuditFilter )
184
- Invoke-Command -ComputerName ` '$ ( $_.dNSHostName ) ` ' -ScriptBlock {
185
- Get-Service -Name ` ' certsvc` ' | Restart-Service -Force
183
+ certutil.exe -config ' $ ( $_.CAFullname ) ' -setreg CA\AuditFilter $ ( $_.AuditFilter )
184
+ Invoke-Command -ComputerName '$ ( $_.dNSHostName ) ' -ScriptBlock {
185
+ Get-Service -Name 'certsvc' | Restart-Service -Force
186
186
}
187
187
"@
188
188
}
@@ -282,12 +282,12 @@ More info:
282
282
"@
283
283
Fix = @"
284
284
# Enable Manager Approval
285
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
285
+ `$ Object = '$ ( $_.DistinguishedName ) '
286
286
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 2}
287
287
"@
288
288
Revert = @"
289
289
# Disable Manager Approval
290
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
290
+ `$ Object = '$ ( $_.DistinguishedName ) '
291
291
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 0}
292
292
"@
293
293
Technique = ' ESC1'
@@ -366,20 +366,20 @@ More info:
366
366
'@
367
367
$Issue.Fix = @"
368
368
# Enable the flag
369
- certutil -config $CAFullname -setreg CA\InterfaceFlags +IF_ENFORCEENCRYPTICERTREQUEST
369
+ certutil -config ' $CAFullname ' -setreg CA\InterfaceFlags +IF_ENFORCEENCRYPTICERTREQUEST
370
370
371
371
# Restart the Certificate Authority service
372
- Invoke-Command -ComputerName ` '$ ( $_.dNSHostName ) ` ' -ScriptBlock {
373
- Get-Service -Name `' certsvc`' | Restart-Service -Force
372
+ Invoke-Command -ComputerName '$ ( $_.dNSHostName ) ' -ScriptBlock {
373
+ Get-Service -Name certsvc | Restart-Service -Force
374
374
}
375
375
"@
376
376
$Issue.Revert = @"
377
377
# Disable the flag
378
- certutil -config $CAFullname -setreg CA\InterfaceFlags -IF_ENFORCEENCRYPTICERTREQUEST
378
+ certutil -config ' $CAFullname ' -setreg CA\InterfaceFlags -IF_ENFORCEENCRYPTICERTREQUEST
379
379
380
380
# Restart the Certificate Authority service
381
- Invoke-Command -ComputerName ` '$ ( $_.dNSHostName ) ` ' -ScriptBlock {
382
- Get-Service -Name `' certsvc`' | Restart-Service -Force
381
+ Invoke-Command -ComputerName '$ ( $_.dNSHostName ) ' -ScriptBlock {
382
+ Get-Service -Name certsvc | Restart-Service -Force
383
383
}
384
384
"@
385
385
}
@@ -474,12 +474,12 @@ More info:
474
474
"@
475
475
Fix = @"
476
476
# Enable Manager Approval
477
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
477
+ `$ Object = '$ ( $_.DistinguishedName ) '
478
478
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 2}
479
479
"@
480
480
Revert = @"
481
481
# Disable Manager Approval
482
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
482
+ `$ Object = '$ ( $_.DistinguishedName ) '
483
483
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 0}
484
484
"@
485
485
Technique = ' ESC13'
@@ -681,12 +681,12 @@ More info:
681
681
"@
682
682
Fix = @"
683
683
# Enable Manager Approval
684
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
684
+ `$ Object = '$ ( $_.DistinguishedName ) '
685
685
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 2}
686
686
"@
687
687
Revert = @"
688
688
# Disable Manager Approval
689
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
689
+ `$ Object = '$ ( $_.DistinguishedName ) '
690
690
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 0}
691
691
"@
692
692
Technique = ' ESC2'
@@ -772,12 +772,12 @@ More info:
772
772
"@
773
773
Fix = @"
774
774
# Enable Manager Approval
775
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
775
+ `$ Object = '$ ( $_.DistinguishedName ) '
776
776
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 2}
777
777
"@
778
778
Revert = @"
779
779
# Disable Manager Approval
780
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
780
+ `$ Object = '$ ( $_.DistinguishedName ) '
781
781
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 0}
782
782
"@
783
783
Technique = ' ESC3'
@@ -865,12 +865,12 @@ More info:
865
865
First, eliminate unused Enrollment Agent templates.
866
866
Then, tightly scope any Enrollment Agent templates that remain and:
867
867
# Enable Manager Approval
868
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
868
+ `$ Object = '$ ( $_.DistinguishedName ) '
869
869
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 2}
870
870
"@
871
871
Revert = @"
872
872
# Disable Manager Approval
873
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
873
+ `$ Object = '$ ( $_.DistinguishedName ) '
874
874
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 0}
875
875
"@
876
876
Technique = ' ESC3'
@@ -996,16 +996,16 @@ More info:
996
996
997
997
"@
998
998
Fix = @"
999
- `$ Owner = New-Object System.Security.Principal.SecurityIdentifier(` '$PreferredOwner ` ' )
1000
- `$ ACL = Get-Acl -Path ` ' AD:$ ( $_.DistinguishedName ) ` '
999
+ `$ Owner = New-Object System.Security.Principal.SecurityIdentifier('$PreferredOwner ')
1000
+ `$ ACL = Get-Acl -Path 'AD:$ ( $_.DistinguishedName ) '
1001
1001
`$ ACL.SetOwner(`$ Owner)
1002
- Set-ACL -Path ` ' AD:$ ( $_.DistinguishedName ) ` ' -AclObject `$ ACL
1002
+ Set-ACL -Path 'AD:$ ( $_.DistinguishedName ) ' -AclObject `$ ACL
1003
1003
"@
1004
1004
Revert = @"
1005
- `$ Owner = New-Object System.Security.Principal.SecurityIdentifier(` '$ ( $_.nTSecurityDescriptor.Owner ) ` ' )
1006
- `$ ACL = Get-Acl -Path ` ' AD:$ ( $_.DistinguishedName ) ` '
1005
+ `$ Owner = New-Object System.Security.Principal.SecurityIdentifier('$ ( $_.nTSecurityDescriptor.Owner ) ')
1006
+ `$ ACL = Get-Acl -Path 'AD:$ ( $_.DistinguishedName ) '
1007
1007
`$ ACL.SetOwner(`$ Owner)
1008
- Set-ACL -Path ` ' AD:$ ( $_.DistinguishedName ) ` ' -AclObject `$ ACL
1008
+ Set-ACL -Path 'AD:$ ( $_.DistinguishedName ) ' -AclObject `$ ACL
1009
1009
"@
1010
1010
Technique = ' ESC4'
1011
1011
}
@@ -1050,13 +1050,13 @@ More info:
1050
1050
1051
1051
"@
1052
1052
Fix = @"
1053
- `$ ACL = Get-Acl -Path ` ' AD:$ ( $_.DistinguishedName ) ` '
1053
+ `$ ACL = Get-Acl -Path 'AD:$ ( $_.DistinguishedName ) '
1054
1054
foreach ( `$ ace in `$ ACL.access ) {
1055
1055
if ( (`$ ace.IdentityReference.Value -like '$ ( $Principal.Value ) ' ) -and ( `$ ace.ActiveDirectoryRights -notmatch '^ExtendedRight$') ) {
1056
1056
`$ ACL.RemoveAccessRule(`$ ace) | Out-Null
1057
1057
}
1058
1058
}
1059
- Set-Acl -Path ` ' AD:$ ( $_.DistinguishedName ) ` ' -AclObject `$ ACL
1059
+ Set-Acl -Path 'AD:$ ( $_.DistinguishedName ) ' -AclObject `$ ACL
1060
1060
"@
1061
1061
Revert = ' [TODO]'
1062
1062
Technique = ' ESC4'
@@ -1231,16 +1231,16 @@ More info:
1231
1231
1232
1232
"@
1233
1233
Fix = @"
1234
- `$ Owner = New-Object System.Security.Principal.SecurityIdentifier(` '$PreferredOwner ` ' )
1235
- `$ ACL = Get-Acl -Path ` ' AD:$ ( $_.DistinguishedName ) ` '
1234
+ `$ Owner = New-Object System.Security.Principal.SecurityIdentifier('$PreferredOwner ')
1235
+ `$ ACL = Get-Acl -Path 'AD:$ ( $_.DistinguishedName ) '
1236
1236
`$ ACL.SetOwner(`$ Owner)
1237
- Set-ACL -Path ` ' AD:$ ( $_.DistinguishedName ) ` ' -AclObject `$ ACL
1237
+ Set-ACL -Path 'AD:$ ( $_.DistinguishedName ) ' -AclObject `$ ACL
1238
1238
"@
1239
1239
Revert = "
1240
- `$ Owner = New-Object System.Security.Principal.SecurityIdentifier(` '$ ( $_.nTSecurityDescriptor.Owner ) ` ' )
1241
- `$ ACL = Get-Acl -Path ` ' AD:$ ( $_.DistinguishedName ) ` '
1240
+ `$ Owner = New-Object System.Security.Principal.SecurityIdentifier('$ ( $_.nTSecurityDescriptor.Owner ) ')
1241
+ `$ ACL = Get-Acl -Path 'AD:$ ( $_.DistinguishedName ) '
1242
1242
`$ ACL.SetOwner(`$ Owner)
1243
- Set-ACL -Path ` ' AD:$ ( $_.DistinguishedName ) ` ' -AclObject `$ ACL"
1243
+ Set-ACL -Path 'AD:$ ( $_.DistinguishedName ) ' -AclObject `$ ACL"
1244
1244
Technique = ' ESC5'
1245
1245
} # end switch ($_.objectClass)
1246
1246
if ($SkipRisk -eq $false ) {
@@ -1331,14 +1331,14 @@ $IssueDetail
1331
1331
1332
1332
"@
1333
1333
Fix = @"
1334
- `$ ACL = Get-Acl -Path ` ' AD:$ ( $_.DistinguishedName ) ` '
1334
+ `$ ACL = Get-Acl -Path 'AD:$ ( $_.DistinguishedName ) '
1335
1335
foreach ( `$ ace in `$ ACL.access ) {
1336
1336
if ( (`$ ace.IdentityReference.Value -like '$ ( $Principal.Value ) ' ) -and
1337
1337
( `$ ace.ActiveDirectoryRights -notmatch '^ExtendedRight$') ) {
1338
1338
`$ ACL.RemoveAccessRule(`$ ace) | Out-Null
1339
1339
}
1340
1340
}
1341
- Set-Acl -Path ` ' AD:$ ( $_.DistinguishedName ) ` ' -AclObject `$ ACL
1341
+ Set-Acl -Path 'AD:$ ( $_.DistinguishedName ) ' -AclObject `$ ACL
1342
1342
"@
1343
1343
Revert = ' [TODO]'
1344
1344
Technique = ' ESC5'
@@ -1416,20 +1416,20 @@ More info:
1416
1416
"@
1417
1417
$Issue.Fix = @"
1418
1418
# Disable the flag
1419
- certutil -config $CAFullname -setreg policy\EditFlags -EDITF_ATTRIBUTESUBJECTALTNAME2
1419
+ certutil -config ' $CAFullname ' -setreg policy\EditFlags -EDITF_ATTRIBUTESUBJECTALTNAME2
1420
1420
1421
1421
# Restart the Certificate Authority service
1422
- Invoke-Command -ComputerName ` '$ ( $_.dNSHostName ) ` ' -ScriptBlock {
1423
- Get-Service -Name `' certsvc`' | Restart-Service -Force
1422
+ Invoke-Command -ComputerName '$ ( $_.dNSHostName ) ' -ScriptBlock {
1423
+ Get-Service -Name certsvc | Restart-Service -Force
1424
1424
}
1425
1425
"@
1426
1426
$Issue.Revert = @"
1427
1427
# Enable the flag
1428
- certutil -config $CAFullname -setreg policy\EditFlags +EDITF_ATTRIBUTESUBJECTALTNAME2
1428
+ certutil -config ' $CAFullname ' -setreg policy\EditFlags +EDITF_ATTRIBUTESUBJECTALTNAME2
1429
1429
1430
1430
# Restart the Certificate Authority service
1431
- Invoke-Command -ComputerName ` '$ ( $_.dNSHostName ) ` ' -ScriptBlock {
1432
- Get-Service -Name `' certsvc`' | Restart-Service -Force
1431
+ Invoke-Command -ComputerName '$ ( $_.dNSHostName ) ' -ScriptBlock {
1432
+ Get-Service -Name certsvc | Restart-Service -Force
1433
1433
}
1434
1434
"@
1435
1435
}
@@ -2453,7 +2453,7 @@ function Invoke-Scans {
2453
2453
}
2454
2454
else {
2455
2455
# To Do: Check for admin and prompt to install features/modules or revert to 'All'.
2456
- Write-Information " Out-GridView and Out-ConsoleGridView were not found on your system. Defaulting to ` ' All` ' ."
2456
+ Write-Information " Out-GridView and Out-ConsoleGridView were not found on your system. Defaulting to 'All'."
2457
2457
$Scans = ' All'
2458
2458
}
2459
2459
}
@@ -3794,11 +3794,11 @@ function Update-ESC1Remediation {
3794
3794
# to a smaller group or a single user/service account.
3795
3795
3796
3796
# 2. Remove the ability to submit a SAN (aka disable "Supply in the request").
3797
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
3797
+ `$ Object = '$ ( $_.DistinguishedName ) '
3798
3798
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Certificate-Name-Flag' = 0}
3799
3799
3800
3800
# 3. Enable Manager Approval
3801
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
3801
+ `$ Object = '$ ( $_.DistinguishedName ) '
3802
3802
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 2}
3803
3803
"@
3804
3804
@@ -3807,11 +3807,11 @@ Get-ADObject `$Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 2}
3807
3807
# back to $ ( $Issue.IdentityReference ) .
3808
3808
3809
3809
# 2. Restore the ability to submit a SAN.
3810
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
3810
+ `$ Object = '$ ( $_.DistinguishedName ) '
3811
3811
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Certificate-Name-Flag' = 1}
3812
3812
3813
3813
# 3. Disable Manager Approval
3814
- `$ Object = ` '$ ( $_.DistinguishedName ) ` '
3814
+ `$ Object = '$ ( $_.DistinguishedName ) '
3815
3815
Get-ADObject `$ Object | Set-ADObject -Replace @{'msPKI-Enrollment-Flag' = 0}
3816
3816
"@
3817
3817
}
@@ -4382,6 +4382,7 @@ function Invoke-Locksmith {
4382
4382
)
4383
4383
4384
4384
$Version = ' 2025.1.12'
4385
+
4385
4386
$LogoPart1 = @'
4386
4387
_ _____ _______ _ _ _______ _______ _____ _______ _ _
4387
4388
| | | | |____/ |______ | | | | | |_____|
0 commit comments