Skip to content

Commit 50beffb

Browse files
committed
Add support for finding ESC15
1 parent c508628 commit 50beffb

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

modules/auxiliary/gather/ldap_esc_vulnerable_cert_finder.rb

+23-6
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,18 @@ def initialize(info = {})
3636
allows enrollment in and which SIDs are authorized to use that certificate server to
3737
perform this enrollment operation.
3838
39-
Currently the module is capable of checking for certificates that are vulnerable to ESC1, ESC2, ESC3, and
40-
ESC13. The module is limited to checking for these techniques due to them being identifiable remotely from a
41-
normal user account by analyzing the objects in LDAP.
39+
Currently the module is capable of checking for certificates that are vulnerable to ESC1, ESC2, ESC3, ESC13,
40+
and ESC15. The module is limited to checking for these techniques due to them being identifiable remotely from
41+
a normal user account by analyzing the objects in LDAP.
4242
},
4343
'Author' => [
4444
'Grant Willcox', # Original module author
45-
'Spencer McIntyre' # ESC13 update
45+
'Spencer McIntyre' # ESC13 and ESC15 updates
4646
],
4747
'References' => [
4848
[ 'URL', 'https://posts.specterops.io/certified-pre-owned-d95910965cd2' ],
49-
[ 'URL', 'https://posts.specterops.io/adcs-esc13-abuse-technique-fda4272fbd53' ] # ESC13
49+
[ 'URL', 'https://posts.specterops.io/adcs-esc13-abuse-technique-fda4272fbd53' ], # ESC13
50+
[ 'URL', 'https://trustedsec.com/blog/ekuwu-not-just-another-ad-cs-esc' ] # ESC15
5051
],
5152
'DisclosureDate' => '2021-06-17',
5253
'License' => MSF_LICENSE,
@@ -238,7 +239,7 @@ def find_esc1_vuln_cert_templates
238239
'(mspki-certificate-name-flag:1.2.840.113556.1.4.804:=1)'\
239240
')'
240241
notes = [
241-
'ESC1: Request can specify a subjectAltName (msPKI-Certificate-Name-Flag)'
242+
'ESC1: Request can specify a subjectAltName (msPKI-Certificate-Name-Flag) and EKUs permit authentication'
242243
]
243244
query_ldap_server_certificates(esc1_raw_filter, 'ESC1', notes: notes)
244245
end
@@ -364,6 +365,21 @@ def find_esc13_vuln_cert_templates
364365
end
365366
end
366367

368+
def find_esc15_vuln_cert_templates
369+
esc_raw_filter = '(&'\
370+
'(objectclass=pkicertificatetemplate)'\
371+
'(!(mspki-enrollment-flag:1.2.840.113556.1.4.804:=2))'\
372+
'(|(mspki-ra-signature=0)(!(mspki-ra-signature=*)))'\
373+
'(pkiextendedkeyusage=*)'\
374+
'(mspki-certificate-name-flag:1.2.840.113556.1.4.804:=1)'\
375+
'(mspki-template-schema-version=1)'\
376+
')'
377+
notes = [
378+
'ESC15: Request can specify a subjectAltName (msPKI-Certificate-Name-Flag) and EKUs can be altered (msPKI-Template-Schema-Version)'
379+
]
380+
query_ldap_server_certificates(esc_raw_filter, 'ESC15', notes: notes)
381+
end
382+
367383
def find_enrollable_vuln_certificate_templates
368384
# For each of the vulnerable certificate templates, determine which servers
369385
# allows users to enroll in that certificate template and which users/groups
@@ -527,6 +543,7 @@ def run
527543
find_esc2_vuln_cert_templates
528544
find_esc3_vuln_cert_templates
529545
find_esc13_vuln_cert_templates
546+
find_esc15_vuln_cert_templates
530547

531548
find_enrollable_vuln_certificate_templates
532549
print_vulnerable_cert_info

0 commit comments

Comments
 (0)