Logo
Mobile App Pentesting

Static vs Dynamic Analysis in Mobile App Security

Static vs Dynamic Analysis in Mobile App Security

Short answer: Static analysis examines a mobile app's code, configuration, and binary without running it — catching hardcoded secrets, insecure manifest settings, and cryptographic flaws. Dynamic analysis tests the app while it runs, catching runtime data exposure, authentication bypass, and traffic vulnerabilities that static inspection misses. A thorough mobile security assessment uses both.

TL;DR: Static analysis is fast and safe but blind to runtime behavior; dynamic analysis requires a running environment but catches what static misses. Use static first to eliminate obvious issues, then dynamic to validate real-world exploitability.

Key Takeaways - Static analysis (SAST) inspects the binary and source without execution — ideal for code review, manifest audits, and hardcoded secret detection. - Dynamic analysis (DAST) exercises the running app — ideal for runtime data storage, authentication logic, and live traffic analysis. - MobSF's static analyzer achieves a vendor-reported 97% detection rate (MobSF GitHub) for common vulnerability patterns, but still misses runtime-only flaws. - OWASP MASTG maps specific test cases to each approach — use it to ensure no control area is left untested. - Neither method alone is sufficient for a complete assessment; the Android penetration testing methodology combines both in a structured sequence.

Why the distinction matters

Why the distinction matters

Most mobile security tools advertise "automated scanning," which blurs the line between what is actually being tested. Understanding the boundary between static and dynamic analysis helps you: - Choose the right tool for a specific question - Know which findings need runtime validation before reporting - Explain your methodology to clients and developers clearly

OWASP's Mobile Application Security Testing Guide (MASTG) explicitly categorizes every test as either static (SAST) or dynamic (DAST). Following that structure ensures your assessment covers the full MASVS control set.

Static analysis: what it is and what it finds

Static analysis: what it is and what it finds

Static analysis (SAST — Static Application Security Testing) examines the app without executing it. For mobile apps this means: - Decompiling or disassembling the APK (Android) or IPA (iOS) binary - Reading the manifest files and configuration - Inspecting decompiled Java/Kotlin or Objective-C/Swift source code - Scanning for known-bad patterns: hardcoded secrets, weak cryptography, dangerous API calls

What static analysis reliably finds

Vulnerability class Why static analysis works
Hardcoded API keys, passwords, tokens Strings are present in decompiled source regardless of runtime
Insecure manifest permissions (Android) Manifest is readable from the APK without execution
Weak cryptographic algorithms (MD5, ECB mode) Algorithm choice appears in source code
Exported components without permission checks Declared in manifest and confirmed in source
Insecure WebView configuration setJavaScriptEnabled, addJavascriptInterface visible in source
Plaintext HTTP URLs String literals in source code and network security config
Missing binary protections (no obfuscation, no root detection) Binary structure and string analysis

Static analysis tools

MobSF (Mobile Security Framework) is the most widely used open-source automated static analyzer for Android and iOS. It decompiles the APK, analyzes the manifest, scans for dangerous API usage, and produces a scored report. With 21,000+ GitHub stars and an active development cycle, it is the de facto starting point for automated static analysis.

# Run MobSF static scan via CLI
docker run -it --rm -p 8000:8000 opensecurity/mobile-security-framework-mobsf:latest

# Upload APK via the web UI at http://localhost:8000
# Or use the REST API
curl -F "[email protected]" http://localhost:8000/api/v1/upload \
  -H "Authorization: <api_key>"

Apktool handles APK decoding and repackaging — essential for manifest review and resource inspection:

apktool d target.apk -o target_decoded/

jadx decompiles Dalvik bytecode to readable Java, making manual code review practical:

jadx -d target_source/ target.apk

What static analysis cannot find

Static analysis has real blind spots: - Runtime data storage: an app may write a token to a file only under specific conditions - Authentication logic flaws: a broken session check only manifests when the app runs against a real server - Conditional behavior: code paths that are only triggered by specific user actions or server responses - Certificate pinning bypass complexity: pinning is visible statically, but its actual effectiveness needs runtime validation

Dynamic analysis: what it is and what it finds

Dynamic analysis: what it is and what it finds

Dynamic analysis (DAST — Dynamic Application Security Testing) tests the app while it is running on a device or emulator. It monitors runtime behavior, intercepts network traffic, hooks into app processes, and inspects the device file system for data written during operation.

What dynamic analysis reliably finds

Vulnerability class Why dynamic analysis works
Sensitive data in plaintext on disk Inspect file system after app runs
Sensitive data in device logs ADB logcat captures real-time log output
Broken authentication and session management Test actual login and session flows against a live server
Runtime SSL pinning behavior Confirm whether pinning can be bypassed with Frida
Insecure intent handling Send crafted intents via ADB while app is running
Runtime key and credential exposure Memory inspection with Frida
Live traffic vulnerabilities Intercept and modify actual HTTP/S requests

Dynamic analysis tools

Frida is the standard dynamic instrumentation toolkit for mobile security. It injects a JavaScript engine into a running process, letting you hook methods, inspect arguments and return values, and bypass runtime defenses:

# List running processes on connected device
frida-ps -U

# Hook a specific method at runtime
frida -U -f com.target.app \
  -l my_hook_script.js --no-pause

objection provides a Frida-based CLI that wraps common mobile security tasks without requiring you to write Frida scripts from scratch:

objection -g com.target.app explore

# From the objection prompt:
android sslpinning disable
android hooking list activities
android memory search "<pattern>"

Burp Suite remains the primary tool for HTTP/S traffic interception in dynamic analysis. Configure a proxy on the test device and route all traffic through Burp for inspection and modification.

Vulnerability classes detected by static analysis versus dynamic analysis A grouped bar chart showing that static analysis detects hardcoded secrets, manifest misconfigurations, and weak crypto well, while dynamic analysis excels at runtime data storage, authentication flaws, and traffic vulnerabilities. Static vs dynamic: detection coverage by vulnerability class Static (SAST) Dynamic (DAST) Detection effectiveness → Hardcoded secrets High Low Runtime data storage Low High Auth & session flaws Med High Based on OWASP MASTG test case categorization and practitioner assessment experience.
Figure 1. Static analysis excels at code-level findings; dynamic analysis is required for runtime and behavioral vulnerabilities.
Vulnerability class Static analysis Dynamic analysis
Hardcoded secrets High detection Low (runtime-only if obfuscated)
Manifest misconfigurations High detection Not applicable
Weak cryptographic algorithms High detection Partial (confirm exploitability)
Runtime plaintext data storage Not detectable High detection
Authentication and session flaws Partial (code review) High detection (live testing)
Traffic interception (missing TLS) Partial (config review) High detection (Burp interception)
Root/jailbreak bypass Partial (detection code visible) High detection (confirm bypass)
Logic flaws and business logic Very limited High detection

Based on OWASP MASTG test case categorization. Detection rates are tool-dependent.

How to combine both in a real assessment

The Android penetration testing methodology and the beginner guide to starting mobile application penetration testing both recommend running static analysis first, then using findings as hypotheses to validate through dynamic analysis.

  1. Run MobSF static scan on the APK — get the automated baseline in 5–10 minutes
  2. Manual static review with jadx — focus on cryptography, authentication code, and WebView config
  3. Set up dynamic test environment — rooted device or emulator, Burp proxy, Frida server
  4. Validate static findings at runtime — confirm hardcoded credentials work, verify manifest misconfigs are exploitable
  5. Dynamic-only testing — test authentication flows, session handling, deep links, intent handling, and traffic

Static analysis without dynamic validation can produce false positives. Dynamic analysis without prior static review misses code-level issues and wastes time. Combining them produces a defensible, complete assessment. See the MobSF and Apktool guide for a full setup walkthrough.

Frequently asked questions

What is the difference between static and dynamic analysis in mobile security?

Static analysis examines the app's binary and source code without running it — finding hardcoded secrets, manifest misconfigurations, and insecure cryptographic choices. Dynamic analysis tests the running app on a device, finding runtime data exposure, authentication logic flaws, and live traffic vulnerabilities. A complete mobile security assessment uses both in sequence.

Which is better: static or dynamic analysis for mobile apps?

Neither is better in isolation — they are complementary. Static analysis is faster and works without a test device, but misses runtime behavior. Dynamic analysis validates real exploitability but requires a running environment and takes more time. For OWASP MASVS-aligned testing, both are required.

Can MobSF do both static and dynamic analysis?

Yes. MobSF includes a static analyzer that works on Android APKs, iOS IPAs, and Windows apps, and a dynamic analyzer for Android. However, MobSF's dynamic analysis does not support iOS DAST. For iOS dynamic testing, Frida and objection are the standard tools. MobSF's static analyzer achieves a vendor-reported 97% detection rate (MobSF GitHub) for common vulnerability patterns.

Do I need a rooted device for dynamic analysis?

For full dynamic analysis coverage — including installing custom CA certificates for traffic interception, running Frida server, and inspecting app-private directories — a rooted device or rooted emulator is strongly recommended. On Android 7+, user CA certificates are not trusted by apps by default, making traffic interception impractical without root or APK patching.


ThreatBlock's mobile app pentesting course covers Android and iOS security testing hands-on.

About the author: Samaksh is Lead Instructor at ThreatBlock and holds the OSCP, CRTP, CRTO, and CEH certifications, with hands-on experience in penetration testing and red teaming. Read more on the author page · Editorial policy.

← Back to all articles
{{ toast }}