Skip to content

Commit 94535bb

Browse files
committed
Add support for finding ESC15
1 parent 8e38010 commit 94535bb

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

modules/auxiliary/gather/ldap_esc_vulnerable_cert_finder.rb

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,18 @@ def initialize(info = {})
4545
allows enrollment in and which SIDs are authorized to use that certificate server to
4646
perform this enrollment operation.
4747
48-
Currently the module is capable of checking for certificates that are vulnerable to ESC1, ESC2, ESC3, and
49-
ESC13. The module is limited to checking for these techniques due to them being identifiable remotely from a
50-
normal user account by analyzing the objects in LDAP.
48+
Currently the module is capable of checking for certificates that are vulnerable to ESC1, ESC2, ESC3, ESC13,
49+
and ESC15. The module is limited to checking for these techniques due to them being identifiable remotely from
50+
a normal user account by analyzing the objects in LDAP.
5151
},
5252
'Author' => [
5353
'Grant Willcox', # Original module author
54-
'Spencer McIntyre' # ESC13 update
54+
'Spencer McIntyre' # ESC13 and ESC15 updates
5555
],
5656
'References' => [
5757
[ 'URL', 'https://posts.specterops.io/certified-pre-owned-d95910965cd2' ],
58-
[ 'URL', 'https://posts.specterops.io/adcs-esc13-abuse-technique-fda4272fbd53' ] # ESC13
58+
[ 'URL', 'https://posts.specterops.io/adcs-esc13-abuse-technique-fda4272fbd53' ], # ESC13
59+
[ 'URL', 'https://trustedsec.com/blog/ekuwu-not-just-another-ad-cs-esc' ] # ESC15
5960
],
6061
'DisclosureDate' => '2021-06-17',
6162
'License' => MSF_LICENSE,
@@ -373,6 +374,21 @@ def find_esc13_vuln_cert_templates
373374
end
374375
end
375376

377+
def find_esc15_vuln_cert_templates
378+
esc_raw_filter = '(&'\
379+
'(objectclass=pkicertificatetemplate)'\
380+
'(!(mspki-enrollment-flag:1.2.840.113556.1.4.804:=2))'\
381+
'(|(mspki-ra-signature=0)(!(mspki-ra-signature=*)))'\
382+
'(pkiextendedkeyusage=*)'\
383+
'(mspki-certificate-name-flag:1.2.840.113556.1.4.804:=1)'\
384+
'(mspki-template-schema-version=1)'\
385+
')'
386+
notes = [
387+
'ESC15: Request can specify a subjectAltName (msPKI-Certificate-Name-Flag) and EKUs can be altered (msPKI-Template-Schema-Version)'
388+
]
389+
query_ldap_server_certificates(esc_raw_filter, 'ESC15', notes: notes)
390+
end
391+
376392
def find_enrollable_vuln_certificate_templates
377393
# For each of the vulnerable certificate templates, determine which servers
378394
# allows users to enroll in that certificate template and which users/groups
@@ -555,6 +571,7 @@ def run
555571
find_esc2_vuln_cert_templates
556572
find_esc3_vuln_cert_templates
557573
find_esc13_vuln_cert_templates
574+
find_esc15_vuln_cert_templates
558575

559576
find_enrollable_vuln_certificate_templates
560577
print_vulnerable_cert_info

0 commit comments

Comments
 (0)