Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

UnicodeEncodeError when using unicode chars in supplied credentials #37

Closed
its0x08 opened this issue Nov 2, 2015 · 7 comments
Closed
Labels

Comments

@its0x08
Copy link

its0x08 commented Nov 2, 2015

[-] 192.168.200.44:445 ISIDORO\guest:admin SMB SessionError: STATUS_LOGON_FAILURE(The attempted logon is invalid. This is either due to a bad username or authentication information.)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 327, in run
result = self._run(_self.args, *_self.kwargs)
File "crackmapexec.py", line 2935, in connect
smb = smart_login(host, smb, domain)
File "crackmapexec.py", line 2713, in smart_login
smb.login(user, passwd, domain)
File "/usr/local/lib/python2.7/dist-packages/impacket/smbconnection.py", line 210, in login
return self._SMBConnection.login(user, password, domain, lmhash, nthash)
File "/usr/local/lib/python2.7/dist-packages/impacket/smb3.py", line 678, in login
blob['MechToken'] = str(auth)
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 170, in str
return self.getData()
File "/usr/local/lib/python2.7/dist-packages/impacket/ntlm.py", line 211, in getData
return Structure.getData(self)
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 121, in getData
data += self.packField(field[0], field[1])
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 106, in packField
ans = self.pack(format, self.fields[fieldName], field = fieldName)
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 263, in pack
return str(data)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)
<Greenlet at 0xb6552b1cL: connect('192.168.200.10')> failed with UnicodeEncodeError

[-] 192.168.200.68:445 LS--20150801JUS\admin:admin SMB SessionError: STATUS_LOGON_FAILURE(The attempted logon is invalid. This is either due to a bad username or authentication information.)

@byt3bl33d3r byt3bl33d3r changed the title Error UnicodeEncodeError when using unicode chars in supplied credentials Nov 2, 2015
@byt3bl33d3r
Copy link
Owner

@its0x08 I'm going to need the credentials you used to reproduce this

@byt3bl33d3r byt3bl33d3r added the bug label Nov 2, 2015
@its0x08
Copy link
Author

its0x08 commented Nov 2, 2015

some times i use this command
python crackmapexec.py -t 100 192.168.200.0-255 -u admin -p ../list/user.txt --shares
sometime this
python crackmapexec.py -t 100 192.168.200.0-255 -u admin,guest,administrator -p admin,password,1234,guest,user,administrator --shares

@its0x08
Copy link
Author

its0x08 commented Nov 2, 2015

once again ...

root@backbox:/home/its_0x08/Desktop/exploits/CrackMapExec# python crackmapexec.py -t 25 192.168.192.0/24 -u admin -p admin,password --shares
[_] 192.168.192.38:445 is running Windows 6.1 Build 7601 (name:1-ПК) (domain:1-ПК)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 327, in run
result = self._run(_self.args, **self.kwargs)
File "crackmapexec.py", line 2937, in connect
smb = smart_login(host, smb, domain)
File "crackmapexec.py", line 2715, in smart_login
smb.login(user, passwd, domain)
File "/usr/local/lib/python2.7/dist-packages/impacket/smbconnection.py", line 210, in login
return self._SMBConnection.login(user, password, domain, lmhash, nthash)
File "/usr/local/lib/python2.7/dist-packages/impacket/smb3.py", line 678, in login
blob['MechToken'] = str(auth)
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 170, in str
return self.getData()
File "/usr/local/lib/python2.7/dist-packages/impacket/ntlm.py", line 211, in getData
return Structure.getData(self)
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 121, in getData
data += self.packField(field[0], field[1])
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 106, in packField
ans = self.pack(format, self.fields[fieldName], field = fieldName)
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 263, in pack
return str(data)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 2-3: ordinal not in range(128)
<Greenlet at 0xb65a048cL: connect('192.168.192.38')> failed with UnicodeEncodeError

[] 192.168.192.53:445 is running (name:KATRIN) (domain:KATRIN)
[+] 192.168.192.53:445 Login successful KATRIN\admin:admin
[
] 192.168.192.59:445 is running Windows 6.1 Build 7601 (name:ASUS-PC) (domain:ASUS-PC)
[_] 192.168.192.64:445 is running Windows 6.1 Build 7601 (name:НИКА-ПК) (domain:НИКА-ПК)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 327, in run
result = self._run(_self.args, **self.kwargs)
File "crackmapexec.py", line 2937, in connect
smb = smart_login(host, smb, domain)
File "crackmapexec.py", line 2715, in smart_login
smb.login(user, passwd, domain)
File "/usr/local/lib/python2.7/dist-packages/impacket/smbconnection.py", line 210, in login
return self._SMBConnection.login(user, password, domain, lmhash, nthash)
File "/usr/local/lib/python2.7/dist-packages/impacket/smb3.py", line 678, in login
blob['MechToken'] = str(auth)
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 170, in str
return self.getData()
File "/usr/local/lib/python2.7/dist-packages/impacket/ntlm.py", line 211, in getData
return Structure.getData(self)
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 121, in getData
data += self.packField(field[0], field[1])
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 106, in packField
ans = self.pack(format, self.fields[fieldName], field = fieldName)
File "/usr/local/lib/python2.7/dist-packages/impacket/structure.py", line 263, in pack
return str(data)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
<Greenlet at 0xb535f66cL: connect('192.168.192.64')> failed with UnicodeEncodeError

[-] 192.168.192.59:445 ASUS-PC\admin:admin SMB SessionError: STATUS_LOGON_FAILURE(The attempted logon is invalid. This is either due to a bad username or authentication information.)
[+] 192.168.192.53:445 KATRIN Available shares:
SHARE Permissions
----- -----------
PDF NO ACCESS
print$ NO ACCESS
IPC$ NO ACCESS
[] 192.168.192.79:445 is running Windows 6.3 Build 9600 (name:TOSHIBA_I7) (domain:TOSHIBA_I7)
^CKeyboardInterrupt
[
] Got CTRL-C! Exiting..
root@backbox:/home/its_0x08/Desktop/exploits/CrackMapExec#

@asolino
Copy link

asolino commented Nov 2, 2015

That seems to be an Impacket bug when negotiating against a machine that has those International characters. Please fill up a bug at https://github.com/CoreSecurity/impacket/issues

@byt3bl33d3r
Copy link
Owner

@its0x08 this is a bug with the impacket library, just filed a bug report

@asolino
Copy link

asolino commented Nov 3, 2015

@its0x08 I just fixed this issue, could you please recheck so I'm sure it's fixed correctly? You will need to git pull the latest impacket repo.

@its0x08
Copy link
Author

its0x08 commented Nov 3, 2015

now its fixed :)

fpreynaud pushed a commit to fpreynaud/CrackMapExec that referenced this issue Jul 21, 2023
LDAP Enumeration and Add Computer Modules
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants