iOS Hooking With Objection
Learn & practice AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
For this section the tool Objection is going to be used. Start by getting an objection's session executing something like:
objection -d --gadget "iGoat-Swift" explore
objection -d --gadget "OWASP.iGoat-Swift" exploreYou can execute also frida-ps -Uia to check the running processes of the phone.
Basic Enumeration of the app
Local App Paths
env: Find the paths where the application is stored inside the deviceenv Name Path ----------------- ----------------------------------------------------------------------------------------------- BundlePath /private/var/containers/Bundle/Application/179A6E8B-E7A8-476E-BBE3-B9300F546068/iGoat-Swift.app CachesDirectory /var/mobile/Containers/Data/Application/A079DF84-726C-4AEA-A194-805B97B3684A/Library/Caches DocumentDirectory /var/mobile/Containers/Data/Application/A079DF84-726C-4AEA-A194-805B97B3684A/Documents LibraryDirectory /var/mobile/Containers/Data/Application/A079DF84-726C-4AEA-A194-805B97B3684A/Library
List Bundles, frameworks and libraries
ios bundles list_bundles: List bundles of the applicationios bundles list_frameworks: List external frameworks used by the applicationmemory list modules: List loaded modules in memorymemory list exports <module_name>: Exports of a loaded module
List classes of an APP
ios hooking list classes: List classes of the appios hooking search classes <search_term>: Search a class that contains a string. You can search some uniq term that is related to the main app package name to find the main classes of the app like in the example:
List class methods
ios hooking list class_methods: List methods of a specific classios hooking search methods <search_term>: Search a method that contains a string
Basic Hooking
Now that you have enumerated the classes and modules used by the application you may have found some interesting class and method names.
Hook all methods of a class
ios hooking watch class <class_name>: Hook all the methods of a class, dump all the initial parameters and returns
Hook a single method
ios hooking watch method "-[<class_name> <method_name>]" --dump-args --dump-return --dump-backtrace: Hook an specific method of a class dumping the parameters, backtraces and returns of the method each time it's called
Change Boolean Return
ios hooking set return_value "-[<class_name> <method_name>]" false: This will make the selected method return the indicated boolean
Generate hooking template
ios hooking generate simple <class_name>:
Learn & practice AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Last updated