Skip to content

Jailbroken iOS Device Support#2536

Draft
ajinabraham wants to merge 17 commits intomasterfrom
jailbroken_ios_device_support
Draft

Jailbroken iOS Device Support#2536
ajinabraham wants to merge 17 commits intomasterfrom
jailbroken_ios_device_support

Conversation

@ajinabraham
Copy link
Member

@ajinabraham ajinabraham commented Jul 17, 2025

Describe the Pull Request

 Enables dynamic analysis on real jailbroken iOS devices connected via USB or WiFi SSH, complementing the existing Corellium-based iOS analysis.              
                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  - SSH connectivity — connects to jailbroken devices over USB (via iproxy port forwarding) or WiFi using Paramiko SSH                                         
  - Frida instrumentation — spawns/attaches Frida on-device, with full hook support matching the existing Corellium flow                                       
  - Environment setup — installs AppSync Unified and Frida server on first run; supports both arm and arm64 devices                                            
  - Dynamic analysis — app file extraction, system log streaming (oslog), screenshot capture, process listing, and report generation
  - SSH terminal — execute arbitrary shell commands on the device from the MobSF UI

Checklist for PR

  • Run MobSF unit tests and lint tox -e lint,test
  • Tested Working on Linux, Mac, Windows, and Docker
  • Add unit test for any new Web API (Refer: StaticAnalyzer/tests.py)
  • Make sure tests are passing on your PR MobSF tests

Additional Comments (if any)

DESCRIBE HERE

@github-actions
Copy link

👋 @ajinabraham
Thank you for sending this pull request ❤️.
Please make sure you have followed our contribution guidelines. We will review it as soon as possible

ajinabraham and others added 6 commits August 30, 2025 19:31
cylentsec and others added 6 commits March 21, 2026 11:57
)

download_screenshot() used a hardcoded 5s sleep before downloading
/tmp/screenshot.png. The screenshot.js RPC runs on the iOS main thread
via ObjC.schedule(), so api.get_screenshot() can return before the file
is written. Two threads raced with no synchronisation.

Fix: add a screenshot_event (threading.Event) to the Frida base class.
frida_response() sets the event when it receives the '✅ Screenshot
Captured' send() message from the JS. download_screenshot() waits on
the event with a 30s timeout instead of sleeping blindly.

Co-authored-by: Oz <oz-agent@warp.dev>
Method 2 (apt fallback) ran all commands in a loop without checking
exit codes, unconditionally returning True even if apt install failed.
This caused install_ipa() to silently loop forever with a confusing
'AppSync Unified is installed, please try again' message when nothing
was actually installed.

Changes:
- Check exit code of apt install; raise Exception on failure so the
  caller receives a meaningful error instead of a silent retry loop
- Split the reboot command out of the apt command loop so it only
  runs after a confirmed successful install
- Add docstring clarifying the three return states (False=already
  installed, True=just installed/rebooting, Exception=failure)
- Fix misleading log message in install_ipa() to say 'was just
  installed and userspace is rebooting' instead of 'is installed'

Co-authored-by: Oz <oz-agent@warp.dev>
read_file() decodes via UTF-8 and silently returns None for binary
plists, causing _modify_frida_plist_for_wifi() to fail on devices
where the Frida server plist is in binary format.

Switch to read_binary_file() which returns raw bytes. Use
plistlib.loads() which handles both XML and binary plist formats.
Serialize back with plistlib.dumps() and upload via upload_file_object()
using an in-memory BytesIO buffer, removing the need for a temp file
on disk. Remove now-unused imports (tempfile, os).

Co-authored-by: Oz <oz-agent@warp.dev>
#2597)

connect_usb() and connect_wifi() defaulted to username='root',
password='alpine' with no way to override them via configuration.
Users who have changed their jailbreak SSH password, or who want
to use a non-root account, had to patch the code directly.

Add MOBSF_IOS_SSH_USER (default: root) and MOBSF_IOS_SSH_PASSWORD
(default: alpine) environment variables following the existing MobSF
env-var pattern in settings.py. Read them in validate_and_connect_device()
and pass them to connect_usb() and connect_wifi() at the call sites.
Defaults are unchanged so existing deployments are unaffected.

Co-authored-by: Oz <oz-agent@warp.dev>
…2598)

pkill -f iproxy matches any process with 'iproxy' in its command line,
including iproxy instances started by the user or other tools. This
could unexpectedly terminate unrelated port forwarding sessions.

Store Popen handles for each iproxy subprocess launched by
_setup_usb_port_forward() in self.iproxy_procs. In disconnect(),
call .terminate() on each stored handle instead of using pkill.
This scopes teardown to only the processes MobSF started.

Co-authored-by: Oz <oz-agent@warp.dev>
…2599)

The USB and WiFi connection paths use different Frida remote ports
but this is not documented anywhere, making Docker/Colima setup
non-obvious:

- USB: MobSF auto-starts iproxy mapping localhost:37042 -> device:27042.
  Frida connects to localhost:37042 (explicit port).
- WiFi/Docker: Frida connects to the configured host on the default
  Frida port 27042 (no explicit port). MobSF does NOT set up any
  local port mapping.

A Docker/Colima user who reads the USB code and guesses 37042:27042
for their iproxy command will silently get no Frida connection.

Add a comment block in FridaIOSDevice.__init__() documenting both
cases and the correct iproxy command for Docker/Colima setups.

Co-authored-by: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants