WithSecureLabs / needle

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

ValueError: Unterminated string starting at: line 1 column 1000 (char 999). #138

Closed HenryHoggard closed 7 years ago

HenryHoggard commented 7 years ago

Issue

Expected behaviour

Needle should run metadata module and retrieve list of apps.

Actual behaviour

Returns error as shown in logs.

Steps to reproduce

  1. use binary/info/metadata
  2. run

needle error logs

[needle][metadata] > run
[*] 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: /home/demo/Coding/needle-henry/needle/libs/usbmuxd/tcprelay.py -t 22:2222
[D] [AGENT] Setting up port forwarding on port 4444
[V] [AGENT] Connecting to agent (127.0.0.1:4444)...
[+] [AGENT] Successfully connected to agent (127.0.0.1:4444)...
[V] [SSH] Connecting (127.0.0.1:2222)...
[+] [SSH] Connected (127.0.0.1:2222)
[D] Creating temp folder: /var/root/needle/
[D] [REMOTE CMD] Remote Command: if [ -d /var/root/needle/ ]; then echo "yes"; else echo "no" ; fi
[D] [AGENT] Executing command: os_version
[D] [AGENT] Attempting to reading result
[*] Target app not selected. Launching wizard...
[D] [AGENT] Executing command: list_apps
[D] [AGENT] Attempting to reading result
------------------------------------------------------------
Traceback (most recent call last):
  File "/home/demo/Coding/needle-henry/needle/core/framework/module.py", line 111, in do_run
    pre = self.module_pre()
  File "/home/demo/Coding/needle-henry/needle/core/framework/module.py", line 147, in module_pre
    if self.app_check() is None: return None
  File "/home/demo/Coding/needle-henry/needle/core/framework/framework.py", line 655, in app_check
    app = self.device.select_target_app()
  File "/home/demo/Coding/needle-henry/needle/core/device/device.py", line 196, in select_target_app
    self._list_apps()
  File "/home/demo/Coding/needle-henry/needle/core/device/device.py", line 191, in _list_apps
    self._applist = Utils.string_to_json(agent_list)
  File "/home/demo/Coding/needle-henry/needle/core/utils/utils.py", line 122, in string_to_json
    return json.loads(text)
  File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Unterminated string starting at: line 1 column 1000 (char 999)
------------------------------------------------------------
[!] ValueError: Unterminated string starting at: line 1 column 1000 (char 999).

Environment

Workstation Operating System

Debian

Python Version

2.7

Device iOS Version

9.1

Needle Version

1.0.0

marco-lancini commented 7 years ago

@HenryHoggard, I was able to replicate the issue on a vanilla Kali box. It is originated from a unicode character included in the name of one of the installed applications.

For some reason this issue does not present itself when using macOS...

marco-lancini commented 7 years ago

Ok this has been identified and is gonna be fixed with a hotfix in the next couple of days.

marco-lancini commented 7 years ago

Hi, this should now be fixed in version 1.0.1

Please upgrade the Agent from Cydia, and the Core from github