Skip to content

Commit

Permalink
Merge branch 'testing' into esc13-detections
Browse files Browse the repository at this point in the history
  • Loading branch information
TrimarcJake authored Nov 10, 2024
2 parents d0bbe92 + 3210fe7 commit c72c78b
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 25 deletions.
79 changes: 68 additions & 11 deletions Invoke-Locksmith.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ function Find-ESC6 {
Name = $_.Name
DistinguishedName = $_.DistinguishedName
Technique = 'ESC6'
Issue = $_.AuditFilter
Issue = $_.SANFlag
Fix = 'N/A'
Revert = 'N/A'
}
Expand Down Expand Up @@ -2468,17 +2468,35 @@ function Set-AdditionalCAProperty {

begin {
$CAEnrollmentEndpoint = @()
$code = @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) {
return true;
}
}
if (-not ([System.Management.Automation.PSTypeName]'TrustAllCertsPolicy') ) {
if ($PSVersionTable.PSEdition -eq 'Desktop') {
$code = @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) {
return true;
}
}
"@
Add-Type -TypeDefinition $code -Language CSharp
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
}
else {
Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
public class TrustAllCertsPolicy {
public static bool TrustAllCerts(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) {
return true;
}
}
"@
Add-Type -TypeDefinition $code -Language CSharp
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
# Set the ServerCertificateValidationCallback
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = [TrustAllCertsPolicy]::TrustAllCerts
}
}
}

process {
Expand Down Expand Up @@ -2662,6 +2680,44 @@ function Set-Severity {
}
}

function Show-LocksmithLogo {
Write-Host '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
Write-Host '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
Write-Host '%%%%%%%%%%%%%%%%%#+==============#%%%%%%%%%%%%%%%%%'
Write-Host '%%%%%%%%%%%%%%#=====================#%%%%%%%%%%%%%%'
Write-Host '%%%%%%%%%%%%#=========================#%%%%%%%%%%%%'
Write-Host '%%%%%%%%%%%=============================%%%%%%%%%%%'
Write-Host '%%%%%%%%%#==============+++==============#%%%%%%%%%'
Write-Host '%%%%%%%%#===========#%%%%%%%%%#===========#%%%%%%%%'
Write-Host '%%%%%%%%==========%%%%%%%%%%%%%%%==========%%%%%%%%'
Write-Host '%%%%%%%*=========%%%%%%%%%%%%%%%%%=========*%%%%%%%'
Write-Host '%%%%%%%+========*%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%+========#%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%+========#%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%+========#%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%+========#%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%+========#%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
Write-Host '#=================================================#'
Write-Host '#=================================================#'
Write-Host '#=================+%%%============================#'
Write-Host '#==================%%%%*==========================#'
Write-Host '#===================*%%%%+========================#'
Write-Host '#=====================#%%%%=======================#'
Write-Host '#======================+%%%%#=====================#'
Write-Host '#========================*%%%%*===================#'
Write-Host '#========================+%%%%%===================#'
Write-Host '#======================#%%%%%+====================#'
Write-Host '#===================+%%%%%%=======================#'
Write-Host '#=================#%%%%%+=========================#'
Write-Host '#==============+%%%%%#============================#'
Write-Host '#============*%%%%%+====+%%%%%%%%%%===============#'
Write-Host '#=============%%*========+********+===============#'
Write-Host '#=================================================#'
Write-Host '#=================================================#'
Write-Host '#=================================================#'
}

