Closed lightkun-yagami closed 1 week ago
I too am getting the following error
cybersoldier@cybersoldier-virtual-machine:~/Documents/marvel.local$ sudo ldapdomaindump ldaps://192.168.226.128 -u 'MARVEL\fcastle' -p Password2
[*] Connecting to host...
[*] Binding to host
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/ldap3/strategy/base.py", line 823, in sending
self.connection.socket.sendall(encoded_message)
File "/usr/lib/python3.10/ssl.py", line 1240, in sendall
return super().sendall(data, flags)
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/ldapdomaindump", line 4, in <module>
__import__('pkg_resources').run_script('ldapdomaindump==0.9.4', 'ldapdomaindump')
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 656, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1453, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python3.10/dist-packages/ldapdomaindump-0.9.4-py3.10.egg/EGG-INFO/scripts/ldapdomaindump", line 3, in <module>
ldapdomaindump.main()
File "/usr/local/lib/python3.10/dist-packages/ldapdomaindump-0.9.4-py3.10.egg/ldapdomaindump/__init__.py", line 940, in main
if not c.bind():
File "/usr/local/lib/python3.10/dist-packages/ldap3/core/connection.py", line 563, in bind
response = self.do_ntlm_bind(controls)
File "/usr/local/lib/python3.10/dist-packages/ldap3/core/connection.py", line 1282, in do_ntlm_bind
response = self.post_send_single_response(self.send('bindRequest', request, controls))
File "/usr/local/lib/python3.10/dist-packages/ldap3/strategy/base.py", line 299, in send
self.sending(ldap_message)
File "/usr/local/lib/python3.10/dist-packages/ldap3/strategy/base.py", line 834, in sending
raise communication_exception_factory(LDAPSocketSendError, type(e)(str(e)))(self.connection.last_error)
ldap3.core.exceptions.LDAPSocketSendError: socket sending error[Errno 104] Connection reset by peer
@lightkun-yagami I was having this same issue. If you're running ldapdomaindump straight out of what comes preinstalled with Kali Linux, you're likely suffering from an out-of-date dependency. The error itself is happening here:
File "/usr/local/lib/python2.7/dist-packages/ldap3/utils/ntlm.py", line 496, in ntowf_v2
password_digest = hashlib.new('MD4', self._password.encode('utf-16-le')).digest()
ldap3 had a commit that expanded this functionality since MD4 is a deprecated hash that isn't covered by more modern OpenSSL. You can learn more here and here
Long story short, you can try to update your version of ldap3 by running pip install ldap3 --upgrade
though you may risk breaking something else in your system.
The safest bet and what I ended up doing was cloning ldapdomaindump's git, starting a virtual environment, install the new dependencies inside the venv with requirements.txt, and run ldapdomaindump.py from the venv.
Use the absolute path/usr/bin/ldapdomaindump
Use the absolute path
/usr/bin/ldapdomaindump
That worked for me! Thank you!
Use the absolute path
/usr/bin/ldapdomaindump
Worked for me also, thanks a bunch!!!
@lightkun-yagami can you close this issue if your problem is fixed?
Can someone shed some light what is causing the error below? Appreciate any help!
[] Connecting to host... [] Binding to host Traceback (most recent call last): File "/usr/local/bin/ldapdomaindump", line 3, in
ldapdomaindump.main()
File "/usr/local/lib/python2.7/dist-packages/ldapdomaindump/init.py", line 940, in main
if not c.bind():
File "/usr/local/lib/python2.7/dist-packages/ldap3/core/connection.py", line 563, in bind
response = self.do_ntlm_bind(controls)
File "/usr/local/lib/python2.7/dist-packages/ldap3/core/connection.py", line 1302, in do_ntlm_bind
request = bind_operation(self.version, 'SICILY_RESPONSE_NTLM', ntlm_client, result['server_creds'])
File "/usr/local/lib/python2.7/dist-packages/ldap3/operation/bind.py", line 81, in bind_operation
server_creds = name.create_authenticate_message()
File "/usr/local/lib/python2.7/dist-packages/ldap3/utils/ntlm.py", line 379, in create_authenticate_message
nt_challenge_response = self.compute_nt_response()
File "/usr/local/lib/python2.7/dist-packages/ldap3/utils/ntlm.py", line 485, in compute_nt_response
response_key_nt = self.ntowf_v2()
File "/usr/local/lib/python2.7/dist-packages/ldap3/utils/ntlm.py", line 496, in ntowf_v2
password_digest = hashlib.new('MD4', self._password.encode('utf-16-le')).digest()
File "/usr/lib/python2.7/hashlib.py", line 116, in __py_new
return get_builtin_constructor(name)(string)
File "/usr/lib/python2.7/hashlib.py", line 97, in get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type MD4