📋 What Is It?
Security Misconfiguration occurs when mobile applications are deployed with insecure default settings, incomplete configurations, or overly permissive security controls. This includes debug flags in production, exposed backup files, insecure app transport settings, improper component exports, and misconfigured cloud services. Configuration errors are often overlooked but create significant vulnerabilities.
M08
OWASP Rank
76%
Apps Misconfigured
<1hr
Time to Exploit
⚠️ Common Misconfigurations
- Debug Mode Enabled: Production apps with debug flags active
- Exported Components: Activities/Services accessible to other apps
- Backup Allowed: Sensitive data included in device backups
- WebView Misconfig: JavaScript enabled unnecessarily
- Insecure Deeplinks: Unvalidated URL schemes
- Cloud Storage Public: S3 buckets or Firebase databases open
🔴 Attack Flow
1. Attacker analyzes AndroidManifest.xml
↓
2. Finds debuggable=true in production
↓
3. Attaches debugger to running app
↓
4. Extracts encryption keys from memory
↓
5. BREACH: Full app compromise!
↓
2. Finds debuggable=true in production
↓
3. Attaches debugger to running app
↓
4. Extracts encryption keys from memory
↓
5. BREACH: Full app compromise!
❌ Vulnerable Code
// Bad: Debug mode in production (Android)
// AndroidManifest.xml
<application
android:debuggable="true" <!-- VULNERABLE: Allows debugging in production -->
android:allowBackup="true" <!-- VULNERABLE: Data in backups -->
android:usesCleartextTraffic="true"> <!-- VULNERABLE: HTTP allowed -->
<!-- VULNERABLE: Activity exported without protection -->
<activity
android:name=".AdminActivity"
android:exported="true" />
<!-- VULNERABLE: Broadcast receiver accessible -->
<receiver
android:name=".PaymentReceiver"
android:exported="true" />
<!-- VULNERABLE: Unprotected intent filter -->
<activity android:name=".DeepLinkActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" />
</intent-filter>
</activity>
</application>
// Bad: Insecure WebView (Android)
WebView webView = findViewById(R.id.webview);
// VULNERABLE: JavaScript enabled for all content
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setAllowContentAccess(true);
// VULNERABLE: No restrictions
webView.addJavascriptInterface(new WebAppInterface(), "Android");
// Bad: Insecure ATS (iOS)
// Info.plist
<key>NSAppTransportSecurity</key>
<dict>
<!-- VULNERABLE: Disables ATS entirely -->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
// Bad: Public cloud storage
// Firebase Realtime Database rules
{
"rules": {
".read": true, // VULNERABLE: Anyone can read
".write": true // VULNERABLE: Anyone can write
}
}
✅ Secure Code
// Good: Secure production config (Android)
// AndroidManifest.xml
<application
android:debuggable="false" <!-- No debugging in production -->
android:allowBackup="false" <!-- Prevent backup of sensitive data -->
android:fullBackupContent="@xml/backup_rules"
android:usesCleartextTraffic="false" <!-- Enforce HTTPS -->
android:networkSecurityConfig="@xml/network_security_config">
<!-- Good: Protected activity -->
<activity
android:name=".AdminActivity"
android:exported="false" /> <!-- Not accessible externally -->
<!-- Good: Protected with permission -->
<receiver
android:name=".PaymentReceiver"
android:exported="true"
android:permission="com.myapp.PAYMENT_PERMISSION" />
<!-- Good: Validated deep links -->
<activity android:name=".DeepLinkActivity">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="myapp.com" />
</intent-filter>
</activity>
</application>
// res/xml/backup_rules.xml
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<!-- Exclude sensitive files from backup -->
<exclude domain="sharedpref" path="secure_prefs.xml" />
<exclude domain="database" path="sensitive.db" />
<exclude domain="file" path="keys/" />
</full-backup-content>
// Good: Secure WebView configuration (Android)
WebView webView = findViewById(R.id.webview);
WebSettings settings = webView.getSettings();
// Disable JavaScript unless absolutely necessary
settings.setJavaScriptEnabled(false);
// If JavaScript needed, restrict access
settings.setAllowFileAccess(false);
settings.setAllowContentAccess(false);
settings.setAllowFileAccessFromFileURLs(false);
settings.setAllowUniversalAccessFromFileURLs(false);
// Only add JavaScript interface if absolutely needed
// And use @JavascriptInterface annotation
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
webView.addJavascriptInterface(new SecureWebInterface(), "Android");
}
// Good: Selective ATS exceptions (iOS)
// Info.plist - Only disable for specific domains if needed
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>legacy-api.example.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
</dict>
</dict>
</dict>
// Good: Secure Firebase rules
{
"rules": {
".read": false, // Default deny
".write": false,
"users": {
"$uid": {
// Users can only read/write their own data
".read": "auth != null && auth.uid == $uid",
".write": "auth != null && auth.uid == $uid"
}
}
}
}
// Good: Build-specific configuration
buildTypes {
debug {
debuggable true
applicationIdSuffix ".debug"
}
release {
debuggable false
minifyEnabled true
shrinkResources true
}
}
✓ Prevention Checklist
- Disable debug mode in production builds
- Set android:exported="false" for internal components
- Disable allowBackup or exclude sensitive files
- Configure Network Security Config properly
- Minimize WebView capabilities (disable JS if possible)
- Implement proper App Transport Security (iOS)
- Secure cloud storage with authentication/authorization
- Validate and sanitize deep link inputs
- Remove development/test configurations before release
- Regular security configuration audits
🔍 Detection & Tools
Analysis Tools:
MobSF
Drozer
AndroBugs
QARK
apktool
Manifest Scanner
Cloud Security:
AWS Config
Firebase Security Rules
ScoutSuite
Prowler
How to Test:
- Extract and analyze AndroidManifest.xml or Info.plist
- Check for debuggable=true in production APKs
- Test exported components with Drozer
- Verify backup configurations on device
- Test WebView with XSS payloads
- Audit Firebase/S3 permissions
🌍 Real-World Breaches
- Uber (2016): Debug mode left enabled, allowed code injection
- Multiple Apps (2019): Exposed Firebase databases leaked millions of records
- Government App (2020): Exported components allowed unauthorized access
- Dating App (2018): Backup files exposed user credentials
- Banking Apps (2019): WebView misconfigurations enabled XSS attacks
📌 Quick Tips
- DO NOT ship production apps with debuggable=true
- DO NOT export components unnecessarily
- DO NOT disable App Transport Security globally
- DO review manifest/plist before each release
- DO secure cloud storage with proper rules
- DO automate configuration security checks in CI/CD
📜 Compliance
Related Standards:
- PCI-DSS Requirement 2.2
- NIST 800-53 CM-6, CM-7
- OWASP MASVS MSTG-PLATFORM-1, 2
- CWE CWE-16, CWE-200
- ISO 27001 A.12.6.1
- CIS Mobile Device Benchmarks