Skip to content

Commit 72cbf34

Browse files
authored
Merge pull request #2024 from HackTricks-wiki/update_Taking_Apart_iOS_Apps__Anti-Debugging_20260318_185847
Taking Apart iOS Apps’ Anti-Debugging
2 parents 387defd + b01b46d commit 72cbf34

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

  • src/mobile-pentesting/ios-pentesting

src/mobile-pentesting/ios-pentesting/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,18 @@ Identification of **protections are present in the binary**:
156156
- **Environment Variables**: Check for environment variables that may indicate a debugging session.
157157
- **Mach Ports**: Detect if mach exception ports are being used by debuggers.
158158

159+
160+
#### Anti-Debugging & Anti-Tamper Techniques (Layered Checks)
161+
162+
Real-world apps often layer pre-exec, on-attach, and continuous checks. Common patterns to look for (and how to neutralize them during testing):
163+
164+
- **Private API side-channel fingerprinting**: private launch APIs (e.g., `SBSLaunchApplicationWithIdentifierAndURLAndLaunchOptions`) are abused to probe for installed bundle IDs (`com.opa334.TrollStore`, `org.coolstar.SileoStore`, `com.tigisoftware.Filza`, etc.) based on return codes/logging. Hook the call and sanitize arguments/return values to emulate a clean device.
165+
- **Self-attestation via code-signing state**: `csops()` with `CS_OPS_ENTITLEMENTS_BLOB` reads entitlements; unexpected values trigger exit. Pair this with integrity checks (CRC32/MD5 of resources, certificate validation, Mach-O metadata like `LC_ENCRYPTION_INFO_64`) to detect re-signing or patching. Instrument these routines and force "expected" results during analysis.
166+
- **Kill-on-attach**: `ptrace(PT_DENY_ATTACH)` combined with `abort()`/`exit()` on attach. Bypass by neutralizing the termination path or hooking `ptrace` to succeed without enforcing denial.
167+
- **Crash forensics sabotage**: overwrite CPU registers before crashing to destroy backtraces. Prefer breakpoints/hooks earlier in the detection path instead of relying on crash logs.
168+
- **Jetsam-based termination**: deliberate memory pressure to trigger jetsam, which yields no normal crash log. Look for large allocations around detection logic and cap/short-circuit them to keep logs.
169+
- **Continuous checks with delayed enforcement**: heartbeat timers re-run detection and enforce later. Trace timers/dispatch sources and keep the process alive by bypassing the delayed kill path.
170+
159171
### Basic Dynamic Analysis
160172

161173
Check out the dynamic analysis that [**MobSF**](https://github.com/MobSF/Mobile-Security-Framework-MobSF) perform. You will need to navigate through the different views and interact with them but it will be hooking several classes on doing other things and will prepare a report once you are done.
@@ -1199,6 +1211,7 @@ zero-click-messaging-image-parser-chains.md
11991211
12001212
## **References & More Resources**
12011213
1214+
- [https://blog.calif.io/p/taking-apart-ios-apps-anti-debugging](https://blog.calif.io/p/taking-apart-ios-apps-anti-debugging)
12021215
- [https://mobile-security.gitbook.io/mobile-security-testing-guide/ios-testing-guide/0x06b-basic-security-testing#information-gathering](https://mobile-security.gitbook.io/mobile-security-testing-guide/ios-testing-guide/0x06b-basic-security-testing#information-gathering)
12031216
- [iOS & Mobile App Pentesting - INE](https://my.ine.com/CyberSecurity/courses/089d060b/ios-mobile-app-pentesting)
12041217
- [https://mas.owasp.org/MASTG/techniques/ios/MASTG-TECH-0057/](https://mas.owasp.org/MASTG/techniques/ios/MASTG-TECH-0057/)
@@ -1227,4 +1240,3 @@ zero-click-messaging-image-parser-chains.md
12271240
12281241
12291242
{{#include ../../banners/hacktricks-training.md}}
1230-

0 commit comments

Comments
 (0)