WithSecureLabs / needle

The iOS Security Testing Framework
https://mobiletools.mwrinfosecurity.com/
Other
1.33k stars 284 forks source link

Can't connect to device with or without USB #208

Closed simonjgamer closed 6 years ago

simonjgamer commented 6 years ago

Issue

Problem establishing connection: AttributeError - '_EllipticCurvePublicKey' object has no attribute 'verify'

Expected behaviour

Should able to connect to the device

Actual behaviour

Getting Problem establishing connection: AttributeError - '_EllipticCurvePublicKey' object has no attribute 'verify'

Steps to reproduce

  1. Install all dependency in the Mac
  2. Running via config.txt (set DEBUG true set VERBOSE true

set IP 127.0.0.1 set PORT 2222 set APP com.callsign.appid.callsign.prod use device/dependency_installer)

  1. run python needle.py -r config.txt
  2. Type shell

needle error logs

Ensure verbose and debug mode are enabled:

[needle] > set VERBOSE True
VERBOSE => True
[needle] > set DEBUG True
DEBUG => True

*] Spawning a shell...
[*] Checking connection with device...
[V] Connection not present, creating a new instance
[D] Setting up USB port forwarding on port 2222
[D] [LOCAL CMD] Local Subprocess Command: /Users/simon.joshi/work/needle-master/needle/libs/usbmuxd/tcprelay.py -t 22:2222
[D] [AGENT] Setting up port forwarding on port 4444
2018-02-13 15:22:27,926| ERROR   | Unknown exception: '_EllipticCurvePublicKey' object has no attribute 'verify'
2018-02-13 15:22:27,927| ERROR   | Traceback (most recent call last):
2018-02-13 15:22:27,927| ERROR   |   File "/usr/local/lib/python2.7/site-packages/paramiko/transport.py", line 1888, in run
2018-02-13 15:22:27,927| ERROR   |     self.kex_engine.parse_next(ptype, m)
2018-02-13 15:22:27,927| ERROR   |   File "/usr/local/lib/python2.7/site-packages/paramiko/kex_ecdh_nist.py", line 47, in parse_next
2018-02-13 15:22:27,927| ERROR   |     return self._parse_kexecdh_reply(m)
2018-02-13 15:22:27,927| ERROR   |   File "/usr/local/lib/python2.7/site-packages/paramiko/kex_ecdh_nist.py", line 107, in _parse_kexecdh_reply
2018-02-13 15:22:27,927| ERROR   |     self.transport._verify_key(K_S, sig)
2018-02-13 15:22:27,927| ERROR   |   File "/usr/local/lib/python2.7/site-packages/paramiko/transport.py", line 1750, in _verify_key
2018-02-13 15:22:27,927| ERROR   |     if not key.verify_ssh_sig(self.H, Message(sig)):
2018-02-13 15:22:27,927| ERROR   |   File "/usr/local/lib/python2.7/site-packages/paramiko/ecdsakey.py", line 218, in verify_ssh_sig
2018-02-13 15:22:27,928| ERROR   |     self.verifying_key.verify(
2018-02-13 15:22:27,928| ERROR   | AttributeError: '_EllipticCurvePublicKey' object has no attribute 'verify'
2018-02-13 15:22:27,928| ERROR   |
[!] Problem establishing connection: AttributeError - '_EllipticCurvePublicKey' object has no attribute 'verify'
------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/simon.joshi/work/needle-master/needle/core/framework/framework.py", line 641, in _connection_new
    self.device.connect()
  File "/Users/simon.joshi/work/needle-master/needle/core/device/device.py", line 216, in connect
    self._portforward_agent_start()
  File "/Users/simon.joshi/work/needle-master/needle/core/device/device.py", line 149, in _portforward_agent_start
    self._port_forward_agent.start()
  File "/usr/local/lib/python2.7/site-packages/sshtunnel.py", line 1225, in start
    self._create_tunnels()
  File "/usr/local/lib/python2.7/site-packages/sshtunnel.py", line 1069, in _create_tunnels
    self._connect_to_gateway()
  File "/usr/local/lib/python2.7/site-packages/sshtunnel.py", line 1307, in _connect_to_gateway
    password=self.ssh_password)
  File "/usr/local/lib/python2.7/site-packages/paramiko/transport.py", line 1172, in connect
    self.start_client()
  File "/usr/local/lib/python2.7/site-packages/paramiko/transport.py", line 545, in start_client
    raise e
AttributeError: '_EllipticCurvePublicKey' object has no attribute 'verify'
------------------------------------------------------------
[!] AttributeError: '_EllipticCurvePublicKey' object has no attribute 'verify'
[V] [SSH] Disconnecting...
[D] Stopping USB port forwarding
[D] [LOCAL CMD] Stopping Local Subprocess Command [pid: 8378]
[D] [AGENT] Stopping port forwarding

Environment

Needle Version

1.0.5

Workstation Operating System

Mac 10.12.6

Python Version

2.7.11

Python Packages (pip freeze)

argh==0.26.2 asn1crypto==0.22.0 backports-abc==0.5 backports.ssl-match-hostname==3.5.0.1 bcrypt==3.1.4 biplist==1.0.3 blinker==1.4 brotlipy==0.6.0 certifi==2017.7.27.1 cffi==1.10.0 chardet==3.0.4 click==6.7 colorama==0.3.9 ConfigArgParse==0.11.0 configparser==3.5.0 construct==2.5.3 cryptography==2.0 cssutils==1.0.2 Django==1.11.4 EditorConfig==0.12.1 enum34==1.1.6 Flask==0.11.1 frida==10.6.52 gcovr==3.2 h2==2.4.4 hpack==2.3.0 html2text==2016.9.19 html5lib==1.0b8 hyperframe==4.0.2 idna==2.6 ipaddress==1.0.19 itsdangerous==0.24 Jinja2==2.10 jsbeautifier==1.6.14 lxml==3.6.0 MarkupSafe==1.0 mitmproxy==0.18.3 paramiko==2.4.0 passlib==1.6.5 pathtools==0.1.2 pbr==0.11.0 pdfkit==0.6.1 Pillow==3.3.0 prompt-toolkit==1.0.15 psutil==3.2.1 pyasn1==0.4.2 pycparser==2.18 Pygments==2.2.0 PyNaCl==1.2.1 pyOpenSSL==17.0.0 pyparsing==2.1.10 PyPDF2==1.26.0 pyperclip==1.5.32 pytz==2017.2 PyYAML==3.12 readline==6.2.4.1 reportlab==3.3.0 requests==2.11.1 rsa==3.4.2 singledispatch==3.4.0.3 six==1.10.0 sshtunnel==0.1.3 stevedore==1.4.0 tornado==4.4.3 typing==3.5.2.2 urllib3==1.22 urwid==1.3.1 vboxapi==1.0 virtualenv==13.0.3 virtualenv-clone==0.2.5 virtualenvwrapper==4.5.1 watchdog==0.8.3 wcwidth==0.1.7 webencodings==0.5 Werkzeug==0.14.1 xhtml2pdf==0.0.6

Device iOS Version

iPhone 5s --> iOS 10.2

marco-lancini commented 6 years ago

Try to downgrade paramiko to version 2.1.2 and see if the error persists

marco-lancini commented 6 years ago

Close due to inactivity