Gallopsled / pwntools

CTF framework and exploit development library
http://pwntools.com
Other
11.92k stars 1.69k forks source link

pwntools ssh crashing in cryptography? #1332

Closed tbiens closed 5 years ago

tbiens commented 5 years ago

Hello,

Currently working on a hackthebox challenge. The exploit works locally, but soon as I try ssh from pwntools it breaks.

[-] Connecting to 10.10.10.139 on port 22: Failed /usr/lib/python2.7/dist-packages/paramiko/ecdsakey.py:164: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point self.ecdsa_curve.curve_class(), pointinfo Traceback (most recent call last): File "ploit.py", line 71, in s = ssh(host='10.10.10.139', user='margo', password='$redacted', port=22) File "/usr/local/lib/python2.7/dist-packages/pwnlib/tubes/ssh.py", line 592, in init self.client.load_host_keys(known_hosts) File "/usr/lib/python2.7/dist-packages/paramiko/client.py", line 127, in load_host_keys self._host_keys.load(filename) File "/usr/lib/python2.7/dist-packages/paramiko/hostkeys.py", line 97, in load e = HostKeyEntry.from_line(line, lineno) File "/usr/lib/python2.7/dist-packages/paramiko/hostkeys.py", line 360, in from_line key = ECDSAKey(data=decodebytes(key), validate_point=False) File "/usr/lib/python2.7/dist-packages/paramiko/ecdsakey.py", line 168, in init self.verifying_key = numbers.public_key(backend=default_backend()) File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/backends/init.py", line 15, in default_backend from cryptography.hazmat.backends.openssl.backend import backend File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/init.py", line 7, in from cryptography.hazmat.backends.openssl.backend import backend File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/backend.py", line 18, in from cryptography import utils, x509 File "/usr/lib/python2.7/dist-packages/cryptography/x509/init.py", line 8, in from cryptography.x509.base import ( File "/usr/lib/python2.7/dist-packages/cryptography/x509/base.py", line 16, in from cryptography.x509.extensions import Extension, ExtensionType File "/usr/lib/python2.7/dist-packages/cryptography/x509/extensions.py", line 24, in from cryptography.x509.general_name import GeneralName, IPAddress, OtherName File "/usr/lib/python2.7/dist-packages/cryptography/x509/general_name.py", line 16, in from cryptography.x509.name import Name File "/usr/lib/python2.7/dist-packages/cryptography/x509/name.py", line 28, in _ASN1_TYPE_TO_ENUM = dict((i.value, i) for i in _ASN1Type) TypeError: 'type' object is not iterable

I have setup a barebones pwntools script and any ssh seems to result in the same.

root@kalivm:~/hackthebox/ellingson# pip install --upgrade pwntools Requirement already up-to-date: pwntools in /usr/local/lib/python3.7/dist-packages (3.12.2)

root@kalivm:~/hackthebox/ellingson# pip install --upgrade cryptography Requirement already up-to-date: cryptography in /usr/local/lib/python3.7/dist-packages (2.7)

Very curious error, I'm not sure what's wrong.

Also, thanks for developing pwntools. It's awesome!

tbiens commented 5 years ago

Problem is my kali box. Going to reinstall.