Skip to content

Commit f05afa0

Browse files
committed
f
1 parent ee674ab commit f05afa0

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,26 @@ Identification of **protections are present in the binary**:
136136
grep -iER "_vsprintf"
137137
```
138138

139+
#### Common Jailbreak detection methods
140+
141+
- **File System Checks**: Look for the presence of common jailbreak files and directories, such as `/Applications/Cydia.app` or `/Library/MobileSubstrate/MobileSubstrate.dylib`.
142+
- **Sandbox Violations**: Attempt to access restricted areas of the file system, which should be blocked on non-jailbroken devices.
143+
- **API Checks**: Check if it's possible to use forbidden calls like `fork()` to create a child process or `system()` to see if /bin/sh exists.
144+
- **Process Checks**: Monitor for the presence of known jailbreak-related processes, such as `Cydia`, `Substrate`, or `ssh`.
145+
- **Kernel Exploits**: Check for the presence of kernel exploits that are commonly used in jailbreaks.
146+
- **Environment Variables**: Inspect environment variables for signs of a jailbreak, such as `DYLD_INSERT_LIBRARIES`.
147+
- **Libraries Check**: Check the libs that are loaded into the app process.
148+
- **Check schemes**: Like `canOpenURL(URL(string: "cydia://"))`.
149+
150+
#### Common Anti-Debugging detection methods
151+
152+
- **Check for Debugger Presence**: Use `sysctl` or other methods to check if a debugger is attached.
153+
- **Anti-Debugging APIs**: Look for calls to anti-debugging APIs like `ptrace` or `SIGSTOP` like `ptrace(PT_DENY_ATTACH, 0, 0, 0)`.
154+
- **Timing Checks**: Measure the time taken for certain operations and look for discrepancies that may indicate debugging.
155+
- **Memory Checks**: Inspect memory for known debugger artifacts or modifications.
156+
- **Environment Variables**: Check for environment variables that may indicate a debugging session.
157+
- **Mach Ports**: Detect if mach exception ports are being used by debuggers.
158+
139159
### Basic Dynamic Analysis
140160

141161
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.

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22

33
{{#include ../../banners/hacktricks-training.md}}
44

5+
## Filesystem Folders
6+
7+
- `/Applications`: Contains all the installed native applications on the device (e.g. `/Applications/Calculator.app`)
8+
- `/var/containers/Bundle/application/[uuid]`: Contains the application bundles for installed apps.
9+
- `/var/mobile/Containers/Data/Application/[uuid]`: Contains the data for the installed applications.
10+
- `/System`: Contains the core system files and libraries.
11+
- `/Library`: Contains system-wide resources and settings.
12+
- `/User`: Contains user-specific data and settings.
13+
- `/Development`: Empty unless you press the "Use for development" button
14+
- `/dev`: Contains device files.
15+
- `/Core`: Contains OS core dumps.
16+
- `/private/var/mobile/Library/Logs/CrashReporter/<appname-date>*`: Contains crash logs for the specified application.
17+
- Many other common unix folders...
18+
19+
### SQLite DBs
20+
21+
SQLite DBs are widely used in iOS and Android applications for local data storage. They provide a lightweight, serverless database solution that is easy to integrate and use within mobile apps.
22+
23+
A SQLite DB usually generates 3 files:
24+
- `<name>.db`: The main database file.
25+
- `<name>.db-shm`: The journal file which stores data before a transaction change (for DB restoration if needed).
26+
- `<name>.db-wal`: The write-ahead log file which stores the new data until it's ready to commit to the DB for faster processing.
27+
28+
529
## Privilege Separation and Sandbox
630

731
In iOS, a distinction in privilege exists between the user-accessible applications and the system's core processes. Applications run under the **`mobile`** user identity, while the crucial system processes operate as **`root`**. This separation is enhanced by a sandbox mechanism, which imposes strict limitations on what actions applications can undertake. For instance, even if applications share the same user identity, they are prohibited from accessing or modifying each other's data.

0 commit comments

Comments
 (0)