GHunt icon indicating copy to clipboard operation
GHunt copied to clipboard

UnicodeEncodeError: 'utf-8' codec can't encode character '\udccc' in position 27: surrogates not allowed

Open NSEcho opened this issue 3 years ago • 0 comments

Hello, while fuzzing with radamsa and sending the unprintable character, application crashes showing user traceback.

$ cat crash.txt
test@gmail.�com
$ cat crash.txt | xxd
00000000: 7465 7374 4067 6d61 696c 2eda 636f 6d    [email protected]
$ python3 ghunt.py email $(cat crash.txt)
Traceback (most recent call last):
  File "/Users/daemon1/tools/GHunt/ghunt.py", line 33, in <module>
    email_hunt(data)
  File "/Users/daemon1/tools/GHunt/modules/email.py", line 51, in email_hunt
    data = is_email_google_account(client, hangouts_auth, cookies, email,
  File "/Users/daemon1/tools/GHunt/lib/utils.py", line 44, in is_email_google_account
    req = httpx_client.post(host + url, data=body.format(email), headers=headers, cookies=cookies)
  File "/Users/daemon1/Library/Python/3.9/lib/python/site-packages/httpx/_client.py", line 1060, in post
    return self.request(
  File "/Users/daemon1/Library/Python/3.9/lib/python/site-packages/httpx/_client.py", line 736, in request
    request = self.build_request(
  File "/Users/daemon1/Library/Python/3.9/lib/python/site-packages/httpx/_client.py", line 321, in build_request
    return Request(
  File "/Users/daemon1/Library/Python/3.9/lib/python/site-packages/httpx/_models.py", line 1093, in __init__
    headers, stream = encode_request(content, data, files, json)
  File "/Users/daemon1/Library/Python/3.9/lib/python/site-packages/httpx/_content.py", line 169, in encode_request
    return encode_content(data)
  File "/Users/daemon1/Library/Python/3.9/lib/python/site-packages/httpx/_content.py", line 84, in encode_content
    body = content.encode("utf-8") if isinstance(content, str) else content
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcda' in position 14: surrogates not allowed

I would just reconsider checking whether the input is the one we expect and of course if the characters are printable.

NSEcho avatar Oct 15 '21 23:10 NSEcho