byt3bl33d3r / CrackMapExec

A swiss army knife for pentesting networks
BSD 2-Clause "Simplified" License
8.38k stars 1.64k forks source link

wmiexec bug #74

Closed maaaaz closed 8 years ago

maaaaz commented 8 years ago
(venvcrackmapexec)root@kali:~/Partage/CrackMapExec_fork# python crackmapexec.py 192.168.11.144 -u àlolé -H :1356a6dd7709ab1640d062fa957d6634 -x "whoami"
01-24-2016 11:46:38 SMB 192.168.11.144:445 DC01       [*] Windows 6.3 Build 9600 (name:DC01) (domain:ADYOLO)
01-24-2016 11:46:38 SMB 192.168.11.144:445 DC01       [+] Login successful ADYOLO\àlolé::1356a6dd7709ab1640d062fa957d6634
01-24-2016 11:46:40 SMB 192.168.11.144:445 DC01       [+] Executed command via WMIEXEC
ERROR:root:'ascii' codec can't decode byte 0x85 in position 7: ordinal not in range(128)
Traceback (most recent call last):
  File "/root/venvcrackmapexec/local/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
    result = self._run(*self.args, **self.kwargs)
  File "/mnt/hgfs/Partage/CrackMapExec_fork/core/greenlets.py", line 247, in main_greenlet
    ntlm_hash)
  File "/mnt/hgfs/Partage/CrackMapExec_fork/core/executor.py", line 24, in __init__
    wmi_exec.run(host, smbconnection)
  File "/mnt/hgfs/Partage/CrackMapExec_fork/core/scripts/wmiexec.py", line 82, in run
    dcom.disconnect()
  File "/root/venvcrackmapexec/local/lib/python2.7/site-packages/impacket/dcerpc/v5/dcomrt.py", line 1070, in disconnect
    del(INTERFACE.CONNECTIONS[self.__target][currentThread().getName()])
KeyError: 'Dummy-1'
<Greenlet at 0xb66578ecL: main_greenlet('192.168.11.144')> failed with KeyError

I never experienced that bug before, does it come from impacket ? I don't have it with --execm smbexec

maaaaz commented 8 years ago

Wait, it seems to be related to the utf-8 issue. I tried but did not manage to get it fixed...

byt3bl33d3r commented 8 years ago

@maaaaz I actually experienced this bug on a recent engagement, I have a feeling this might be an impacket bug, although I'm not really able to reproduce it

byt3bl33d3r commented 8 years ago

@maaaaz Looking at your command string and noticed that you don't have the full ntlm hash, did you remove that on purpose?

byt3bl33d3r commented 8 years ago

@maaaaz just reproduced it, will work on a fix asap

byt3bl33d3r commented 8 years ago

@maaaaz Fixed in v3.0