function Test-IsADAdmin {
<#
.SYNOPSIS
Expand Down Expand Up @@ -3170,6 +3226,7 @@ function Invoke-Locksmith {
)

$Version = '2024.11.10'

$LogoPart1 = @"
_ _____ _______ _ _ _______ _______ _____ _______ _ _
| | | | |____/ |______ | | | | | |_____|
Expand Down
2 changes: 1 addition & 1 deletion Private/Find-ESC6.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Name = $_.Name
DistinguishedName = $_.DistinguishedName
Technique = 'ESC6'
Issue = $_.AuditFilter
Issue = $_.SANFlag
Fix = 'N/A'
Revert = 'N/A'
}
Expand Down
4 changes: 2 additions & 2 deletions Private/Invoke-Scans.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ function Invoke-Scans {
Write-Host 'Identifying HTTP-based certificate enrollment interfaces (ESC8)...'
[array]$ESC8 = Find-ESC8 -ADCSObjects $ADCSObjects
}
ESC6 {
ESC11 {
Write-Host 'Identifying Issuing CAs with IF_ENFORCEENCRYPTICERTREQUEST disabled (ESC11)...'
[array]$ESC6 = Find-ESC6 -ADCSObjects $ADCSObjects
[array]$ESC11 = Find-ESC11 -ADCSObjects $ADCSObjects
}
All {
Write-Host 'Identifying auditing issues...'
Expand Down
2 changes: 1 addition & 1 deletion Private/New-Dictionary.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ descriptions, code used to find, code used to fix, and reference URLs. This is i

function New-Dictionary {
class VulnerableConfigurationItem {
static [string] $Version = '2023.10.01.000'
static [string] $Version = '2024.11.03.000'
[string]$Name
[ValidateSet('Escalation Path','Server Configuration','GPO Setting')][string]$Category
[string]$Subcategory
Expand Down
37 changes: 27 additions & 10 deletions Private/Set-AdditionalCAProperty.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,34 @@

begin {
$CAEnrollmentEndpoint = @()
$code= @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) {
return true;
}
}
if (-not ([System.Management.Automation.PSTypeName]'TrustAllCertsPolicy') ) {
if ($PSVersionTable.PSEdition -eq 'Desktop') {
$code= @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) {
return true;
}
}
"@
Add-Type -TypeDefinition $code -Language CSharp
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
} else {
Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
public class TrustAllCertsPolicy {
public static bool TrustAllCerts(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) {
return true;
}
}
"@
Add-Type -TypeDefinition $code -Language CSharp
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
# Set the ServerCertificateValidationCallback
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = [TrustAllCertsPolicy]::TrustAllCerts
}
}
}

process {
Expand Down
37 changes: 37 additions & 0 deletions Private/Show-LocksmithLogo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
function Show-LocksmithLogo {
Write-Host '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
Write-Host '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
Write-Host '%%%%%%%%%%%%%%%%%#+==============#%%%%%%%%%%%%%%%%%'
Write-Host '%%%%%%%%%%%%%%#=====================#%%%%%%%%%%%%%%'
Write-Host '%%%%%%%%%%%%#=========================#%%%%%%%%%%%%'
Write-Host '%%%%%%%%%%%=============================%%%%%%%%%%%'
Write-Host '%%%%%%%%%#==============+++==============#%%%%%%%%%'
Write-Host '%%%%%%%%#===========#%%%%%%%%%#===========#%%%%%%%%'
Write-Host '%%%%%%%%==========%%%%%%%%%%%%%%%==========%%%%%%%%'
Write-Host '%%%%%%%*=========%%%%%%%%%%%%%%%%%=========*%%%%%%%'
Write-Host '%%%%%%%+========*%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%+========#%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%+========#%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%+========#%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%+========#%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%+========#%%%%%%%%%%%%%%%%%#=========%%%%%%%'
Write-Host '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
Write-Host '#=================================================#'
Write-Host '#=================================================#'
Write-Host '#=================+%%%============================#'
Write-Host '#==================%%%%*==========================#'
Write-Host '#===================*%%%%+========================#'
Write-Host '#=====================#%%%%=======================#'
Write-Host '#======================+%%%%#=====================#'
Write-Host '#========================*%%%%*===================#'
Write-Host '#========================+%%%%%===================#'
Write-Host '#======================#%%%%%+====================#'
Write-Host '#===================+%%%%%%=======================#'
Write-Host '#=================#%%%%%+=========================#'
Write-Host '#==============+%%%%%#============================#'
Write-Host '#============*%%%%%+====+%%%%%%%%%%===============#'
Write-Host '#=============%%*========+********+===============#'
Write-Host '#=================================================#'
Write-Host '#=================================================#'
Write-Host '#=================================================#'
}

0 comments on commit c72c78b

Please sign in to comment.