Jailbreak a device (At your own risk)
Disclaimer: I would never jailbreak a device that was going to carry my personal information. You should not either. It is absolutely at your own risk.
This blog post is about getting started with assessing iOS apps. I had not done this in a few years and so this is notes to bridge the past with modern which may be of use to you.
There is currently a stable root exploit called “checkra1n“. This works at the bootloader level and so long as you prevent your rooted handset from rebooting you will have a rooted handset. There is stable exploitation tools for Linux and now for Windows.
I use Windows as a host OS. I do this for many reasons but the simplest one is because Linux works better in a VM than windows does in my experience. I tried checkRa1n in a kali VM with the phone passed over USB directly to the VM. This was a dead end. The exploit process looked like it was working but it never completed, do not enter this cul-de-sac.
To get around that I could have tried the Windows exploit tools. But I selected to use “bootra1n“. This was a bootable USB Linux distro which included checkRa1n and it worked exactly as advertised.
Install the device via app store
- Setup a test account without any of your real personal info.
- Sign in to the app store, and then install your target app on the device.
There are other ways to install apps including “3uTools” (see section later). For me this did not work as my target app was not available in the app store they maintain. If your target is available for install then you will find an easier process where you don’t need to dump the IPA file as described in the next section.
Dump IPA file from handset
- On Jailbroken Handset
- Open Cydia and install “frida-server” as per this guide.
- Inside a Kali VM (I used a VM, you can go barebones. Process did not work on Windows).
- Install frida
pip install frida-tools
- Inside Kali install “frida-ios-dump”
apt-get install libusbmuxd-tools ssh -p 2222 root@localhost # leave yourself connected to this session git clone https://github.com/AloneMonkey/frida-ios-dump.git cd frida-ios-dump pip install -r requirements.txt
Now all you need to do is run “dump.py” against your target as shown:
python3 dump.py <target_app_name>
To obtain the correct target app name use “frida-ps” as shown:
Getting MobSF The Quick Way
MobSF is an excellent tool for gathering some low hanging fruit. As a minimum I would advise throwing every IPA (and Android APK) through this for static analysis. It does a good job of finding strings which may be of use, as well as analysing permissions and other basics. This post is about getting you started and MobSF will be an excellent place to end this post.
Install docker as per this guide. Then after you have that up and running you can get access to MobSF using this:
docker pull opensecurity/mobile-security-framework-mobsf docker run opensecurity/mobile-security-framework-mobsf
This will start an HTTP listener bound to 0.0.0.0 which is great. But you need to know what IP address Docker just gave you. First list your running containers:
Then use docker inspect with a grep to get that for you:
docker inspect <container_id> | grep IPAddress
Fire up your web browser at http://YOUR_IP:8000/ you can now upload the IPA file and it will give you that static analysis juice.
This is a beast which gets around having to install iTunes. A bit of software I have a ~15 year old past with which I frequently refer to as a “virus”. It is simply not possible for iTunes to be as shit as it is/was. Therefore, it must have been maliciously generated.
A lot (but not ALL) of apps from the app store are available for install using this. You will still need to supply legit app store creds to use that feature. If you can install using 3uTools then you get a super easy way to export the IPA file. But it only works on apps installed via 3uTools. In my case the app I needed to examine was in the app store, but not in the 3uTools equivalent.
Thats it from me, I am not going to rehash how to test an iOS app here as there are excellent resources explaining how to do that.
Your next steps would be to Google the heck out of these things:
- Bypass jailbroken device detection (if enabled).
- Bypass certificate pinning (if enabled)
- Then to crack on with an OWASP level analysis.
Best of luck on your road to pwning iOS.