Issue #7188 resolved along with checking for all loopback addresses.

bug/bundler_fix
= 2017-03-08 00:02:50 +05:30
parent 23474dfc70
commit 27c2795632
No known key found for this signature in database
GPG Key ID: C646D454D0D42AC3
2 changed files with 17 additions and 9 deletions

View File

@ -48,6 +48,18 @@ module Msf
addrs addrs
end end
#Function to check for loopback addresses
def loopback_addr(addr)
begin
a=IPAddr.new(addr.to_s)
return true if
IPAddr.new('127.0.0.1/8') === a
return true if IPAddr.new('::1') ==a
rescue
end
false
end
# @return [Integer] # @return [Integer]
def bind_port def bind_port
@ -82,12 +94,16 @@ module Msf
'MsfPayload' => self, 'MsfPayload' => self,
'MsfExploit' => assoc_exploit 'MsfExploit' => assoc_exploit
}) })
#Checking whether LHOST is a loopback address
if loopback_addr(ip) ==true
print_warning ("You are attempting to listen on a loopback address by setting LHOST to #{ip}, did you mean to set ReverseListenerBindAddress instead?\n")
end
rescue rescue
ex = $! ex = $!
print_error("Handler failed to bind to #{ip}:#{local_port}:- #{comm} -") print_error("Handler failed to bind to #{ip}:#{local_port}:- #{comm} -")
else else
ex = false ex = false
via = via_string_for_ip(ip, comm) via = via_string_for_ip(ip, comm)
print_status("Started #{human_name} handler on #{ip}:#{local_port} #{via}") print_status("Started #{human_name} handler on #{ip}:#{local_port} #{via}")

View File

@ -1541,14 +1541,6 @@ class Core
@cache_payloads = nil @cache_payloads = nil
end end
# Raise an alert if LHOST is set to 127.0.0.1
name = args[0]
ip = args[1]
if (name.upcase == "LHOST" && ip == "127.0.0.1")
print_warning("You may experience errors with this choice of address for LHOST.")
end
# If the driver indicates that the value is not valid, bust out. # If the driver indicates that the value is not valid, bust out.
if (driver.on_variable_set(global, name, value) == false) if (driver.on_variable_set(global, name, value) == false)
print_error("The value specified for #{name} is not valid.") print_error("The value specified for #{name} is not valid.")