2024-07-19 05:24:40 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > [**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > \
Learn & practice GCP Hacking: < img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > [**HackTricks Training GCP Red Team Expert (GRTE)**< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > ](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
< details >
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
< summary > Support HackTricks< / summary >
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
* Check the [**subscription plans** ](https://github.com/sponsors/carlospolop )!
* **Join the** 💬 [**Discord group** ](https://discord.gg/hRep4RUj7f ) or the [**telegram group** ](https://t.me/peass ) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) and [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) github repos.
2022-04-28 16:01:33 +00:00
< / details >
2024-07-19 05:24:40 +00:00
{% endhint %}
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
इस अनुभाग के लिए उपकरण [**Objection** ](https://github.com/sensepost/objection ) का उपयोग किया जाएगा।\
कुछ इस तरह से एक objection का सत्र शुरू करें:
2021-05-20 12:17:20 +00:00
```bash
objection -d --gadget "iGoat-Swift" explore
objection -d --gadget "OWASP.iGoat-Swift" explore
```
2024-07-19 05:24:40 +00:00
You can execute also `frida-ps -Uia` to check the running processes of the phone.
2021-05-20 12:17:20 +00:00
2024-07-19 05:24:40 +00:00
# Basic Enumeration of the app
2021-05-20 12:17:20 +00:00
2024-07-19 05:24:40 +00:00
## Local App Paths
2022-01-16 18:11:15 +00:00
2024-07-19 05:24:40 +00:00
* `env` : डिवाइस के अंदर एप्लिकेशन के संग्रहित पथों को खोजें
2022-01-16 18:11:15 +00:00
2023-11-06 08:38:02 +00:00
```bash
env
2024-07-19 05:24:40 +00:00
Name Path
2023-11-06 08:38:02 +00:00
----------------- -----------------------------------------------------------------------------------------------
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
```
2022-01-16 18:11:15 +00:00
2024-07-19 05:24:40 +00:00
## List Bundles, frameworks and libraries
2022-01-16 18:11:15 +00:00
2024-07-19 05:24:40 +00:00
* `ios bundles list_bundles` : एप्लिकेशन के बंडलों की सूची बनाएं
2022-01-16 18:11:15 +00:00
2023-11-06 08:38:02 +00:00
```bash
ios bundles list_bundles
Executable Bundle Version Path
------------ -------------------- --------- -------------------------------------------
iGoat-Swift OWASP.iGoat-Swift 1.0 ...8-476E-BBE3-B9300F546068/iGoat-Swift.app
AGXMetalA9 com.apple.AGXMetalA9 172.18.4 ...tem/Library/Extensions/AGXMetalA9.bundle
```
2024-07-19 05:24:40 +00:00
* `ios bundles list_frameworks` : एप्लिकेशन द्वारा उपयोग किए जाने वाले बाहरी फ्रेमवर्क की सूची बनाएं
2022-01-16 18:11:15 +00:00
2023-11-06 08:38:02 +00:00
```bash
ios bundles list_frameworks
Executable Bundle Version Path
------------------------------ -------------------------------------------- ---------- -------------------------------------------
ReactCommon org.cocoapods.ReactCommon 0.61.5 ...tle.app/Frameworks/ReactCommon.framework
2024-07-19 05:24:40 +00:00
...vateFrameworks/CoreDuetContext.framework
FBReactNativeSpec org.cocoapods.FBReactNativeSpec 0.61.5 ...p/Frameworks/FBReactNativeSpec.framework
...ystem/Library/Frameworks/IOKit.framework
RCTAnimation org.cocoapods.RCTAnimation 0.61.5 ...le.app/Frameworks/RCTAnimation.framework
jsinspector org.cocoapods.jsinspector 0.61.5 ...tle.app/Frameworks/jsinspector.framework
DoubleConversion org.cocoapods.DoubleConversion 1.1.6 ...pp/Frameworks/DoubleConversion.framework
react_native_config org.cocoapods.react-native-config 0.12.0 ...Frameworks/react_native_config.framework
react_native_netinfo org.cocoapods.react-native-netinfo 4.4.0 ...rameworks/react_native_netinfo.framework
PureLayout org.cocoapods.PureLayout 3.1.5 ...ttle.app/Frameworks/PureLayout.framework
GoogleUtilities org.cocoapods.GoogleUtilities 6.6.0 ...app/Frameworks/GoogleUtilities.framework
RCTNetwork org.cocoapods.RCTNetwork 0.61.5 ...ttle.app/Frameworks/RCTNetwork.framework
RCTActionSheet org.cocoapods.RCTActionSheet 0.61.5 ....app/Frameworks/RCTActionSheet.framework
react_native_image_editor org.cocoapods.react-native-image-editor 2.1.0 ...orks/react_native_image_editor.framework
CoreModules org.cocoapods.CoreModules 0.61.5 ...tle.app/Frameworks/CoreModules.framework
RCTVibration org.cocoapods.RCTVibration 0.61.5 ...le.app/Frameworks/RCTVibration.framework
RNGestureHandler org.cocoapods.RNGestureHandler 1.6.1 ...pp/Frameworks/RNGestureHandler.framework
RNCClipboard org.cocoapods.RNCClipboard 1.5.1 ...le.app/Frameworks/RNCClipboard.framework
react_native_image_picker org.cocoapods.react-native-image-picker 2.3.4 ...orks/react_native_image_picker.framework
[..]
2023-11-06 08:38:02 +00:00
```
2024-07-19 05:24:40 +00:00
* `memory list modules` : मेमोरी में लोड किए गए मॉड्यूल की सूची बनाएं
2022-01-16 18:11:15 +00:00
2023-11-06 08:38:02 +00:00
```bash
memory list modules
2024-02-09 02:46:55 +00:00
Name Base Size Path
2023-11-06 08:38:02 +00:00
----------------------------------- ----------- ------------------- ------------------------------------------------------------------------------
iGoat-Swift 0x104ffc000 2326528 (2.2 MiB) /private/var/containers/Bundle/Application/179A6E8B-E7A8-476E-BBE3-B9300F54...
SubstrateBootstrap.dylib 0x105354000 16384 (16.0 KiB) /usr/lib/substrate/SubstrateBootstrap.dylib
2024-07-19 05:24:40 +00:00
SystemConfiguration 0x1aa842000 495616 (484.0 KiB) /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguratio...
libc++.1.dylib 0x1bdcfd000 368640 (360.0 KiB) /usr/lib/libc++.1.dylib
libz.1.dylib 0x1efd3c000 73728 (72.0 KiB) /usr/lib/libz.1.dylib
libsqlite3.dylib 0x1c267f000 1585152 (1.5 MiB) /usr/lib/libsqlite3.dylib
Foundation 0x1ab550000 2732032 (2.6 MiB) /System/Library/Frameworks/Foundation.framework/Foundation
libobjc.A.dylib 0x1bdc64000 233472 (228.0 KiB) /usr/lib/libobjc.A.dylib
[...]
2023-11-06 08:38:02 +00:00
```
2024-07-19 05:24:40 +00:00
* `memory list exports <module_name>` : लोड किए गए मॉड्यूल के एक्सपोर्ट
2022-01-16 18:11:15 +00:00
2023-11-06 08:38:02 +00:00
```bash
memory list exports iGoat-Swift
2024-02-09 02:46:55 +00:00
Type Name Address
2023-11-06 08:38:02 +00:00
-------- -------------------------------------------------------------------------------------------------------------------------------------- -----------
2024-01-12 10:20:03 +00:00
variable _mh_execute_header 0x104ffc000
function _mdictof 0x10516cb88
2024-07-19 05:24:40 +00:00
function _ZN9couchbase6differ10BaseDifferD2Ev 0x10516486c
function _ZN9couchbase6differ10BaseDifferD1Ev 0x1051648f4
function _ZN9couchbase6differ10BaseDifferD0Ev 0x1051648f8
function _ZN9couchbase6differ10BaseDiffer5setupEmm 0x10516490c
function _ZN9couchbase6differ10BaseDiffer11allocStripeEmm 0x105164a20
function _ZN9couchbase6differ10BaseDiffer7computeEmmj 0x105164ad8
function _ZN9couchbase6differ10BaseDiffer7changesEv 0x105164de4
function _ZN9couchbase6differ10BaseDiffer9addChangeENS0_6ChangeE 0x105164fa8
function _ZN9couchbase6differlsERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEERKNS0_6ChangeE 0x1051651d8
function _ZN9couchbase6differlsERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEERKNS1_6vectorINS0_6ChangeENS1_9allocatorIS8_EEEE 0x105165280
variable _ZTSN9couchbase6differ10BaseDifferE 0x1051d94f0
variable _ZTVN9couchbase6differ10BaseDifferE 0x10523c0a0
variable _ZTIN9couchbase6differ10BaseDifferE 0x10523c0f8
[..]
2024-01-12 10:20:03 +00:00
```
2024-07-19 05:24:40 +00:00
## List classes of an APP
2023-11-06 08:38:02 +00:00
2024-07-19 05:24:40 +00:00
* `ios hooking list classes` : ऐप की कक्षाओं की सूची बनाएं
2022-01-16 18:11:15 +00:00
2023-11-06 08:38:02 +00:00
```bash
ios hooking list classes
AAAbsintheContext
AAAbsintheSigner
2024-07-19 05:24:40 +00:00
AAAbsintheSignerContextCache
AAAcceptedTermsController
AAAccount
AAAccountManagementUIResponse
AAAccountManager
AAAddEmailUIRequest
AAAppleIDSettingsRequest
AAAppleTVRequest
AAAttestationSigner
[...]
2023-11-06 08:38:02 +00:00
```
2024-07-19 05:24:40 +00:00
* `ios hooking search classes <search_term>` : एक कक्षा खोजें जिसमें एक स्ट्रिंग हो। आप **मुख्य ऐप पैकेज** नाम से संबंधित कुछ अद्वितीय शब्द खोज सकते हैं ताकि ऐप की मुख्य कक्षाओं को पाया जा सके जैसे उदाहरण में:
2022-04-28 16:01:33 +00:00
2023-11-06 08:38:02 +00:00
```bash
ios hooking search classes iGoat
iGoat_Swift.CoreDataHelper
iGoat_Swift.RCreditInfo
2024-07-19 05:24:40 +00:00
iGoat_Swift.SideContainmentSegue
iGoat_Swift.CenterContainmentSegue
iGoat_Swift.KeyStorageServerSideVC
iGoat_Swift.HintVC
iGoat_Swift.BinaryCookiesExerciseVC
iGoat_Swift.ExerciseDemoVC
iGoat_Swift.PlistStorageExerciseViewController
iGoat_Swift.CouchBaseExerciseVC
iGoat_Swift.MemoryManagementVC
[...]
2023-11-06 08:38:02 +00:00
```
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
## List class methods
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
* `ios hooking list class_methods` : एक विशिष्ट कक्षा के तरीकों की सूची बनाएं
2022-04-28 16:01:33 +00:00
2023-11-06 08:38:02 +00:00
```bash
ios hooking list class_methods iGoat_Swift.RCreditInfo
- cvv
- setCvv:
- setName:
2024-07-19 05:24:40 +00:00
- .cxx_destruct
- name
- cardNumber
- init
- initWithValue:
- setCardNumber:
2023-11-06 08:38:02 +00:00
```
2024-07-19 05:24:40 +00:00
* `ios hooking search methods <search_term>` : एक विधि खोजें जिसमें एक स्ट्रिंग हो
2023-11-06 08:38:02 +00:00
```bash
ios hooking search methods cvv
2024-07-19 05:24:40 +00:00
[AMSFinanceVerifyPurchaseResponse + _dialogRequestForCVVFromPayload:verifyType:]
[AMSFinanceVerifyPurchaseResponse - _handleCVVDialogResult:shouldReattempt:]
[AMSFinanceVerifyPurchaseResponse - _runCVVRequestForCode:error:]
[iGoat_Swift.RCreditInfo - cvv]
[iGoat_Swift.RCreditInfo - setCvv:]
[iGoat_Swift.RealmExerciseVC - creditCVVTextField]
[iGoat_Swift.RealmExerciseVC - setCreditCVVTextField:]
[iGoat_Swift.DeviceLogsExerciseVC - cvvTextField]
[iGoat_Swift.DeviceLogsExerciseVC - setCvvTextField:]
[iGoat_Swift.CloudMisconfigurationExerciseVC - cvvTxtField]
[iGoat_Swift.CloudMisconfigurationExerciseVC - setCvvTxtField:]
2023-11-06 08:38:02 +00:00
```
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
# Basic Hooking
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
अब जब आपने **कक्षाओं और मॉड्यूलों की गणना की है** जो एप्लिकेशन द्वारा उपयोग किए जाते हैं, तो आप कुछ **दिलचस्प कक्षा और विधि नाम** पा सकते हैं।
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
## Hook all methods of a class
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
* `ios hooking watch class <class_name>` : एक कक्षा के सभी तरीकों को हुक करें, सभी प्रारंभिक पैरामीटर और रिटर्न को डंप करें
2022-04-28 16:01:33 +00:00
2023-11-06 08:38:02 +00:00
```bash
ios hooking watch class iGoat_Swift.PlistStorageExerciseViewController
```
2024-07-19 05:24:40 +00:00
## Hook a single method
2023-11-06 08:38:02 +00:00
2024-07-19 05:24:40 +00:00
* `ios hooking watch method "-[<class_name> <method_name>]" --dump-args --dump-return --dump-backtrace` : एक कक्षा की विशिष्ट विधि को हुक करें, प्रत्येक बार इसे कॉल करने पर विधि के पैरामीटर, बैकट्रेस और रिटर्न को डंप करें
2023-11-06 08:38:02 +00:00
```bash
ios hooking watch method "-[iGoat_Swift.BinaryCookiesExerciseVC verifyItemPressed]" --dump-args --dump-backtrace --dump-return
```
2024-07-19 05:24:40 +00:00
## Change Boolean Return
2023-11-06 08:38:02 +00:00
2024-07-19 05:24:40 +00:00
* `ios hooking set return_value "-[<class_name> <method_name>]" false` : यह चयनित विधि को निर्दिष्ट बूलियन लौटाने के लिए बनाएगा
2023-11-06 08:38:02 +00:00
```bash
ios hooking set return_value "-[iGoat_Swift.BinaryCookiesExerciseVC verifyItemPressed]" false
```
2024-07-19 05:24:40 +00:00
## Generate hooking template
2023-11-06 08:38:02 +00:00
* `ios hooking generate simple <class_name>` :
```bash
ios hooking generate simple iGoat_Swift.RCreditInfo
var target = ObjC.classes.iGoat_Swift.RCreditInfo;
Interceptor.attach(target['+ sharedSchema'].implementation, {
onEnter: function (args) {
console.log('Entering + sharedSchema!');
},
onLeave: function (retval) {
console.log('Leaving + sharedSchema');
},
});
Interceptor.attach(target['+ className'].implementation, {
onEnter: function (args) {
console.log('Entering + className!');
},
onLeave: function (retval) {
console.log('Leaving + className');
},
});
Interceptor.attach(target['- cvv'].implementation, {
onEnter: function (args) {
console.log('Entering - cvv!');
},
onLeave: function (retval) {
console.log('Leaving - cvv');
},
});
Interceptor.attach(target['- setCvv:'].implementation, {
onEnter: function (args) {
console.log('Entering - setCvv:!');
},
onLeave: function (retval) {
console.log('Leaving - setCvv:');
},
});
```
2024-07-19 05:24:40 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > [**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > \
Learn & practice GCP Hacking: < img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > [**HackTricks Training GCP Red Team Expert (GRTE)**< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > ](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
< details >
< summary > Support HackTricks< / summary >
2022-04-28 16:01:33 +00:00
2024-07-19 05:24:40 +00:00
* Check the [**subscription plans** ](https://github.com/sponsors/carlospolop )!
* **Join the** 💬 [**Discord group** ](https://discord.gg/hRep4RUj7f ) or the [**telegram group** ](https://t.me/peass ) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) and [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) github repos.
2024-02-09 02:46:55 +00:00
< / details >
2024-07-19 05:24:40 +00:00
{% endhint %}