At the beginning of the year, I told my senior that in my MSc term I will start to learn IOS application pen-testing since I feel that IOS security is becoming more popular and more demanded just like android application pen-testing, so I saw this as an opportunity and today my friend that day has come.
So In the first "Road to IOS pen-testing" post, I will tell you how I got started and prepare everything that I need to explore the wonderful world of IOS security. I hope this post also gives you some starter of all the resources that you need to get started on IOS pen-testing
A little bit of background:
Originally in mobile application security, I start with android first since it is easier to get all of the necessary equipment and you don't need to have an android phone to do pen-testing you can just substitute your device with a virtual machine or on emulator from android studio.I learn some couple on how testing android applications from OWASP MSTG and E-MAPT but never touch IOS security because when I do a little bit of research you need a lot of tools that you need to buy to accommodate your testing. So rather than give up, I start to save some money from security projects that I can join as a freelance and finally I was able to buy my first macOS it's a mac air book (although It's not the best mac at that time, still I was very happy)
The next item on the list is to get an old iPhone that I could jailbreak. Luckily, one of my family members has iPhone 5s that is no longer used, perfect!. I take it and wiped the device so it will not cause any trouble.
unfortunately, this process needs to be postponed since I need to take care of everything for preparing my MSc
Once it's done I start again to learn IOS security but before starting to do some security testing another senior of mine suggest to start learning obj-c first to get the concept of on how to build it (Yes! I agree) before breaking it
Okay so I take my time a couple of weeks to learn obj-c, I found this awesome playlist consist of tutorial on how to develop IOS app https://www.youtube.com/playlist?list=PLDi4zKeIloPygQF3V6QZOXc1ekrVkrXNb
Right now I was able to create a very simple ios app one of the apps I was able to create an app that provides mental math challenge (It's not perfect but hey! I built my first app)
Now come to the most frustrating part, jailbreaking:
Of course, if you want to do IOS pentesting you need iPhone that was jailbroken right ?! okay no problemAll I need to do is to find a jailbroken app like Uncover, pangu and chimera install it in my phone using Cydia. I follow the instruction on this website https://taig9.com/12.4/ (the iPhone has IOS 12.4.4 version)
None of them work!
First issue: I used Cydia to install app jailbreak, I do everything as the forum says from creating apple ID and generate a password for the Cydia to be used but all of it always end with error "installer.cpp; line: 71; what:_assert(!teams.empty())"
I try to search the solution in the google but it doesn't really help me and many sources suggest to wait for the developer to release a new patch of cydia (Like hell I want to wait)
Second issue: I move on to try another approach by installing "Tweakbox" to install the jailbroken app. The tweak box is installed correctly I verify the application signature from settings but every time it tries to install the jailbroken app it says it cannot be installed.
I'm screwed at this time, I'm stuck at this stage almost a week
Third time is the charm huh?!
At the third attempt, finally, I found something that really works.It starts when I was looking at billy ellis youtube channel (https://www.youtube.com/channel/UCk2sx_3FUkKvDGlIhdUQa8A) and he suggests to use an app called "checkra1n" (https://checkra.in/) the requirement fits with my device and I installed in my macThe process is pretty smooth and all you need to have is a USB cable. The app will walk through you on the process and don't worry is not difficult
the device will go to recovery mode and then start doing jailbreaking and when it has done there will be a new app called "checkra1n"
you need to install the cydia app and once its has done, you can start to download all the necessary app to help you do penetration testing
this is the list of app that I installed inside my device:
- openssh to (open a ssh server in my iphone)
- newterm (a handy terminal emulator to let you interact with the system)
- local ssh (just to check if the openssh is install correctly)
cool so the first three apps you can get it in the cydia. next in the list are iproxy, frida, objection and idump
Iproxy, basically also used for doing ssh to the Iphone but I think its more convenient to do it locally by USB.
~# brew install libusbmuxd
~# iproxy 2222 22
go to another tab of terminal and type the following command
Frida, for hooking the app for dynamic binary instrumentation
~# pip3 install frida-tools
you need to install the frida server inside the iphone using cydia, first you need to go to Sources → Edit → Add and enter https://build.frida.re
After you add the link you can start to download the app to your iPhone, notice that it will not show any icon of the app because the Frida server will run in the background.
You can test the frida is correctly installed by plug usb to the device and then type "frida-ps -U" this will list all of the running process.
Objection, I have not yet explored this particular tool but many resources say it's must-have tool
~# pip3 install objection
run objection --gadget "com.apple.AppStore" explore to check that everything is integrated properly
lastly is the i-dump or frida-ios-dump, it says that when you try to extract the app from the device it will be encrypted so to get the unencrypted version we can use this tool to dump the app in run time.
link: https://github.com/AloneMonkey/frida-ios-dump
~# git clone https://github.com/AloneMonkey/frida-ios-dump.git && cd frida-ios-dump
~# sudo pip3 install -r requirements.txt --upgrade
Okay, that's all folks! I hope you have a little insight about how to prepare yourself for IOS pen-testing
references:
https://spaceraccoon.dev/from-checkra1n-to-frida-ios-app-pentesting-quickstart-on-ios-13
Comments
Post a Comment