ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number
riramar opened this issue · 1 comments
riramar commented
Not sure why but for a few servers I'm getting the error below.
[INFO] Requesting - /
Traceback (most recent call last):
File "/home/ricardo/Tools/h2csmuggler/h2csmuggler.py", line 382, in <module>
init()
File "/home/ricardo/Tools/h2csmuggler/h2csmuggler.py", line 378, in init
main(args)
File "/home/ricardo/Tools/h2csmuggler/h2csmuggler.py", line 252, in main
sendSmuggledRequest(h2_connection,
File "/home/ricardo/Tools/h2csmuggler/h2csmuggler.py", line 174, in sendSmuggledRequest
events = getData(h2_connection, connection)
File "/home/ricardo/Tools/h2csmuggler/h2csmuggler.py", line 106, in getData
newdata = sock.recv(8192)
File "/usr/lib/python3.9/ssl.py", line 1226, in recv
return self.read(buflen)
File "/usr/lib/python3.9/ssl.py", line 1101, in read
return self._sslobj.read(len)
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2622)
I've double checked and my python3 environment supports TLS 1.1, 1.2 and 1.3. Through the browser I see TLS 1.3.
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> print(ssl.HAS_TLSv1_1)
True
>>> print(ssl.HAS_TLSv1_2)
True
>>> print(ssl.HAS_TLSv1_3)
True
>>>
I'm using OpenSSL with the version below.
$ python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 1.1.1k 25 Mar 2021
I tried to disable (code below) a few TLS versions just for troubleshooting but nothing changes.
context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
context.options |= ssl.OP_NO_TLSv1_2 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_TLSv1
Did you get this error before using h2csmuggler?