3ndG4me / AutoBlue-MS17-010

This is just an semi-automated fully working, no-bs, non-metasploit version of the public exploit code for MS17-010
MIT License
1.15k stars 305 forks source link

Always get raise this problem when i try to run eternal_checker.py ip #21

Closed anoncross closed 3 years ago

anoncross commented 3 years ago

root@kali:/AutoBlue-MS17-010# python eternal_checker.py 192.168.0.101 Traceback (most recent call last): File "eternal_checker.py", line 89, in main() File "eternal_checker.py", line 66, in main conn = MYSMB(options.target_ip, int(options.port)) File "/AutoBlue-MS17-010/mysmb.py", line 122, in init smb.SMB.init(self, remote_host, remote_host, timeout=timeout) File "/usr/local/lib/python2.7/dist-packages/impacket/smb.py", line 2437, in init self.neg_session() File "/AutoBlue-MS17-010/mysmb.py", line 178, in neg_session smb.SMB.neg_session(self, extended_security=self.use_ntlmv2, negPacket=negPacket) File "/usr/local/lib/python2.7/dist-packages/impacket/smb.py", line 2657, in neg_session smb = self.recvSMB() File "/usr/local/lib/python2.7/dist-packages/impacket/smb.py", line 2521, in recvSMB r = self._sess.recv_packet(self.timeout) File "/usr/local/lib/python2.7/dist-packages/impacket/nmb.py", line 914, in recv_packet data = self.read(timeout) File "/usr/local/lib/python2.7/dist-packages/impacket/nmb.py", line 997, in read data = self.read_function(4, timeout) File "/usr/local/lib/python2.7/dist-packages/impacket/nmb.py", line 983, in non_polling_read raise NetBIOSError('Error occurs while reading from remote', ERRCLASS_OS, ex[0]) impacket.nmb.NetBIOSError: Error occurs while reading from remote(104)

3ndG4me commented 3 years ago

Based on your error it looks like you're using python2.7

This project was recently upgraded to python3. While initial support for both 2 & 3 was tested upon upgrading I can provide no guarantee that python2 will work going forward.

Also, regardless of which Python version you use, please be sure you have the latest version of the "impacket" libraries installed.

All of this is in the README file. I'll leave this issue open for now until you've tried these things in case this is a real issue, but there's not enough information here to reproduce what you're receiving (in other words it works just fine for me). Hopefully insuring you have the latest dependencies helps, otherwise please follow up with any new errors you receive and I will look into them.

anoncross commented 3 years ago

I ami using both python 2.7 and 3.8.

root@kali:/# python --version Python 2.7.18 root@kali:/# python3 --version Python 3.8.6 root@kali:/# pip install impacket DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. Requirement already satisfied: impacket in /usr/local/lib/python2.7/dist-packages (0.9.21) Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages (from impacket) (1.15.0) Requirement already satisfied: ldap3!=2.5.0,!=2.5.2,!=2.6,>=2.5 in /usr/local/lib/python2.7/dist-packages (from impacket) (2.8) Requirement already satisfied: ldapdomaindump>=0.9.0 in /usr/local/lib/python2.7/dist-packages (from impacket) (0.9.3) Requirement already satisfied: pyOpenSSL>=0.13.1 in /usr/local/lib/python2.7/dist-packages (from impacket) (19.1.0) Requirement already satisfied: flask>=1.0 in /usr/local/lib/python2.7/dist-packages (from impacket) (1.1.2) Requirement already satisfied: pyasn1>=0.2.3 in /usr/local/lib/python2.7/dist-packages/pyasn1-0.4.8-py2.7.egg (from impacket) (0.4.8) Requirement already satisfied: pycryptodomex in /usr/local/lib/python2.7/dist-packages/pycryptodomex-3.9.7-py2.7-linux-aarch64.egg (from impacket) (3.9.7) Requirement already satisfied: dnspython in /usr/local/lib/python2.7/dist-packages (from ldapdomaindump>=0.9.0->impacket) (1.16.0) Requirement already satisfied: future in /usr/local/lib/python2.7/dist-packages/future-0.18.2-py2.7.egg (from ldapdomaindump>=0.9.0->impacket) (0.18.2) Requirement already satisfied: cryptography>=2.8 in /usr/local/lib/python2.7/dist-packages (from pyOpenSSL>=0.13.1->impacket) (3.0) Requirement already satisfied: Werkzeug>=0.15 in /usr/local/lib/python2.7/dist-packages (from flask>=1.0->impacket) (1.0.1) Requirement already satisfied: click>=5.1 in /usr/local/lib/python2.7/dist-packages (from flask>=1.0->impacket) (7.1.2) Requirement already satisfied: itsdangerous>=0.24 in /usr/local/lib/python2.7/dist-packages (from flask>=1.0->impacket) (1.1.0) Requirement already satisfied: Jinja2>=2.10.1 in /usr/local/lib/python2.7/dist-packages (from flask>=1.0->impacket) (2.11.2) Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/local/lib/python2.7/dist-packages (from cryptography>=2.8->pyOpenSSL>=0.13.1->impacket) (1.14.2) Requirement already satisfied: ipaddress; python_version < "3" in /usr/local/lib/python2.7/dist-packages (from cryptography>=2.8->pyOpenSSL>=0.13.1->impacket) (1.0.23) Requirement already satisfied: enum34; python_version < "3" in /usr/local/lib/python2.7/dist-packages (from cryptography>=2.8->pyOpenSSL>=0.13.1->impacket) (1.1.10) Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python2.7/dist-packages (from Jinja2>=2.10.1->flask>=1.0->impacket) (1.1.1) Requirement already satisfied: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.8->pyOpenSSL>=0.13.1->impacket) (2.20) root@kali:/# pip3 install impacket Requirement already satisfied: impacket in /usr/lib/python3/dist-packages (0.9.21)

3ndG4me commented 3 years ago

Your initial error that you posted shows you running the tool with python2. Do you also get the same error with python3?

If so, could you post it as well?

anoncross commented 3 years ago

i have now uninstalled python 2.7 and running the script with python3.

root@kali:/AutoBlue-MS17-010#pip --version bash: /usr/local/bin/pip: /usr/bin/python: bad interpreter: No such file or directory root@kali:/AutoBlue-MS17-010# python --version bash: /usr/bin/python: No such file or directory root@kali:/AutoBlue-MS17-010# pip3 --version pip 20.1.1 from /usr/lib/python3/dist-packages/pip (python 3.8) root@kali:/AutoBlue-MS17-010# python3 --version Python 3.8.6 root@kali:/AutoBlue-MS17-010# python3 eternal_checker.py 192.168.0.101 Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/impacket-0.9.22.dev1+20200929.152157.fe642b24-py3.8.egg/impacket/nmb.py", line 979, in non_polling_read received = self._sock.recv(bytes_left) ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred: Traceback (most recent call last): File "eternal_checker.py", line 89, in main() File "eternal_checker.py", line 66, in main conn = MYSMB(options.target_ip, int(options.port)) File "/AutoBlue-MS17-010/mysmb.py", line 122, in init smb.SMB.init(self, remote_host, remote_host, timeout=timeout) File "/usr/local/lib/python3.8/dist-packages/impacket-0.9.22.dev1+20200929.152157.fe642b24-py3.8.egg/impacket/smb.py", line 2437, in init self.neg_session() File "/AutoBlue-MS17-010/mysmb.py", line 178, in neg_session smb.SMB.neg_session(self, extended_security=self.use_ntlmv2, negPacket=negPacket) File "/usr/local/lib/python3.8/dist-packages/impacket-0.9.22.dev1+20200929.152157.fe642b24-py3.8.egg/impacket/smb.py", line 2657, in neg_session smb = self.recvSMB() File "/usr/local/lib/python3.8/dist-packages/impacket-0.9.22.dev1+20200929.152157.fe642b24-py3.8.egg/impacket/smb.py", line 2521, in recvSMB r = self._sess.recv_packet(self.timeout) File "/usr/local/lib/python3.8/dist-packages/impacket-0.9.22.dev1+20200929.152157.fe642b24-py3.8.egg/impacket/nmb.py", line 914, in recv_packet data = self.read(timeout) File "/usr/local/lib/python3.8/dist-packages/impacket-0.9.22.dev1+20200929.152157.fe642b24-py3.8.egg/impacket/nmb.py", line 997, in read data = self.read_function(4, timeout) File "/usr/local/lib/python3.8/dist-packages/impacket-0.9.22.dev1+20200929.152157.fe642b24-py3.8.egg/impacket/nmb.py", line 983, in non_polling_read raise NetBIOSError('Error occurs while reading from remote', ERRCLASS_OS, ex.errno) impacket.nmb.NetBIOSError: Error occurs while reading from remote(104)

3ndG4me commented 3 years ago

Could not reproduce this locally, but I can confirm this is not a bug with the eternal check script. Just ran a fresh install on a known vulnerable and non-vulnerable targets and received expected output.

This error is being consistently raised from the impacket library's' nmb.py for your use case. Why that is I don't know, but unless you are able to reproduce this across multiple targets, it appears to just be an issue on the one .0.101 target you reference in your output. These errors are raised when reading NetBIOS data from the target fails for some reason (https://github.com/SecureAuthCorp/impacket/blob/master/impacket/nmb.py). Based on that information, this does not seem to be a bug with the eternal_checker.py script nor the impacket libraries, this actually appears to be expected output whenever the nmb.py error is raised for a legitmate reason. In the case of 0x104 error that you receive it looks like it's related to finding file info and is probably related to some permission issue on your target system.

I'll be the first to admit my Windows System internals/error code knowledge is not that deep, but since I just pulled down this code base, installed everything from scratch to test, I have no choice but to say that this error is unique to you unfortunately. If anyone else comes across this and can provide more info, I'll be happy to look into working on a fix. Since this is not reproduce-able I'll have to close this out. Good luck!