Skip to content

Commit 8ef64d8

Browse files
authored
Merge pull request #2032 from HackTricks-wiki/research_update_src_mobile-pentesting_ios-pentesting_ios-testing-environment_20260319_202436
Research Update Enhanced src/mobile-pentesting/ios-pentestin...
2 parents 04648eb + b15f406 commit 8ef64d8

1 file changed

Lines changed: 55 additions & 4 deletions

File tree

src/mobile-pentesting/ios-pentesting/ios-testing-environment.md

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,42 @@ A **provisioning identity** is a collection of public and private keys that are
99
Starting in Xcode 7.2 Apple has provided an option to create a **free iOS development provisioning profile** that allows to write and test your application on a real iPhone. Go to _Xcode_ --> _Preferences_ --> _Accounts_ --> _+_ (Add new Appli ID you your credentials) --> _Click on the Apple ID created_ --> _Manage Certificates_ --> _+_ (Apple Development) --> _Done_\
1010
\_\_Then, in order to run your application in your iPhone you need first to **indicate the iPhone to trust the computer.** Then, you can try to **run the application in the mobile from Xcode,** but and error will appear. So go to _Settings_ --> _General_ --> _Profiles and Device Management_ --> Select the untrusted profile and click "**Trust**".
1111

12+
On **iOS 16+**, **Developer Mode** must also be enabled on the device before locally installed development-signed applications (or apps re-signed with `get-task-allow`) will run. This option only appears **after pairing the device with Xcode** or after installing a development-signed app once. The flow is: **pair the device**, trigger an install from Xcode, then enable **Settings** --> **Privacy & Security** --> **Developer Mode**, reboot, and confirm the prompt after unlock.
13+
1214
Note that **applications signed by the same signing certificate can share resources on a secure manner, like keychain items**.
1315

1416
The provisioning profiles are stored inside the phone in **`/Library/MobileDevice/ProvisioningProfiles`**
1517

18+
### Modern host-side device tooling
19+
20+
For current iOS testing, the host tooling is increasingly split between:
21+
22+
- **`xcrun simctl`** for simulator management
23+
- **`xcrun xctrace list devices`** to enumerate simulators and physical devices
24+
- **`xcrun devicectl`** (Xcode 15+) to interact with paired physical devices from the command line
25+
26+
Useful examples:
27+
28+
```bash
29+
# List booted simulators
30+
xcrun simctl list | grep Booted
31+
32+
# List all visible devices/simulators
33+
xcrun xctrace list devices
34+
35+
# List paired physical devices (Xcode 15+)
36+
xcrun devicectl list devices
37+
```
38+
39+
`devicectl` is especially useful in automation pipelines where you need to install or launch a test build without opening Xcode:
40+
41+
```bash
42+
xcrun devicectl device install app --device <udid> <path_to_app_or_ipa>
43+
xcrun devicectl device launch app --terminate-existing --device <udid> <bundle_id>
44+
```
45+
46+
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.
47+
1648
## **Simulator**
1749

1850
> [!TIP]
@@ -28,6 +60,8 @@ It's highly recommended to **download** Xcode from the **official app store**. O
2860

2961
The simulator files can be found in `/Users/<username>/Library/Developer/CoreSimulator/Devices`
3062

63+
The simulator is still very useful for quickly testing **filesystem artifacts**, **NSUserDefaults**, **plist parsing**, **custom URL schemes**, and **basic runtime instrumentation**. However, keep in mind that it doesn't emulate several physical-device security properties that are often relevant during a pentest, such as the **Secure Enclave**, **baseband**, certain **keychain access-control behaviours**, realistic **biometric flows**, and jailbreak-specific execution conditions.
64+
3165
To open the simulator, run Xcode, then press in the _Xcode tab_ --> _Open Developer tools_ --> _Simulator_\
3266
\_\_In the following image clicking in "iPod touch \[...]" you can select other device to test in:
3367

@@ -93,12 +127,27 @@ iOS updates are controlled by a **challenge-response mechanism** (SHSH blobs), a
93127

