Conducting Mobile App Penetration Test
When to Use
- Testing mobile applications before release to identify security vulnerabilities and data protection issues
- Conducting compliance assessments against OWASP MASVS (Mobile Application Security Verification Standard) levels L1 and L2
- Evaluating the security of mobile banking, healthcare, or government applications handling sensitive data
- Testing mobile apps that interact with backend APIs to assess the end-to-end security of the mobile ecosystem
- Assessing mobile application resistance to reverse engineering, tampering, and runtime manipulation
Do not use against mobile applications without written authorization from the application owner, for distributing modified or repackaged applications, or for testing apps on the public app stores without a separate test build.
Prerequisites
- Target application IPA (iOS) and APK (Android) files or access to download from a private distribution channel
- Rooted Android device or emulator (Genymotion, Android Studio AVD) with Frida, Objection, and Magisk installed
- Jailbroken iOS device or Corellium virtual device with Frida, Objection, and SSL Kill Switch installed
- Static analysis tools: jadx (Android decompilation), Hopper/Ghidra (iOS binary analysis), MobSF (automated scanning)
- Burp Suite Professional configured as proxy for intercepting mobile app traffic with CA certificate installed on the test device
Legal Notice: This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.
Workflow
Step 1: Static Analysis
Analyze the application binary without executing it:
Android Static Analysis:
- Decompile the APK:
jadx -d output/ target.apk to obtain Java/Kotlin source code
- Review
AndroidManifest.xml for exported components (activities, services, receivers, content providers), permissions, and debuggable flag
- Search for hardcoded secrets:
grep -rn "api_key\|password\|secret\|token\|aws_" output/
- Identify insecure data storage patterns: SharedPreferences with sensitive data, SQLite databases without encryption, files in external storage
- Check for WebView vulnerabilities:
setJavaScriptEnabled(true), addJavascriptInterface(), and loading untrusted content
- Run MobSF automated scan:
python manage.py runserver and upload the APK for automated static analysis
iOS Static Analysis:
- Extract the IPA and locate the Mach-O binary
- Use
otool -L <binary> to list linked frameworks and identify third-party libraries
- Analyze with Ghidra or Hopper for hardcoded URLs, API endpoints, and embedded credentials
- Check Info.plist for App Transport Security (ATS) exceptions that allow insecure HTTP connections
- Review embedded entitlements for excessive capabilities
Step 2: Network Security Testing
Intercept and analyze all network communications:
- Configure Burp Suite as proxy on the test device and install the Burp CA certificate
- Exercise all application functionality while Burp captures API traffic
- SSL/TLS validation: Verify the app validates server certificates properly. If the app fails to connect through the proxy, it may implement certificate pinning.
- Certificate pinning bypass:
- Android: Use Frida script:
frida -U -f com.target.app -l ssl-pinning-bypass.js --no-pause
- iOS: Use SSL Kill Switch or Objection:
objection -g "Target App" explore --startup-command "ios sslpinning disable"
- API traffic analysis: Review all API calls for:
- Sensitive data transmitted without encryption
- Authentication tokens in URL parameters (visible in logs)
- Excessive data in API responses beyond what the UI displays
- Missing or weak authentication on API endpoints
- WebSocket and custom protocols: Check for non-HTTP communication channels that may bypass standard proxy interception
Step 3: Data Storage Analysis
Test for insecure local data storage:
Android Data Storage:
- Access app data directory:
/data/data/com.target.app/
- Check SharedPreferences XML files for stored credentials, tokens, and PII
- Examine SQLite databases:
sqlite3 /data/data/com.target.app/databases/*.db ".dump"
- Check for sensitive data in application logs:
logcat -d | grep -i "password\|token\|key"
- Verify that application data is excluded from backups:
android:allowBackup="false" in AndroidManifest.xml
- Check clipboard for sensitive data leakage
iOS Data Storage:
- Examine the Keychain for stored credentials:
objection -g "Target App" explore then ios keychain dump
- Check NSUserDefaults/plist files:
find /var/mobile/Containers/Data/Application/ -name "*.plist" -exec plutil -p {} \;
- Inspect SQLite databases and Core Data stores for unencrypted sensitive data
- Check for data leaking through screenshots (iOS captures screenshots during app backgrounding)
- Verify data protection class: sensitive files should use NSFileProtectionComplete
Step 4: Authentication and Session Management
Test mobile-specific authentication controls:
- Biometric bypass: Test if biometric authentication can be bypassed by hooking the authentication callback with Frida to always return success
- Token storage: Verify that authentication tokens are stored in the Keychain (iOS) or Android Keystore, not in SharedPreferences or files
- Session timeout: Verify that sessions expire after a reasonable idle timeout and that tokens are invalidated server-side on logout
- Root/jailbreak detection bypass: Test if the app detects rooted/jailbroken devices and if the detection can be bypassed with Frida or Magisk Hide
- Deep link abuse: Test if custom URL schemes or universal links can be used to bypass authentication or access restricted functionality
Step 5: Runtime Manipulation
Test the application's resistance to runtime attacks:
- Frida hooking: Use Frida to hook and modify application functions at runtime:
- Bypass root detection: hook the detection function to return false
- Modify return values of authentication checks
- Intercept encryption functions to capture plaintext data before encryption
- Bypass certificate pinning by hooking SSL verification
- Method swizzling (iOS): Use Frida to replace Objective-C method implementations
- Intent manipulation (Android): Send crafted intents to exported components:
adb shell am start -n com.target.app/.InternalActivity -e "user_id" "admin"
- Tampering detection: Modify the APK/IPA (add code, change resources), re-sign, and install. Verify whether the app detects tampering.
Key Concepts
| Term |
Definition |
| OWASP MASTG |
Mobile Application Security Testing Guide; comprehensive manual for mobile app security testing covering both iOS and Android platforms |
| Certificate Pinning |
A mobile security control that restricts which TLS certificates the app trusts, preventing man-in-the-middle attacks through proxy interception |
| Frida |
Dynamic instrumentation toolkit that allows injection of JavaScript into running processes to hook functions, modify behavior, and bypass security controls |
| Root/Jailbreak Detection |
Application-level checks to detect if the device has been modified to grant root access, typically blocking app usage on compromised devices |
| Android Keystore |
Hardware-backed credential storage on Android that protects cryptographic keys and secrets from extraction even on rooted devices |
| App Transport Security (ATS) |
iOS security feature that enforces HTTPS connections by default; ATS exceptions may indicate insecure network communication |
| Deep Links |
URL schemes that open specific screens within a mobile application, which may bypass normal navigation and authentication flows if not properly validated |
Tools & Systems
- Frida / Objection: Dynamic instrumentation tools for hooking functions, bypassing security controls, and manipulating application behavior at runtime
- MobSF (Mobile Security Framework): Automated static and dynamic analysis platform for Android and iOS applications
- jadx: Android decompiler that converts APK bytecode to readable Java source code for manual code review
- Burp Suite Professional: HTTP proxy for intercepting and modifying mobile app API traffic after bypassing certificate pinning
Common Scenarios
Scenario: Mobile Banking Application Security Assessment
Context: A bank is launching a new mobile banking app for iOS and Android. The app handles account viewing, fund transfers, bill payment, and check deposit. OWASP MASVS L2 compliance is required due to the financial data handled.
Approach:
- Static analysis of the Android APK reveals API endpoints, a hardcoded staging server URL, and an AWS API key in a configuration file
- Certificate pinning is implemented but bypassed with Frida SSL pinning bypass script
- API traffic analysis reveals that the balance check endpoint returns all account numbers associated with the user, not just the requested account
- Local data storage analysis finds that the app caches the last 10 transactions in an unencrypted SQLite database
- Biometric authentication bypass: Frida hook on the biometric callback always returns success, granting access without fingerprint
- Root detection is present but bypassed with Magisk Hide module, allowing the app to run on a rooted device with full data access
Pitfalls:
- Testing only on an emulator and missing hardware-specific security features (Android Keystore hardware backing, iOS Secure Enclave)
- Not testing both iOS and Android versions, as they may have different implementations and different vulnerabilities
- Ignoring the backend API security because it was "tested separately" when the mobile app may call API endpoints differently than the web app
- Failing to test certificate pinning bypass, resulting in an incomplete network analysis
Output Format
## Finding: Biometric Authentication Bypass via Frida Instrumentation
**ID**: MOB-003
**Severity**: High (CVSS 7.7)
**Platform**: Android and iOS
**OWASP MASVS**: MASVS-AUTH-2 (Biometric Authentication)
**Description**:
The mobile banking app's biometric authentication can be bypassed using Frida
dynamic instrumentation. The authentication callback function accepts a boolean
result from the biometric API, which can be hooked and forced to return true
without presenting a valid fingerprint or face scan.
**Proof of Concept (Android)**:
frida -U -f com.bank.mobileapp -l bypass-biometric.js --no-pause
// bypass-biometric.js
Java.perform(function() {
var BiometricCallback = Java.use("com.bank.mobileapp.auth.BiometricCallback");
BiometricCallback.onAuthenticationSucceeded.implementation = function(result) {
console.log("[*] Biometric bypassed");
this.onAuthenticationSucceeded(result);
};
});
**Impact**:
An attacker with physical access to an unlocked device can bypass biometric
authentication and access the victim's bank accounts, initiate transfers,
and view financial data without biometric verification.
**Remediation**:
1. Implement server-side biometric verification using Android BiometricPrompt
CryptoObject tied to a Keystore key
2. Require the biometric operation to decrypt a server-side challenge, making
client-side bypass ineffective
3. Add runtime integrity checks to detect Frida and other instrumentation frameworks
4. Implement step-up authentication for high-risk operations (transfers > threshold)
1---
2name: conducting-mobile-app-penetration-test
3description: 'Conducts penetration testing of iOS and Android mobile applications
4 following the OWASP Mobile Application Security Testing Guide (MASTG) to identify
5 vulnerabilities in data storage, network communication, authentication, cryptography,
6 and platform-specific security controls. The tester performs static analysis of
7 application binaries, dynamic analysis at runtime, and API security testing to evaluate
8 the complete mobile attack surface. Activates for requests involving mobile app
9 pentest, iOS security assessment, Android security testing, or OWASP MASTG assessment.
10
11 '
12domain: cybersecurity
13subdomain: penetration-testing
14tags:
15- mobile-pentest
16- OWASP-MASTG
17- Android-security
18- iOS-security
19- mobile-application-security
20version: 1.0.0
21author: mahipal
22license: Apache-2.0
23nist_ai_rmf:
24- MEASURE-2.7
25- MAP-5.1
26- MANAGE-2.4
27atlas_techniques:
28- AML.T0070
29- AML.T0066
30- AML.T0082
31nist_csf:
32- ID.RA-01
33- ID.RA-06
34- GV.OV-02
35- DE.AE-07
36mitre_attack:
37- T1426
38- T1409
39- T1521.003
40- T1633
41- T1417
42- T1422
43source: https://github.com/mukul975/Anthropic-Cybersecurity-Skills
44source_commit: 04450304b12645cb2b974ab96d28c0664758a88d
45metadata:
46 source: https://skillmd.com/skills/yanacuti1121/conducting-mobile-app-penetration-test
47---
48
49# Conducting Mobile App Penetration Test
50
51## When to Use
52
53- Testing mobile applications before release to identify security vulnerabilities and data protection issues
54- Conducting compliance assessments against OWASP MASVS (Mobile Application Security Verification Standard) levels L1 and L2
55- Evaluating the security of mobile banking, healthcare, or government applications handling sensitive data
56- Testing mobile apps that interact with backend APIs to assess the end-to-end security of the mobile ecosystem
57- Assessing mobile application resistance to reverse engineering, tampering, and runtime manipulation
58
59**Do not use** against mobile applications without written authorization from the application owner, for distributing modified or repackaged applications, or for testing apps on the public app stores without a separate test build.
60
61## Prerequisites
62
63- Target application IPA (iOS) and APK (Android) files or access to download from a private distribution channel
64- Rooted Android device or emulator (Genymotion, Android Studio AVD) with Frida, Objection, and Magisk installed
65- Jailbroken iOS device or Corellium virtual device with Frida, Objection, and SSL Kill Switch installed
66- Static analysis tools: jadx (Android decompilation), Hopper/Ghidra (iOS binary analysis), MobSF (automated scanning)
67- Burp Suite Professional configured as proxy for intercepting mobile app traffic with CA certificate installed on the test device
68
69
70> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.
71
72## Workflow
73
74### Step 1: Static Analysis
75
76Analyze the application binary without executing it:
77
78**Android Static Analysis:**
79- Decompile the APK: `jadx -d output/ target.apk` to obtain Java/Kotlin source code
80- Review `AndroidManifest.xml` for exported components (activities, services, receivers, content providers), permissions, and debuggable flag
81- Search for hardcoded secrets: `grep -rn "api_key\|password\|secret\|token\|aws_" output/`
82- Identify insecure data storage patterns: SharedPreferences with sensitive data, SQLite databases without encryption, files in external storage
83- Check for WebView vulnerabilities: `setJavaScriptEnabled(true)`, `addJavascriptInterface()`, and loading untrusted content
84- Run MobSF automated scan: `python manage.py runserver` and upload the APK for automated static analysis
85
86**iOS Static Analysis:**
87- Extract the IPA and locate the Mach-O binary
88- Use `otool -L <binary>` to list linked frameworks and identify third-party libraries
89- Analyze with Ghidra or Hopper for hardcoded URLs, API endpoints, and embedded credentials
90- Check Info.plist for App Transport Security (ATS) exceptions that allow insecure HTTP connections
91- Review embedded entitlements for excessive capabilities
92
93### Step 2: Network Security Testing
94
95Intercept and analyze all network communications:
96
97- Configure Burp Suite as proxy on the test device and install the Burp CA certificate
98- Exercise all application functionality while Burp captures API traffic
99- **SSL/TLS validation**: Verify the app validates server certificates properly. If the app fails to connect through the proxy, it may implement certificate pinning.
100- **Certificate pinning bypass**:
101 - Android: Use Frida script: `frida -U -f com.target.app -l ssl-pinning-bypass.js --no-pause`
102 - iOS: Use SSL Kill Switch or Objection: `objection -g "Target App" explore --startup-command "ios sslpinning disable"`
103- **API traffic analysis**: Review all API calls for:
104 - Sensitive data transmitted without encryption
105 - Authentication tokens in URL parameters (visible in logs)
106 - Excessive data in API responses beyond what the UI displays
107 - Missing or weak authentication on API endpoints
108- **WebSocket and custom protocols**: Check for non-HTTP communication channels that may bypass standard proxy interception
109
110### Step 3: Data Storage Analysis
111
112Test for insecure local data storage:
113
114**Android Data Storage:**
115- Access app data directory: `/data/data/com.target.app/`
116- Check SharedPreferences XML files for stored credentials, tokens, and PII
117- Examine SQLite databases: `sqlite3 /data/data/com.target.app/databases/*.db ".dump"`
118- Check for sensitive data in application logs: `logcat -d | grep -i "password\|token\|key"`
119- Verify that application data is excluded from backups: `android:allowBackup="false"` in AndroidManifest.xml
120- Check clipboard for sensitive data leakage
121
122**iOS Data Storage:**
123- Examine the Keychain for stored credentials: `objection -g "Target App" explore` then `ios keychain dump`
124- Check NSUserDefaults/plist files: `find /var/mobile/Containers/Data/Application/ -name "*.plist" -exec plutil -p {} \;`
125- Inspect SQLite databases and Core Data stores for unencrypted sensitive data
126- Check for data leaking through screenshots (iOS captures screenshots during app backgrounding)
127- Verify data protection class: sensitive files should use NSFileProtectionComplete
128
129### Step 4: Authentication and Session Management
130
131Test mobile-specific authentication controls:
132
133- **Biometric bypass**: Test if biometric authentication can be bypassed by hooking the authentication callback with Frida to always return success
134- **Token storage**: Verify that authentication tokens are stored in the Keychain (iOS) or Android Keystore, not in SharedPreferences or files
135- **Session timeout**: Verify that sessions expire after a reasonable idle timeout and that tokens are invalidated server-side on logout
136- **Root/jailbreak detection bypass**: Test if the app detects rooted/jailbroken devices and if the detection can be bypassed with Frida or Magisk Hide
137- **Deep link abuse**: Test if custom URL schemes or universal links can be used to bypass authentication or access restricted functionality
138
139### Step 5: Runtime Manipulation
140
141Test the application's resistance to runtime attacks:
142
143- **Frida hooking**: Use Frida to hook and modify application functions at runtime:
144 - Bypass root detection: hook the detection function to return false
145 - Modify return values of authentication checks
146 - Intercept encryption functions to capture plaintext data before encryption
147 - Bypass certificate pinning by hooking SSL verification
148- **Method swizzling** (iOS): Use Frida to replace Objective-C method implementations
149- **Intent manipulation** (Android): Send crafted intents to exported components: `adb shell am start -n com.target.app/.InternalActivity -e "user_id" "admin"`
150- **Tampering detection**: Modify the APK/IPA (add code, change resources), re-sign, and install. Verify whether the app detects tampering.
151
152## Key Concepts
153
154| Term | Definition |
155|------|------------|
156| **OWASP MASTG** | Mobile Application Security Testing Guide; comprehensive manual for mobile app security testing covering both iOS and Android platforms |
157| **Certificate Pinning** | A mobile security control that restricts which TLS certificates the app trusts, preventing man-in-the-middle attacks through proxy interception |
158| **Frida** | Dynamic instrumentation toolkit that allows injection of JavaScript into running processes to hook functions, modify behavior, and bypass security controls |
159| **Root/Jailbreak Detection** | Application-level checks to detect if the device has been modified to grant root access, typically blocking app usage on compromised devices |
160| **Android Keystore** | Hardware-backed credential storage on Android that protects cryptographic keys and secrets from extraction even on rooted devices |
161| **App Transport Security (ATS)** | iOS security feature that enforces HTTPS connections by default; ATS exceptions may indicate insecure network communication |
162| **Deep Links** | URL schemes that open specific screens within a mobile application, which may bypass normal navigation and authentication flows if not properly validated |
163
164## Tools & Systems
165
166- **Frida / Objection**: Dynamic instrumentation tools for hooking functions, bypassing security controls, and manipulating application behavior at runtime
167- **MobSF (Mobile Security Framework)**: Automated static and dynamic analysis platform for Android and iOS applications
168- **jadx**: Android decompiler that converts APK bytecode to readable Java source code for manual code review
169- **Burp Suite Professional**: HTTP proxy for intercepting and modifying mobile app API traffic after bypassing certificate pinning
170
171## Common Scenarios
172
173### Scenario: Mobile Banking Application Security Assessment
174
175**Context**: A bank is launching a new mobile banking app for iOS and Android. The app handles account viewing, fund transfers, bill payment, and check deposit. OWASP MASVS L2 compliance is required due to the financial data handled.
176
177**Approach**:
1781. Static analysis of the Android APK reveals API endpoints, a hardcoded staging server URL, and an AWS API key in a configuration file
1792. Certificate pinning is implemented but bypassed with Frida SSL pinning bypass script
1803. API traffic analysis reveals that the balance check endpoint returns all account numbers associated with the user, not just the requested account
1814. Local data storage analysis finds that the app caches the last 10 transactions in an unencrypted SQLite database
1825. Biometric authentication bypass: Frida hook on the biometric callback always returns success, granting access without fingerprint
1836. Root detection is present but bypassed with Magisk Hide module, allowing the app to run on a rooted device with full data access
184
185**Pitfalls**:
186- Testing only on an emulator and missing hardware-specific security features (Android Keystore hardware backing, iOS Secure Enclave)
187- Not testing both iOS and Android versions, as they may have different implementations and different vulnerabilities
188- Ignoring the backend API security because it was "tested separately" when the mobile app may call API endpoints differently than the web app
189- Failing to test certificate pinning bypass, resulting in an incomplete network analysis
190
191## Output Format
192
193```
194## Finding: Biometric Authentication Bypass via Frida Instrumentation
195
196**ID**: MOB-003
197**Severity**: High (CVSS 7.7)
198**Platform**: Android and iOS
199**OWASP MASVS**: MASVS-AUTH-2 (Biometric Authentication)
200
201**Description**:
202The mobile banking app's biometric authentication can be bypassed using Frida
203dynamic instrumentation. The authentication callback function accepts a boolean
204result from the biometric API, which can be hooked and forced to return true
205without presenting a valid fingerprint or face scan.
206
207**Proof of Concept (Android)**:
208frida -U -f com.bank.mobileapp -l bypass-biometric.js --no-pause
209
210// bypass-biometric.js
211Java.perform(function() {
212 var BiometricCallback = Java.use("com.bank.mobileapp.auth.BiometricCallback");
213 BiometricCallback.onAuthenticationSucceeded.implementation = function(result) {
214 console.log("[*] Biometric bypassed");
215 this.onAuthenticationSucceeded(result);
216 };
217});
218
219**Impact**:
220An attacker with physical access to an unlocked device can bypass biometric
221authentication and access the victim's bank accounts, initiate transfers,
222and view financial data without biometric verification.
223
224**Remediation**:
2251. Implement server-side biometric verification using Android BiometricPrompt
226 CryptoObject tied to a Keystore key
2272. Require the biometric operation to decrypt a server-side challenge, making
228 client-side bypass ineffective
2293. Add runtime integrity checks to detect Frida and other instrumentation frameworks
2304. Implement step-up authentication for high-risk operations (transfers > threshold)
231```