@@ -178,7 +178,7 @@ def query_ldap_server_certificates(esc_raw_filter, esc_name)
178
178
def convert_sids_to_human_readable_name ( sids_array )
179
179
output = [ ]
180
180
for sid in sids_array
181
- raw_filter = "(objectSID=#{ sid } )"
181
+ raw_filter = "(objectSID=#{ ldap_escape_filter ( sid . to_s ) } )"
182
182
attributes = [ 'sAMAccountName' , 'name' ]
183
183
base_prefix = 'CN=Configuration'
184
184
sid_entry = query_ldap_server ( raw_filter , attributes , base_prefix : base_prefix ) # First try with prefix to find entries that may be group specific.
@@ -344,7 +344,7 @@ def find_enrollable_vuln_certificate_templates
344
344
# have permissions to enroll in certificates on each server.
345
345
346
346
@vuln_certificate_details . each_key do |certificate_template |
347
- certificate_enrollment_raw_filter = "(&(objectClass=pKIEnrollmentService)(certificateTemplates=#{ certificate_template } ))"
347
+ certificate_enrollment_raw_filter = "(&(objectClass=pKIEnrollmentService)(certificateTemplates=#{ ldap_escape_filter ( certificate_template . to_s ) } ))"
348
348
attributes = [ 'cn' , 'dnsHostname' , 'ntsecuritydescriptor' ]
349
349
base_prefix = 'CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration'
350
350
enrollment_ca_data = query_ldap_server ( certificate_enrollment_raw_filter , attributes , base_prefix : base_prefix )
@@ -418,7 +418,7 @@ def get_pki_object_by_oid(oid)
418
418
419
419
if pki_object . nil?
420
420
pki_object = query_ldap_server (
421
- "(&(objectClass=msPKI-Enterprise-Oid)(msPKI-Cert-Template-OID=#{ oid } ))" ,
421
+ "(&(objectClass=msPKI-Enterprise-Oid)(msPKI-Cert-Template-OID=#{ ldap_escape_filter ( oid . to_s ) } ))" ,
422
422
nil ,
423
423
base_prefix : 'CN=OID,CN=Public Key Services,CN=Services,CN=Configuration'
424
424
) &.first
0 commit comments