From 1c8a4706d7cf367885e6cf78402717f2c658197d Mon Sep 17 00:00:00 2001 From: Dean Welch Date: Fri, 26 Apr 2024 12:33:43 +0100 Subject: [PATCH] Fix recursive call to `ldap_open` --- modules/auxiliary/admin/dcerpc/cve_2022_26923_certifried.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/auxiliary/admin/dcerpc/cve_2022_26923_certifried.rb b/modules/auxiliary/admin/dcerpc/cve_2022_26923_certifried.rb index 0db7c34f8655..06792401d2c5 100644 --- a/modules/auxiliary/admin/dcerpc/cve_2022_26923_certifried.rb +++ b/modules/auxiliary/admin/dcerpc/cve_2022_26923_certifried.rb @@ -258,7 +258,7 @@ def can_add_computer? quota = nil begin - ldap_open do |ldap| + ldap_connection do |ldap| ldap_options = { filter: Net::LDAP::Filter.eq('objectclass', 'domainDNS'), attributes: 'ms-DS-MachineAccountQuota', @@ -290,7 +290,7 @@ def print_ldap_error(ldap) print_error("#{peer} #{msg}") end - def ldap_open + def ldap_connection ldap_peer = "#{rhost}:#{datastore['LDAP_PORT']}" base = datastore['DOMAIN'].split('.').map { |dc| "dc=#{dc}" }.join(',') ldap_options = { @@ -327,7 +327,7 @@ def get_dnshostname(ldap, c_name) end def impersonate_dc(computer_name) - ldap_open do |ldap| + ldap_connection do |ldap| dc_dnshostname = get_dnshostname(ldap, datastore['DC_NAME']) print_status("Attempting to set the DNS hostname for the computer #{computer_name} to the DNS hostname for the DC: #{datastore['DC_NAME']}") domain_to_ldif = datastore['DOMAIN'].split('.').map { |dc| "dc=#{dc}" }.join(',')