Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[getst.py] encoding issue when -impersonate parameter is Chinese #1650

Closed
gabrielg5 opened this issue Nov 14, 2023 · 2 comments
Closed

[getst.py] encoding issue when -impersonate parameter is Chinese #1650

gabrielg5 opened this issue Nov 14, 2023 · 2 comments
Assignees
Labels
bug Unexpected problem or unintended behavior unicode_issue

Comments

@gabrielg5
Copy link
Collaborator

Configuration

impacket version: v0.11.0
Python version: 3.11
Target OS: Windows

Debug Output With Command String

getST -dc-ip XX.x.XX.x -impersonate 无名氏 -spn test/host.dom.com dom/Administrator:XXXXX -debug

┌──(xxx㉿XXXXXX)-[~/Desktop/impacket/examples]
└─$ python3 getST.py -dc-ip XX.x.XX.x -impersonate 无名氏 -spn test/host.dom.com dom/Administrator:XXXXX -debug
Impacket v0.11.0 - Copyright 2023 Fortra

[+] Impacket Library Installation Path: /home/xxx/.local/lib/python3.11/site-packages/impacket
[-] CCache file is not found. Skipping...
[+] The specified path is not correct or the KRB5CCNAME environment variable is not defined
[*] Getting TGT for user
[+] Trying to connect to KDC at XX.x.XX.x:88
[+] Trying to connect to KDC at XX.x.XX.x:88
[*] Impersonating 无名氏
[+] AUTHENTICATOR
Authenticator:
 authenticator-vno=5
 crealm=DOM.COM
 cname=PrincipalName:
  name-type=1
  name-string=SequenceOf:
   Administrator

 cusec=631502
 ctime=20231114195948Z



[+] Exception
Traceback (most recent call last):
  File "/home/xxx/Desktop/impacket/examples/getST.py", line 655, in run
    tgs, cipher, oldSessionKey, sessionKey = self.doS4U(tgt, cipher, oldSessionKey, sessionKey, unhexlify(self.__nthash), self.__aesKey, self.__kdcHost)
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/Desktop/impacket/examples/getST.py", line 360, in doS4U
    S4UByteArray += b(self.__options.impersonate) + b(self.__domain) + b'Kerberos'
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/six.py", line 644, in b
    return s.encode("latin-1")
           ^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256)
[-] 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256)
@gabrielg5
Copy link
Collaborator Author

Found when reviewing #1631

@gabrielg5 gabrielg5 added the bug Unexpected problem or unintended behavior label Nov 14, 2023
alexisbalbachan added a commit to alexisbalbachan/impacket that referenced this issue Aug 22, 2024
impacket fortra#1650: Fixes encoding unicode errors while performing S4U
gabrielg5 pushed a commit that referenced this issue Aug 23, 2024
impacket #1650: Fixes encoding unicode errors while performing S4U
@gabrielg5
Copy link
Collaborator Author

Closed after #1794

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior unicode_issue
Projects
None yet
Development

No branches or pull requests

3 participants