Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESC11 Detections #177

Merged
merged 7 commits into from
Nov 3, 2024
Merged

ESC11 Detections #177

merged 7 commits into from
Nov 3, 2024

Conversation

TrimarcJake
Copy link
Owner

Includes:

  • Find
  • Issue Description
  • Fix
  • Revert
  • Mode 4 info

Copy link

github-actions bot commented Nov 2, 2024

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
⚠️ COPYPASTE jscpd yes 18 1.99s
⚠️ EDITORCONFIG editorconfig-checker 14 1 0.1s
⚠️ MARKDOWN markdownlint 1 11 1.18s
⚠️ MARKDOWN markdown-link-check 1 8 3.31s
✅ MARKDOWN markdown-table-formatter 1 0 0.26s
⚠️ POWERSHELL powershell 13 7 22.47s
✅ POWERSHELL powershell_formatter 13 0 15.98s
⚠️ REPOSITORY checkov yes 1 12.56s
✅ REPOSITORY gitleaks yes no 0.61s
✅ REPOSITORY git_diff yes no 0.02s
✅ REPOSITORY grype yes no 16.61s
✅ REPOSITORY secretlint yes no 0.91s
✅ REPOSITORY trivy yes no 5.82s
✅ REPOSITORY trivy-sbom yes no 1.39s
✅ REPOSITORY trufflehog yes no 7.16s
⚠️ SPELL cspell 15 286 8.02s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Name = $_.Name
DistinguishedName = $_.DistinguishedName
Technique = 'ESC11'
Issue = $_.AuditFilter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking because I haven't run and tested results yet: is $_.AuditFilter right? What should that return?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. I also updated the ESC6 logic which does the same check!

@@ -27,6 +27,9 @@ function Invoke-Remediation {
.PARAMETER ESC6
A PS Object containing all necessary information about ESC6 issues.

.PARAMETER ESC6
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy/paste fix needed here for "ESC11."

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


.NOTES
- The script requires the following functions to be defined: Find-AuditingIssue, Find-ESC1, Find-ESC2, Find-ESC3Condition1,
Find-ESC3Condition2, Find-ESC4, Find-ESC5, Find-ESC6, Find-ESC8.
Find-ESC3Condition2, Find-ESC4, Find-ESC5, Find-ESC6, Find-ESC8, Find-ESC8.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy/paste fix for "Find-ESC11" needed.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

[array]$ESC6 = Find-ESC6 -ADCSObjects $ADCSObjects
}
ESC8 {
Write-Host 'Identifying HTTP-based certificate enrollment interfaces (ESC8)...'
[array]$ESC8 = Find-ESC8 -ADCSObjects $ADCSObjects
}
ESC6 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy/paste fix "ESC6" to "ESC11"

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

[array]$ESC6 = Find-ESC6 -ADCSObjects $ADCSObjects
}
ESC8 {
Write-Host 'Identifying HTTP-based certificate enrollment interfaces (ESC8)...'
[array]$ESC8 = Find-ESC8 -ADCSObjects $ADCSObjects
}
ESC6 {
Write-Host 'Identifying Issuing CAs with IF_ENFORCEENCRYPTICERTREQUEST disabled (ESC11)...'
[array]$ESC6 = Find-ESC6 -ADCSObjects $ADCSObjects
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy/paste fix "ESC6" to "ESC11"

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!


# If these are all empty = no issues found, exit
if ((!$AuditingIssues) -and (!$ESC1) -and (!$ESC2) -and (!$ESC3) -and (!$ESC4) -and (!$ESC5) -and (!$ESC6) -and (!$ESC8) ) {
if ((!$AuditingIssues) -and (!$ESC1) -and (!$ESC2) -and (!$ESC3) -and (!$ESC4) -and (!$ESC5) -and (!$ESC6) -and (!$ESC8) -and ($ESC11) ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new segment should be -and (!($ESC11) ) { but is missing the ! operator.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

# FixIt = {Write-Output 'Add code to fix the vulnerable configuration.'}
# ReferenceUrls = ''
# },
[VulnerableConfigurationItem]@{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to the dictionary should include a bump in the dictionary version attribute on line 24, which is currently: static [string] $Version = '2023.10.01.000'.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@@ -123,11 +123,21 @@ public class TrustAllCertsPolicy : ICertificatePolicy {
$CertutilFlag = certutil -config $CAFullName -getreg policy\EditFlags
}
} catch {
$AuditFilter = 'Failure'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summarize changes here, please? What is being added/removed/changed?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESC11 requires checking for the existence (or non-existence, really) of the IF_ENFORCEENCRYPTICERTREQUEST flag on a CA. These changes add that logic as a new attribute on the issue object.

Also, I noticed the $AuditFilter was being used in places it shouldn't have been, so those were cleaned up. (Though I obviously forgot to clean them up in Get-ESC11 😬

Copy link
Collaborator

@SamErde SamErde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of changes in this PR! I think I was able to review and follow it all except for one spot that I commented for additional explanation. Other than that, it's mostly just copy/paste spots that need to be updated with fresh "ESC11" text. Nice progress!

@TrimarcJake TrimarcJake merged commit 3210fe7 into testing Nov 3, 2024
3 checks passed
@TrimarcJake TrimarcJake deleted the esc11-detections branch November 10, 2024 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants