Skip to content

Commit 1c41c73

Browse files
committed
Fix a missing ESC16 check
1 parent 25c72d4 commit 1c41c73

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

modules/auxiliary/gather/ldap_esc_vulnerable_cert_finder.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,9 @@ def find_esc15_vuln_cert_templates
651651
end
652652

653653
def find_esc16_vuln_cert_templates
654+
# if we were able to read the registry values and this OID is not explicitly disabled, then we know for certain the server is not vulnerable
655+
return if @registry_values.present? && @registry_values[:disable_extension_list] && !@registry_values[:disable_extension_list].include?('1.3.6.1.4.1.311.25.2')
656+
654657
esc16_raw_filter = '(&'\
655658
'(|'\
656659
"(mspki-certificate-name-flag:1.2.840.113556.1.4.804:=#{CT_FLAG_SUBJECT_ALT_REQUIRE_UPN})"\
@@ -809,7 +812,9 @@ def print_vulnerable_cert_info
809812
if potentially_vulnerable_techniques.include?('ESC10')
810813
print_warning(' Potentially vulnerable to: ESC10 (the template is in a vulnerable configuration but in order to exploit registry key StrongCertificateBindingEnforcement must be set to 0 or CertificateMappingMethods must be set to 4)')
811814
end
812-
# TODO: need a warning here when ESC16 is potentially vulnerable
815+
if potentially_vulnerable_techniques.include?('ESC16')
816+
print_warning(' Potentially vulnerable to: ESC16 (the template is in a vulnerable configuration but in order to exploit registry key StrongCertificateBindingEnforcement must be set to either 0 or 1. If StrongCertificateBindingEnforcement is set to 2, ESC16 is exploitable if the active policy EditFlags has EDITF_ATTRIBUTESUBJECTALTNAME2 set.')
817+
end
813818

814819
print_status(" Permissions: #{hash[:permissions].join(', ')}")
815820

@@ -1017,9 +1022,7 @@ def run
10171022

10181023
find_esc13_vuln_cert_templates
10191024
find_esc15_vuln_cert_templates
1020-
if registry_values && registry_values[:disable_extension_list]&.include?('1.3.6.1.4.1.311.25.2')
1021-
find_esc16_vuln_cert_templates
1022-
end
1025+
find_esc16_vuln_cert_templates
10231026

10241027
print_vulnerable_cert_info
10251028

0 commit comments

Comments
 (0)