Land #13975, Fixes for bug #13956

This commit is contained in:
gwillcox-r7 2020-08-11 13:48:17 -05:00
commit 4cbf4d9301
No known key found for this signature in database
GPG Key ID: D35E05C0F2B81E83
2 changed files with 14 additions and 2 deletions

View File

@ -51,8 +51,14 @@ module Enumeration
dns.nameservers -= dns.nameservers
dns.nameservers = ns_a_records
zone = dns.axfr(domain)
rescue ResolverArgumentError, Errno::ECONNREFUSED, Errno::ETIMEDOUT, ::NoResponseError, ::Timeout::Error => e
# Original set of exceptions which were deliberately caught but were missing some
# situations. Leaving these in as they may want to be treated differently
# to other, maybe more generic, exceptions.
rescue ResolverArgumentError, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, ::NoResponseError, ::Timeout::Error => e
print_error("Query #{domain} DNS AXFR - exception: #{e}")
rescue => e
print_error("Query #{domain} DNS AXFR - unknown exception: #{e}")
end
next if zone.blank?
records << zone

View File

@ -65,7 +65,13 @@ class MetasploitModule < Msf::Auxiliary
domain = datastore['DOMAIN']
is_wildcard = dns_wildcard_enabled?(domain)
dns_axfr(domain) if datastore['ENUM_AXFR']
# All exceptions should be being handled by the library
# but catching here as well, just in case.
begin
dns_axfr(domain) if datastore['ENUM_AXFR']
rescue => e
print_error("AXFR failed: #{e}")
end
dns_get_a(domain) if datastore['ENUM_A']
dns_get_cname(domain) if datastore['ENUM_CNAME']
dns_get_ns(domain) if datastore['ENUM_NS']