iOS परीक्षण वातावरण
Tip
AWS हैकिंग सीखें और अभ्यास करें:
HackTricks Training AWS Red Team Expert (ARTE)
GCP हैकिंग सीखें और अभ्यास करें:HackTricks Training GCP Red Team Expert (GRTE)
Azure हैकिंग सीखें और अभ्यास करें:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks का समर्थन करें
- सदस्यता योजनाओं की जांच करें!
- हमारे 💬 Discord समूह या टेलीग्राम समूह में शामिल हों या हमें Twitter 🐦 @hacktricks_live** पर फॉलो करें।**
- हैकिंग ट्रिक्स साझा करें और HackTricks और HackTricks Cloud गिटहब रिपोजिटरी में PRs सबमिट करें।
Apple Developer Program
A provisioning identity एक सार्वजनिक और निजी कुंजियों का संग्रह है जो कि एक Apple developer account से जुड़ा होता है। एप्स को sign करने के लिए आपको Apple Developer Program में पंजीकरण करने के लिए 99$/year देना होगा ताकि आप अपनी provisioning identity प्राप्त कर सकें। इसके बिना आप source code से बनी applications को किसी physical device पर चलाने में सक्षम नहीं होंगे। इसका एक और विकल्प एक jailbroken device का उपयोग करना है।
Xcode 7.2 से Apple ने एक विकल्प दिया है जो कि एक free iOS development provisioning profile बनाने की अनुमति देता है, जिससे आप अपने application को एक वास्तविक iPhone पर लिखकर टेस्ट कर सकते हैं। जाएं Xcode –> Preferences –> Accounts –> + (Add new Appli ID you your credentials) –> Click on the Apple ID created –> Manage Certificates –> + (Apple Development) –> Done
__फिर, अपने iPhone पर application चलाने से पहले आपको पहले iPhone को कंप्यूटर पर भरोसा करने के लिए बताना होगा (indicate the iPhone to trust the computer). फिर, आप Xcode से mobile में application को run करने का प्रयास कर सकते हैं, लेकिन एक error आएगा। तो जाएं Settings –> General –> Profiles and Device Management –> उस untrusted profile को चुनें और “Trust” पर क्लिक करें।
On iOS 16+, डिवाइस पर locally installed development-signed applications (या get-task-allow के साथ re-signed की गई apps) चलाने से पहले Developer Mode भी सक्षम होना चाहिए। यह विकल्प केवल तब दिखाई देता है जब device को Xcode के साथ pair किया गया हो या एक development-signed app एक बार इंस्टॉल किया गया हो। flow यह है: pair the device, Xcode से एक install ट्रिगर करें, फिर Settings –> Privacy & Security –> Developer Mode को enable करें, reboot करें, और unlock के बाद prompt को confirm करें।
ध्यान दें कि applications जो एक ही signing certificate द्वारा साइन किए गए हैं वे सुरक्षित तरीके से resources शेयर कर सकते हैं, जैसे कि keychain items।
Provisioning profiles फोन के अंदर स्टोर होते हैं, स्थान: /Library/MobileDevice/ProvisioningProfiles
Modern host-side device tooling
वर्तमान iOS testing के लिए, host tooling धीरे-धीरे इन हिस्सों में विभाजित हो रहा है:
xcrun simctlfor simulator managementxcrun xctrace list devicesto enumerate simulators and physical devicesxcrun devicectl(Xcode 15+) to interact with paired physical devices from the command line
Useful examples:
# List booted simulators
xcrun simctl list | grep Booted
# List all visible devices/simulators
xcrun xctrace list devices
# List paired physical devices (Xcode 15+)
xcrun devicectl list devices
devicectl ऑटोमेशन पाइपलाइनों में विशेष रूप से उपयोगी है जहाँ आपको Xcode खोले बिना किसी test build को install या launch करना होता है:
xcrun devicectl device install app --device <udid> <path_to_app_or_ipa>
xcrun devicectl device launch app --terminate-existing --device <udid> <bundle_id>
Keep Xcode updated when testing iOS 17+ devices. Apple moved developer services to the CoreDevice stack and also changed how Developer Disk Images are handled, so outdated host tooling frequently fails with pairing, image-mounting, or app-launch errors.
Simulator
Tip
ध्यान दें कि एक simulator किसी emulator के समान नहीं है। simulator केवल डिवाइस और उसके फ़ंक्शन्स का व्यवहार अनुकरण करता है, पर वास्तव में उनका उपयोग नहीं करता।
Simulator
पहली बात जो आपको जाननी चाहिए वह यह है कि simulator के अंदर pentest करना jailbroken device में करने की तुलना में काफी सीमित होगा।
iOS app को build और support करने के लिए आवश्यक सभी टूल्स केवल आधिकारिक रूप से Mac OS पर समर्थित हैं।
Apple का de facto टूल iOS applications बनाने/debug करने/instrument करने के लिए Xcode है। यह अन्य components जैसे simulators और build और test करने के लिए आवश्यक अलग-अलग SDK versions डाउनलोड करने के लिए उपयोग किया जा सकता है।
यह strongly सुझाव दिया जाता है कि आप Xcode को official app store से ही download करें। अन्य versions में malware हो सकता है।
The simulator files can be found in /Users/<username>/Library/Developer/CoreSimulator/Devices
simulator तेज़ी से filesystem artifacts, NSUserDefaults, plist parsing, custom URL schemes, और basic runtime instrumentation की जाँच के लिए बहुत उपयोगी है। हालाँकि, ध्यान रखें कि यह कई physical-device security गुणों का अनुकरण नहीं करता जो अक्सर pentest के दौरान प्रासंगिक होते हैं, जैसे कि Secure Enclave, baseband, कुछ keychain access-control behaviours, वास्तविक जैसा biometric flows, और jailbreak-specific execution conditions।
To open the simulator, run Xcode, then press in the Xcode tab –> Open Developer tools –> Simulator
__In the following image clicking in “iPod touch […]” you can select other device to test in:
.png)
.png)
Simulator में Applications
Inside /Users/<username>/Library/Developer/CoreSimulator/Devices आप सभी installed simulators पा सकते हैं। अगर आप किसी emulator के अंदर बनाए गए application के फाइल्स तक पहुँचना चाहते हैं तो यह पता लगाना मुश्किल हो सकता है कि किस emulator में app installed है। सही UID find करने का एक तेज़ तरीका है कि आप app को simulator में चलाएँ और फिर चलाएँ:
xcrun simctl list | grep Booted
iPhone 8 (BF5DA4F8-6BBE-4EA0-BA16-7E3AFD16C06C) (Booted)
Once you know the UID the apps installed within it can be found in /Users/<username>/Library/Developer/CoreSimulator/Devices/{UID}/data/Containers/Data/Application
However, surprisingly you won’t find the application here. You need to access /Users/<username>/Library/Developer/Xcode/DerivedData/{Application}/Build/Products/Debug-iphonesimulator/
And in this folder you can find the package of the application.
Emulator
Corellium is the only publicly available iOS emulator. It is an enterprise SaaS solution with a per user license model and does not offer any trial license.
No Jailbreak needed
Check this blog post about how to pentest an iOS application in a non jailbroken device:
iOS Pentesting withuot Jailbreak
Jailbreaking
Apple strictly requires that the code running on the iPhone must be signed by a certificate issued by Apple. Jailbreaking is the process of actively circumventing such restrictions and other security controls put in places by the OS. Therefore, once the device is jailbroken, the integrity check which is responsible for checking apps being installed is patched so it is bypassed.
Tip
Unlike Android, you cannot switch to “Developer Mode” in iOS to run unsigned/untrusted code on the device.
Android Rooting vs. iOS Jailbreaking
जब तुलना की जाती है, तो Android पर rooting और iOS पर jailbreaking मूल रूप से अलग प्रक्रियाएँ हैं। Android डिवाइसेज़ को root करने में कभी-कभी su binary install करना या rooted custom ROM से सिस्टम को replace करना शामिल होता है, और यदि bootloader unlocked हो तो इसके लिए जरूरी नहीं कि exploit की आवश्यकता हो। Flashing custom ROMs तब डिवाइस का OS बदल देता है जब bootloader unlock हो, और कभी-कभी इसके लिए exploit की जरूरत पड़ सकती है।
इसके विपरीत, iOS डिवाइसेज़ custom ROMs flash नहीं कर सकते क्योंकि bootloader केवल Apple-signed images ही boot करता है। Jailbreaking iOS का उद्देश्य Apple की code signing protections को bypass करके unsigned code चलाना है, और यह Apple की लगातार बढ़ती security के कारण जटिल होता जा रहा है।
Jailbreaking Challenges
iOS पर jailbreaking कठिन होता जा रहा है क्योंकि Apple vulnerabilities को जल्दी patch कर देता है। iOS को downgrade करना केवल किसी release के बाद सीमित समय के लिए संभव होता है, इसलिए jailbreaking समय-सम्वेदनशील मामला बन जाता है। सिक्योरिटी टेस्टिंग के लिए उपयोग किए जाने वाले डिवाइस को तब तक अपडेट नहीं करना चाहिए जब तक कि re-jailbreaking सुनिश्चित न हो।
iOS updates एक challenge-response mechanism (SHSH blobs) द्वारा नियंत्रित होते हैं, जो केवल Apple-signed responses के लिए installation की अनुमति देते हैं। इसे “signing window” कहा जाता है, जो OTA firmware packages को स्टोर करने और बाद में उपयोग करने की क्षमता को सीमित करता है। current signing windows जांचने के लिए IPSW Downloads website एक उपयोगी स्रोत है।
Jailbreak Varieties
- Tethered jailbreaks require a computer connection for each reboot.
- Semi-tethered jailbreaks allow booting into non-jailbroken mode without a computer.
- Semi-untethered jailbreaks require manual re-jailbreaking without needing a computer.
- Untethered jailbreaks offer a permanent jailbreak solution without the need for re-application.
Jailbreaking Tools and Resources
Jailbreaking tools vary by iOS version and device. Resources such as Can I Jailbreak?, The iPhone Wiki, and Reddit Jailbreak provide up-to-date information. Examples include:
- Checkra1n for older A7-A11/iOS 12-14 era research devices.
- Palera1n for checkm8-compatible devices (A8-A11) on iOS/iPadOS 15+.
- Dopamine for many arm64/arm64e devices on iOS 15/16 using a modern rootless jailbreak.
- Unc0ver remains relevant mainly for older iOS versions up to 14.8.
डिवाइस को modify करना जोखिम के साथ आता है, और jailbreaking सावधानी के साथ ही किया जाना चाहिए।
Rootless jailbreaks
आधुनिक iOS 15+ jailbreaks अक्सर rootless होते हैं न कि rootful। एक tester के नजरिये से यह महत्वपूर्ण है क्योंकि कई पुराने गाइड अभी भी मानते हैं कि jailbreak फाइलें सीधे / या /Library/... के अंतर्गत रहती हैं, जो कई मौजूदा setups पर अब सच नहीं है।
- Rootless jailbreaks sealed system volume को सीधे modify करने से बचते हैं।
- palera1n पर, jailbreak फाइलें आमतौर पर
/private/preboot/...के अंदर randomized path के तहत store होती हैं और stable symlink/var/jbके माध्यम से expose होती हैं। - Tweaks, launch daemons, और helper binaries इसलिए अक्सर legacy rootful locations की बजाय
/var/jbके अंतर्गत मौजूद हो सकते हैं।
इसका सीधे असर होता है environment validation, Frida setup, और jailbreak detection bypass पर:
- जब आप जांचें कि आपका tooling सही तरह से install हुआ है, तो legacy paths और
/var/jbदोनों की जाँच करें। - जब किसी app में jailbreak detection logic की समीक्षा कर रहे हों, तो ध्यान रखें कि आधुनिक checks अक्सर classic indicators जैसे
Cydia.appके अलावा rootless artifacts और symlinks की तलाश करते हैं। - यदि कोई third-party script या tweak rootful filesystem layout मानता है, तो यह rootless डिवाइस पर silent fail कर सकता है।
Jailbreaking Benefits and Risks
Jailbreaking OS-imposed sandboxing को हटाता है, जिससे apps पूरे filesystem तक access कर सकते हैं। यह अनऑफ़िशियल apps install करने और अधिक APIs तक पहुँचने की अनुमति देता है। हालांकि, सामान्य उपयोगकर्ताओं के लिए, jailbreaking सिफारिश नहीं की जाती क्योंकि यह सुरक्षा जोखिम और डिवाइस instability का कारण बन सकता है।
After Jailbreaking
Jailbreak Detection
Several applications will try to detect if the mobile is jailbroken and in that case the application won’t run
- After jailbreaking an iOS files and folders are usually installed, these can be searched to determine if the device is jailbroken.
- In modern rootless jailbreaks, those files may appear under
/var/jbor resolve through symlinks into/private/preboot/...instead of only in classic rootful locations. - In a jailbroken device applications get read/write access to new files outside the sandbox
- Some API calls will behave differently
- The presence of the OpenSSH service
- Calling
/bin/shwill return 1 instead of 0
More information about how to detect jailbreaking here.
You can try to avoid this detections using objection’s ios jailbreak disable
Jailbreak Detection Bypass
- You can try to avoid this detections using objection’s
ios jailbreak disable - You could also install the tool Liberty Lite (https://ryleyangus.com/repo/). Once the repo is added, the app should appear in the ‘Search’ tab
References
- https://mas.owasp.org/MASTG/iOS/0x06b-iOS-Security-Testing/
- https://developer.apple.com/documentation/xcode/enabling-developer-mode-on-a-device
- https://docs.palera.in/docs/reference/environment-types/
Tip
AWS हैकिंग सीखें और अभ्यास करें:
HackTricks Training AWS Red Team Expert (ARTE)
GCP हैकिंग सीखें और अभ्यास करें:HackTricks Training GCP Red Team Expert (GRTE)
Azure हैकिंग सीखें और अभ्यास करें:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks का समर्थन करें
- सदस्यता योजनाओं की जांच करें!
- हमारे 💬 Discord समूह या टेलीग्राम समूह में शामिल हों या हमें Twitter 🐦 @hacktricks_live** पर फॉलो करें।**
- हैकिंग ट्रिक्स साझा करें और HackTricks और HackTricks Cloud गिटहब रिपोजिटरी में PRs सबमिट करें।