94128
Jailbreaking tools vary by iOS version and device. Resources such as [Can I Jailbreak?](https://canijailbreak.com), [The iPhone Wiki](https://www.theiphonewiki.com), and [Reddit Jailbreak](https://www.reddit.com/r/jailbreak/) provide up-to-date information. Examples include:
95129

96-
- [Checkra1n](https://checkra.in/) for A7-A11 chip devices.
97-
- [Palera1n](https://palera.in/) for Checkm8 devices (A8-A11) on iOS 15.0-16.5.
98-
- [Unc0ver](https://unc0ver.dev/) for iOS versions up to 14.8.
130+
- [Checkra1n](https://checkra.in/) for older A7-A11/iOS 12-14 era research devices.
131+
- [Palera1n](https://palera.in/) for checkm8-compatible devices (A8-A11) on iOS/iPadOS 15+.
132+
- [Dopamine](https://github.com/opa334/Dopamine) for many arm64/arm64e devices on iOS 15/16 using a modern rootless jailbreak.
133+
- [Unc0ver](https://unc0ver.dev/) remains relevant mainly for older iOS versions up to 14.8.
99134

100135
Modifying your device carries risks, and jailbreaking should be approached with caution.
101136

137+
### Rootless jailbreaks
138+
139+
Modern iOS 15+ jailbreaks are commonly **rootless** instead of **rootful**. From a tester perspective, this matters because a lot of older guides still assume that jailbreak files live directly under `/` or `/Library/...`, which is no longer true on many current setups.
140+
141+
- Rootless jailbreaks avoid modifying the sealed system volume directly.
142+
- On palera1n, jailbreak files are typically stored under a randomized path in `/private/preboot/...` and exposed through the stable symlink **`/var/jb`**.
143+
- Tweaks, launch daemons, and helper binaries might therefore exist under **`/var/jb`** instead of the legacy rootful locations.
144+
145+
This has a direct impact on **environment validation**, **Frida setup**, and **jailbreak detection bypass**:
146+
147+
- When checking whether your tooling installed correctly, inspect both legacy paths and **`/var/jb`**.
148+
- When reviewing jailbreak detection logic in an app, remember that modern checks often look for **rootless** artifacts and symlinks in addition to classic indicators like `Cydia.app`.
149+
- If a third-party script or tweak assumes a rootful filesystem layout, it may fail silently on a rootless device.
150+
102151
### Jailbreaking Benefits and Risks
103152

104153
Jailbreaking **removes OS-imposed sandboxing**, allowing apps to access the entire filesystem. This freedom enables the installation of unapproved apps and access to more APIs. However, for regular users, jailbreaking is **not recommended** due to potential security risks and device instability.
@@ -115,6 +164,7 @@ basic-ios-testing-operations.md
115164
**Several applications will try to detect if the mobile is jailbroken and in that case the application won't run**
116165

117166
- After jailbreaking an iOS **files and folders are usually installed**, these can be searched to determine if the device is jailbroken.
167+
- In modern **rootless** jailbreaks, those files may appear under **`/var/jb`** or resolve through symlinks into `/private/preboot/...` instead of only in classic rootful locations.
118168
- In a jailbroken device applications get **read/write access to new files** outside the sandbox
119169
- Some **API** **calls** will **behave differently**
120170
- The presence of the **OpenSSH** service
@@ -132,7 +182,8 @@ You can try to avoid this detections using **objection's** `ios jailbreak disabl
132182
## References
133183

134184
- [https://mas.owasp.org/MASTG/iOS/0x06b-iOS-Security-Testing/](https://mas.owasp.org/MASTG/iOS/0x06b-iOS-Security-Testing/)
185+
- [https://developer.apple.com/documentation/xcode/enabling-developer-mode-on-a-device](https://developer.apple.com/documentation/xcode/enabling-developer-mode-on-a-device)
186+
- [https://docs.palera.in/docs/reference/environment-types/](https://docs.palera.in/docs/reference/environment-types/)
135187

136188
{{#include ../../banners/hacktricks-training.md}}
137189

138-

0 commit comments

Comments
 (0)