Mobile security knowledge pack (Flutter, React Native/Expo, iOS Swift, Android Kotlin). Load when writing or reviewing local storage, Keychain/Keystore, biometrics, networking and certificate pinning, ATS/network_security_config, exported components and Intents, deep links, WebView bridges, OTA hot updates, obfuscation and root/jailbreak detection, permissions and privacy SDKs. Organized by OWASP MASVS v2; mandatory for wallet/financial apps.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Sec Mobile?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/57blocks-sec-mobile-c5b00116)
---
name: sec-mobile
description: >-
Mobile security knowledge pack (Flutter, React Native/Expo, iOS Swift, Android Kotlin). Load when writing or reviewing local storage, Keychain/Keystore,
biometrics, networking and certificate pinning, ATS/network_security_config, exported components and Intents, deep links, WebView bridges, OTA hot updates,
obfuscation and root/jailbreak detection, permissions and privacy SDKs. Organized by OWASP MASVS v2; mandatory for wallet/financial apps.
globs: ["**/pubspec.yaml", "**/AndroidManifest.xml", "**/*.xcodeproj/**", "**/Info.plist", "**/*.swift", "**/*.kt", "**/app.json", "**/metro.config.js"]
user-invocable: false
---
# sec-mobile: Mobile security checklist
## Scope
Client code, manifests and build configuration of native iOS / Android and cross-platform (Flutter, React Native, Expo) apps. Issues in the backend API itself are covered by `sec-web`.
## Read first
- Severity definitions: [severity.md](../sec-core/severity.md). **Private key / funds issues are at least P1**; defense-in-depth items (root detection, obfuscation, integrity attestation) default to P2/P3 and may be raised one level for wallet/payment apps with a stated reason.
- Backend issues are not repeated here: trusting client identity [WEB-01/02](../sec-web/SKILL.md), JWT and token lifecycle WEB-08–11, OAuth WEB-14, hardcoded secrets WEB-42, crypto misuse and disabled TLS verification WEB-46/47, dependencies WEB-55, PII in logs WEB-56.
- Wallet keys and signing: [sec-wallet-dapp](../sec-wallet-dapp/SKILL.md) WAL-01 (entropy), WAL-02/03 (key storage), WAL-05 (in-memory residency), WAL-06 (log reporting), WAL-07 (clipboard), WAL-08 (screenshots/keyboard), WAL-09 (backup export), WAL-14 (embedded wallet message boundary), WAL-15–27 (signing display). This pack covers **platform mechanisms** only; WAL items are authoritative for wallet semantics.
- Framework specifics (mandatory when writing for that stack):
[Flutter](refs/flutter.md) · [React Native / Expo](refs/react-native-expo.md) · [iOS / Swift](refs/ios-swift.md) · [Android / Kotlin](refs/android-kotlin.md)
## Hard defaults when writing code (AI-generated code must follow these)
1. **No secrets in the app package**: anything baked into IPA/APK/AAB, Dart AOT, the JS bundle, `Info.plist`, `BuildConfig` or a bundled `.env` is public; third-party secret keys live only on the backend.
2. Tokens, passwords and private keys go only into Keychain / Android Keystore-wrapped storage; never into `SharedPreferences`, `UserDefaults`, `AsyncStorage`, unencrypted MMKV/Hive, or logs.
3. Do not disable TLS verification or add ATS/cleartext exceptions to "fix an error"; for intranet/self-signed certificates use `debug-overrides` or Debug-only configuration.
4. Biometrics must unlock a Keystore/Keychain key (`CryptoObject` / `SecAccessControl`), not just check a `true/false` result.
5. Authorization, limits, OTP verification, and membership/admin decisions all happen server-side; the client only handles UX.
6. Android components default to `exported="false"`; `PendingIntent` defaults to `FLAG_IMMUTABLE`; treat deep link parameters as untrusted input.
7. WebView defaults to JS off and file access off; when a JS bridge is needed, expose minimal methods only to allowlisted origins and never expose signing/key-retrieval capabilities.
8. Release builds: not debuggable, WebView debugging off, R8/`--obfuscate` on, logs stripped, OTA updates must be signature-verified.
---
## Checklist
### A. Storage (MASVS-STORAGE-1/2)
### MOB-01 Sensitive data in plaintext key-value storage · default P1 (P0 for private keys/mnemonics, see WAL-02)
- **What to look for**: `SharedPreferences`/`DataStore`, `UserDefaults`/`@AppStorage`, RN `AsyncStorage`, `react-native-mmkv` without `encryptionKey`, Flutter `shared_preferences`/`get_storage`/unencrypted Hive box, `redux-persist` persisting state that contains tokens, writing `token|refresh|password|pin|secret|cookie|session`.
- **How to confirm**: search for the intersection of storage APIs and sensitive key names; on an emulator run `adb shell run-as <pkg> cat shared_prefs/*.xml`, read `Library/Preferences/*.plist`.
- **False positives**: only non-sensitive preferences are stored (theme, language, onboarding-complete flag).
- **Fix**: put tokens in Keychain/Keystore-wrapped storage (`flutter_secure_storage`, `expo-secure-store`, `react-native-keychain`, iOS `SecItemAdd`).
- **Source**: OWASP MASVS-STORAGE-1; mukul975/Anthropic-Cybersecurity-Skills@54a79883 exploiting-insecure-data-storage-in-mobile; affaan-m/ECC@b38be6a7 .cursor/rules/swift-security.md "Secret Management"
### MOB-02 Improper iOS Keychain accessibility class and access control · default P2 (P1 for wallet keys)
- **What to look for**: `kSecAttrAccessibleAlways*` (deprecated); `AfterFirstUnlock` used for high-value items; missing `ThisDeviceOnly`, so items migrate with encrypted backups/new devices; `kSecAttrSynchronizable = true` syncing to iCloud Keychain; high-value items without `SecAccessControl` (`.biometryCurrentSet`/`.userPresence`).
- **How to confirm**: inspect the `SecItemAdd` dictionary or wrapper library options; on a jailbroken device use Objection `ios keychain dump` to view attributes.
- **False positives**: low-value tokens that background refresh must read while locked use `AfterFirstUnlockThisDeviceOnly` (must be justified).
- **Fix**:
```swift
let ac = SecAccessControlCreateWithFlags(nil, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, .biometryCurrentSet, nil)!
let q: [String: Any] = [kSecClass as String: kSecClassGenericPassword, kSecAttrAccount as String: "seed",
kSecAttrAccessControl as String: ac, kSecValueData as String: data]
```
- **Source**: OWASP MASVS-STORAGE-1, MASVS-CRYPTO-2; Apple Developer Documentation "Restricting keychain item accessibility"; mukul975/Anthropic-Cybersecurity-Skills@54a79883 performing-ios-app-security-assessment
### MOB-03 Android Keystore misuse / reliance on deprecated EncryptedSharedPreferences · default P2 (P1 for wallet keys)
- **What to look for**: a self-generated AES key Base64-encoded into prefs (key stored next to ciphertext); not using the `AndroidKeyStore` provider; high-value keys without `setUserAuthenticationRequired` and no attempt at `setIsStrongBoxBacked`; new code pulling in `androidx.security:security-crypto` (**all APIs deprecated** since 1.1.0-alpha07; the official guidance is to use platform APIs + Keystore directly); `react-native-encrypted-storage` (no releases since 2022, built on EncryptedSharedPreferences).
- **Also check**: raw key material written as files counts as "key stored next to ciphertext" on both platforms: vault keys or TLS CA private keys as files in iOS `Documents`/`Library` (also included in backups) or Android `filesDir`, instead of Keychain/Keystore-wrapped storage (P1 when the key protects the user's vault or MitM-capable CA). Key generation, unwrap and load must fail closed: a `catch` that logs and returns `null`/an empty key, after which callers store or encrypt without a valid key, is a finding (P2; P1 if data is then written unencrypted). Source: Tella 3.0 audit https://tella-app.org/fr/assets/files/2026.07%20-%20Horizontal%20x%20Convocation%20Research+Design%20%20A%20Comprehensive%20Security%20Audit%20for%20Tella%203.0.0+-88536eebfe781b0c58f5df54006b3c51.pdf TELLA3-008, TELLA3-004; Ceno/Ouinet https://7asecurity.com/reports/pentest-ouinet-ceno-RC1.2b.pdf OUI-01-010
- **How to confirm**: search for `KeyGenParameterSpec`, `KeyStore.getInstance("AndroidKeyStore")`, `EncryptedSharedPreferences`, `MasterKey`.
- **False positives**: existing code using EncryptedSharedPreferences with no known vulnerability: still functional, record a P3 migration recommendation, do not report high.
- **Fix**: generate a non-exportable AES-GCM key in Keystore and use it to encrypt data stored in DataStore/files; or use a maintained wrapper (`flutter_secure_storage` v10+ has moved off Jetpack Security).
```kotlin
KeyGenParameterSpec.Builder("k", PURPOSE_ENCRYPT or PURPOSE_DECRYPT)
.setBlockModes(BLOCK_MODE_GCM).setEncryptionPaddings(ENCRYPTION_PADDING_NONE).setKeySize(256).build()
```
- **Source**: OWASP MASVS-CRYPTO-2; AndroidX Security release notes (security-crypto 1.1.0-alpha07, 2025-04-09); Android Developers "Android Keystore system"
### MOB-04 Data left behind after reinstall and logout · default P2
- **What to look for**: iOS Keychain items survive uninstall, so after reinstall the app is automatically "logged in" or reuses the old wallet; logout/account switch clears memory only, not Keychain/DB/WebView cookies/cached images/push token binding.
- **How to confirm**: log in → uninstall → reinstall and check whether login is skipped; after A logs out and B logs in, check whether B can see A's data.
- **False positives**: the product explicitly requires restoring the wallet after reinstall (with user re-authentication to unlock).
- **Fix**: on first launch (no `hasLaunched` flag in `UserDefaults`) delete this app's Keychain items; a single logout cleanup function covers all storage and calls server-side revocation.
- **Source**: cloudflare/security-audit-skill@c1c8a8c1 DESKTOP-MOBILE-AND-LOCAL-IPC.md "Account switch, logout, and device restore leakage"; OWASP MASVS-STORAGE-2
### MOB-05 Local databases and files unencrypted or with wrong protection class · default P2 (P1 when containing ID documents/transaction details/tokens)
- **What to look for**: SQLite/Room/Core Data/Realm/Hive/sqflite storing PII, chats or transaction records in plaintext; files written to Android external storage (`getExternalStorageDirectory`, `requestLegacyExternalStorage`); `MODE_WORLD_READABLE`, `setReadable(true,false)`; iOS files without `.completeFileProtection`.
- **Also check**: pass the SQLCipher/Realm key as `byte[]`/`char[]` through the library's key API (not a `String` interpolated into `PRAGMA key`/SQL) and wipe it after opening. Source: Tella 3.0 audit https://tella-app.org/fr/assets/files/2026.07%20-%20Horizontal%20x%20Convocation%20Research+Design%20%20A%20Comprehensive%20Security%20Audit%20for%20Tella%203.0.0+-88536eebfe781b0c58f5df54006b3c51.pdf TELLA3-012
- **How to confirm**: export `databases/` and `Documents/` from an emulator; Lint `WorldReadableFiles`, `SetWorldReadable`, `SensitiveExternalPath`.
- **False positives**: cached public data (market prices, announcements).
- **Fix**: SQLCipher (`sqflite_sqlcipher`, `net.zetetic:sqlcipher-android`) or Realm encryption with the key in Keystore/Keychain; iOS `try data.write(to: url, options: .completeFileProtection)`; use only app-private directories.
- **Source**: OWASP MASVS-STORAGE-1; mukul975/Anthropic-Cybersecurity-Skills@54a79883 exploiting-insecure-data-storage-in-mobile "Analyze SQLite Databases"
### MOB-06 Backup and device migration carry out sensitive data · default P2 (P1 for wallet files/keys)
- **What to look for**: `android:allowBackup` omitted (defaults to true) with no `dataExtractionRules`/`fullBackupContent` exclusions; with targetSdk 31+, `allowBackup="false"` **no longer blocks device-to-device transfer**, which must be excluded under `<device-transfer>` in `dataExtractionRules`; iOS `Documents/` and `Application Support/` go into iCloud/computer backups by default without `isExcludedFromBackup`.
- **How to confirm**: check the merged manifest (`build/intermediates/merged_manifests`); Lint `DataExtractionRules`, `AllowBackup`.
- **False positives**: all backed-up content is encrypted with a non-exportable Keystore key (it cannot be decrypted after restore; that is an availability issue).
- **Fix**:
```xml
<application android:allowBackup="false" android:dataExtractionRules="@xml/data_extraction_rules" ...>
<!-- data_extraction_rules.xml: <cloud-backup><exclude domain="sharedpref" path="."/>...</cloud-backup>
<device-transfer><exclude domain="database" path="."/>...</device-transfer> -->
```
- **Source**: OWASP MASVS-STORAGE-2; Android Developers "Back up user data with Auto Backup", "Behavior changes: Apps targeting Android 12"
### MOB-07 Logs and crash reporting leak data in release builds · default P2 (P1 for tokens/passwords/mnemonics in logs; mnemonics see WAL-06)
- **What to look for**: `Log.d/i`, `println`, `NSLog`, `print` (Flutter `print`/`debugPrint` still write to logcat in release), RN `console.log` (writes to the system log in release), OkHttp `HttpLoggingInterceptor.Level.BODY`, Dio `LogInterceptor`, Alamofire event logging enabled in release; Crashlytics/Sentry custom keys carrying tokens.
- **How to confirm**: run the login flow on a release build and watch `adb logcat` / Console.app; Lint `LogInfoDisclosure` (requires the security lint library).
- **False positives**: log calls wrapped in `if (BuildConfig.DEBUG)`/`kDebugMode`/`__DEV__` or removed by R8/a babel plugin.
- **Fix**: R8 `-assumenosideeffects class android.util.Log { *; }`; RN `babel-plugin-transform-remove-console`; iOS `os_log` with `%{private}@`; network logging in Debug builds only; scrub in Sentry `beforeSend` (WEB-56).
- **Source**: OWASP MASVS-STORAGE-2; affaan-m/ECC@b38be6a7 agents/flutter-reviewer.md "Sensitive logging"; Android Lint LogInfoDisclosure
### MOB-08 Screenshots, screen recording and background snapshots · default P2 (P2 for wallet/payment screens, WAL-08)
- **What to look for**: mnemonic, private key, card number, OTP or balance screens without Android `FLAG_SECURE`; iOS `sceneWillResignActive`/`applicationWillResignActive` adds no overlay, so the app switcher snapshot shows sensitive content; iOS does not observe `UIScreen.capturedDidChangeNotification` to handle recording/mirroring.
- **How to confirm**: take a screenshot on a sensitive screen, background the app and check the multitasking preview, start screen recording.
- **False positives**: screens with no sensitive content.
- **Fix**: `window.setFlags(FLAG_SECURE, FLAG_SECURE)` (sensitive screens only is enough); on iOS cover with a blur view when resigning active and hide content when `isCaptured`. iOS has no official screenshot-blocking API, so rely on masking.
- **Source**: OWASP MASVS-PLATFORM-3; sec-wallet-dapp WAL-08
### MOB-09 Clipboard leakage · default P2 (WAL-07)
- **What to look for**: copying OTPs/mnemonics/private keys/tokens; iOS `UIPasteboard.general.string = secret` without `localOnly` and expiration (Universal Clipboard syncs to Macs on the same account); Android not marking content as sensitive (13+ shows clipboard previews); reading the clipboard silently at launch.
- **How to confirm**: inspect the copy implementation; on iOS 16+ reading the clipboard triggers a system prompt, which is a useful signal.
- **False positives**: only public addresses are copied (but pasted addresses need full re-verification, see WAL-07/40).
- **Fix**:
```kotlin
clip.description.extras = PersistableBundle().apply { putBoolean(ClipDescription.EXTRA_IS_SENSITIVE, true) }
```
iOS `UIPasteboard.general.setItems([[UTType.plainText.identifier: s]], options: [.localOnly: true, .expirationDate: Date().addingTimeInterval(60)])`.
- **Source**: OWASP MASVS-STORAGE-2, MASVS-PLATFORM-3; mukul975/Anthropic-Cybersecurity-Skills@54a79883 performing-ios-app-security-assessment (pasteboard monitor)
### MOB-10 Keyboard cache, third-party keyboards and autofill · default P3 (P2 for mnemonic/private key input)
- **What to look for**: mnemonic/password fields with autocorrect and predictive input enabled; iOS not rejecting third-party keyboards; Android without `textNoSuggestions`/`importantForAutofill="no"`; Flutter `TextField` without disabling `enableSuggestions`/`autocorrect`.
- **How to confirm**: after typing, check whether keyboard suggestions have learned the content.
- **False positives**: ordinary text fields.
- **Fix**: iOS `autocorrectionType = .no`, `spellCheckingType = .no`, `isSecureTextEntry`; AppDelegate `shouldAllowExtensionPointIdentifier` returns `false` for `.keyboard` (wallets); Android `inputType="textPassword|textNoSuggestions"`; Flutter `autocorrect: false, enableSuggestions: false`.
- **Source**: OWASP MASVS-STORAGE-2; sec-wallet-dapp WAL-08
### MOB-11 Notifications, widgets and lock screen expose sensitive content · default P3 (P2 for OTPs/balances/transaction verification codes)
- **What to look for**: push bodies containing OTPs, full balances or counterparties; iOS Widgets/Live Activities, Android lock screen notifications with `VISIBILITY_PUBLIC`; notification actions ("Confirm transaction") executable directly from the lock screen.
- **How to confirm**: trigger a push / view widgets while the device is locked.
- **False positives**: content is only "You have a new message".
- **Fix**: push carries only an ID and the app fetches details; Android `setVisibility(VISIBILITY_PRIVATE)` + `setPublicVersion`; sensitive notification actions require unlock (iOS `.authenticationRequired`).
- **Source**: cloudflare/security-audit-skill@c1c8a8c1 DESKTOP-MOBILE-AND-LOCAL-IPC.md "Pending-action and user-presence confusion"; OWASP MASVS-PLATFORM-3
### MOB-12 HTTP cache, WebView storage and temp files left behind · default P3
- **What to look for**: `URLCache` caching API responses with PII (`Cache.db`); OkHttp `Cache` caching responses with `Authorization`; WebView localStorage/cookies retained after logout; exported PDFs/images left in `tmp`/`cache`/photo library.
- **How to confirm**: after logout, inspect `Library/Caches`, `app_webview/`, `cache/`.
- **False positives**: responses already carry `Cache-Control: no-store`.
- **Fix**: server sends `Cache-Control: no-store` on sensitive endpoints; iOS uses `URLSessionConfiguration.ephemeral` for sensitive sessions; on logout call `WKWebsiteDataStore.removeData`, `CookieManager.removeAllCookies`; delete temp files after use.
- **Source**: OWASP MASVS-STORAGE-2; mukul975/Anthropic-Cybersecurity-Skills@54a79883 exploiting-insecure-data-storage-in-mobile
### B. Cryptography (MASVS-CRYPTO-1/2)
### MOB-13 Secrets bundled into the app · default P0 (production third-party secrets / cloud credentials / signing keys)
- **What to look for**: Dart constants, `--dart-define`, the `.env` asset of `flutter_dotenv`; RN `react-native-config`, `EXPO_PUBLIC_*`, `extra` in `app.json`; values injected via `BuildConfig`/`gradle.properties`, `strings.xml`; `Info.plist`, `.xcconfig`, Swift constants; containing Stripe `sk_live`, OpenAI keys, AWS AK/SK, backend HMAC signing keys, admin tokens, private keys, keystore passwords.
- **How to confirm**: run gitleaks on source; on artifacts `unzip app.apk && strings lib/*/libapp.so | grep -E 'sk_live|AKIA'`, `index.android.bundle`, `Info.plist` inside the IPA.
- **False positives**: client identifiers that are public by design and restricted server-side: Firebase `apiKey` (requires correct Security Rules), Google Maps keys restricted by package name + SHA-1 / Bundle ID, Stripe `pk_`, WalletConnect projectId, Sentry DSN.
- **Fix**: secrets live only on the backend; the client calls your own backend proxy with the user session; build-time injection does **not** make a secret safe (neither does obfuscation).
- **Source**: OWASP MASVS-STORAGE-1, MASVS-CRYPTO-2; sec-web WEB-33/42; affaan-m/ECC@b38be6a7 .cursor/rules/swift-security.md "Never hardcode secrets ... decompilation tools extract them"; Android Lint SecretInSource, PackagedPrivateKey
### MOB-14 Weak algorithms and crypto misuse · default P1
- **What to look for**: `Cipher.getInstance("AES")` (ECB by default on Android), `AES/ECB/*`, fixed/all-zero IVs, reused GCM nonces, CBC without MAC, DES/3DES/RC4, MD5/SHA-1 for integrity or passwords, RSA without padding/PKCS1v1.5 encryption, home-made XOR obfuscation; Dart `encrypt` package with fixed `IV.fromLength(16)`; CryptoJS default AES passphrase mode (EVP_BytesToKey+MD5).
- **How to confirm**: semgrep `p/kotlin`/`p/java`/`p/mobsfscan`; Lint `GetInstance`, `UnsafeCryptoAlgorithmUsage`, `VulnerableCryptoAlgorithm`.
- **False positives**: hashes for non-security purposes (cache keys, deduplication).
- **Fix**: AES-256-GCM with a fresh random 12-byte nonce each time (or libsodium / Apple CryptoKit `AES.GCM.seal`); derive keys from passwords with Argon2id/scrypt (parameters in WAL-03).
- **Source**: OWASP MASVS-CRYPTO-1; sec-web WEB-47; semgrep registry p/kotlin (ecb-cipher, use-of-md5, etc.)
### MOB-15 Non-cryptographic random numbers · default P1 (P0 when generating private keys/mnemonics, see WAL-01)
- **What to look for**: Dart `Random()` (should be `Random.secure()`), `java.util.Random`/`kotlin.random.Random` generating tokens/nonces/PIN salts, `SecureRandom` with a fixed seed, JS `Math.random`; in RN, `crypto.getRandomValues` not polyfilled or polyfilled with something other than the native CSPRNG (`import 'react-native-get-random-values'` must come first).
- **How to confirm**: trace the source of nonces, IVs, salts and mnemonic entropy; Lint `SecureRandom`, `TrulyRandom`, `WeakPrng`.
- **False positives**: UI animation, sampling.
- **Fix**: Dart `Random.secure()`; Kotlin `SecureRandom()`; Swift `SecRandomCopyBytes` / `SystemRandomNumberGenerator`; RN `react-native-get-random-values` or `expo-crypto`.
- **Source**: OWASP MASVS-CRYPTO-1; CWE-338; sec-web WEB-46; sec-wallet-dapp WAL-01
### MOB-16 Encryption keys derived from device identifiers or fixed values · default P1
- **What to look for**: AES keys derived from `ANDROID_ID`, `identifierForVendor`, package name, user ID or a hardcoded salt; a 4–6 digit PIN hashed directly into a key with no KDF and no attempt limit (WAL-03).
- **How to confirm**: trace the inputs to `SecretKeySpec`/`SymmetricKey(data:)`.
- **False positives**: the derived value is only used for non-sensitive caches.
- **Fix**: keys are generated by Keystore/Keychain/Secure Enclave and are non-exportable; when a passphrase is needed use Argon2id/scrypt + random salt + attempt limits (server-side or hardware counter).
- **Source**: OWASP MASVS-CRYPTO-2; CWE-321
### C. Authentication (MASVS-AUTH-1/2/3)
### MOB-17 Biometrics only checks a boolean result · default P1 (wallet unlock/payment confirmation) · P2 (general app unlock)
- **What to look for**: iOS `LAContext().evaluatePolicy(...) { success in if success { unlock() } }`; Android `BiometricPrompt.authenticate(info)` without a `CryptoObject`, granting access directly in `onAuthenticationSucceeded`; Flutter `local_auth`, RN `expo-local-authentication`/`react-native-biometrics` `simplePrompt` return value decides whether to read a key or call an API. A hook (Frida/Objection) can simply change the result to `true`.
- **How to confirm**: check whether the secret read after successful biometrics is bound to biometrics by the system (Keychain ACL / Keystore `setUserAuthenticationRequired`).
- **False positives**: used only as a local UI unlock with no secret or server-side action behind it.
- **Fix**: store the secret as a Keychain item requiring user authentication (`SecAccessControl .biometryCurrentSet`, the system prompts on read); on Android use `BiometricPrompt.CryptoObject(cipher)` and decrypt with `result.cryptoObject.cipher` in the callback.
```kotlin
biometricPrompt.authenticate(promptInfo, BiometricPrompt.CryptoObject(cipher)) // use cipher.doFinal() in the callback
```
- **Source**: OWASP MASVS-AUTH-2; mukul975/Anthropic-Cybersecurity-Skills@54a79883 performing-ios-app-security-assessment (LAContext hooking); Android Developers "Show a biometric authentication dialog" (crypto-based auth)
### MOB-18 Biometric key policy too broad · default P2
- **What to look for**: iOS `.biometryAny`/`.userPresence` used for wallets (newly enrolled fingerprints/faces also work); Android without `setInvalidatedByBiometricEnrollment(true)`; `DEVICE_CREDENTIAL` fallback allowed without evaluation; `setUserAuthenticationParameters(timeout>0)` with a long window during which any code can use the key.
- **How to confirm**: enroll a new fingerprint and check whether the old key still works.
- **False positives**: low-value scenarios where the product allows device passcode fallback.
- **Fix**: for high value use `.biometryCurrentSet` / `setInvalidatedByBiometricEnrollment(true)` + `setUserAuthenticationParameters(0, AUTH_BIOMETRIC_STRONG)`; after invalidation require recovery with passphrase/mnemonic.
- **Source**: OWASP MASVS-AUTH-2, MASVS-AUTH-3; Android Developers "Android Keystore system: Require user authentication for key use"
### MOB-19 Authentication or authorization only on the client · default P0
- **What to look for**: local PIN/password comparison leads straight into a logged-in state while backend APIs need no token; **the server returns the OTP/verification code in the response** for the app to compare; `isPremium`/`isAdmin`/`kycPassed`/limits stored locally and used to call sensitive APIs; "hidden" admin menus in the app.
- **How to confirm**: intercept traffic and check whether the OTP appears in a response; call "unlock required/KYC required" APIs directly with curl.
- **False positives**: the local PIN only unlocks locally encrypted data, and that data's key is derived from the PIN / protected by Keystore.
- **Fix**: all authorization server-side (WEB-01/05); OTP verified only server-side; local flags affect UI only.
- **Source**: OWASP MASVS-AUTH-1; mukul975/Anthropic-Cybersecurity-Skills@54a79883 testing-mobile-api-authentication; sec-web WEB-05, WEB-16
### MOB-20 Session token lifecycle · default P2 (P1 for a never-expiring refresh token stored in plaintext; P0 for zero/one-click sending credentials to an attacker host)
- **What to look for**: long-lived access tokens; refresh tokens not rotated; logout deletes local state only without calling server-side revocation; tokens placed in deep links, WebView URL parameters or `postMessage` to web pages; no session list across devices. Tokens/uids appended as query parameters (`?rc_token=`) or `X-Auth-Token`/`Authorization`/Basic headers to URLs **outside the current workspace**: message attachments, avatars, link previews, new-server probes triggered by deep links (`/api/info`); origin checks done with a string prefix `url.startsWith(server)` (bypassed by `https://chat.acme.com.evil.com`), or done only on some call paths (skipped when an optional parameter is omitted).
- **How to confirm**: reuse an old token after logout; check whether the refresh endpoint issues a new one each time. Craft an attachment URL / deep link pointing to an attacker host and intercept traffic to see whether credentials are sent; check that every call site that attaches credentials goes through the same origin check. If a precondition is a server setting, check its actual default before deciding to downgrade.
- **False positives**: short access tokens + server-side revocable, one-time-rotated refresh tokens; credentials attached only to URLs that pass a strict same-origin comparison.
- **Fix**: see WEB-11; store refresh tokens in Keychain/Keystore; pass a session to a WebView via a one-time code exchange, not a long-lived token. Parse the URL before attaching credentials and strictly compare scheme + host + port with the logged-in server; never attach credentials to unknown hosts (probe new servers with anonymous requests).
```ts
const u = new URL(target), s = new URL(server);
const sameOrigin = u.protocol === s.protocol && u.hostname === s.hostname && u.port === s.port;
const headers = sameOrigin ? { 'X-Auth-Token': token, 'X-User-Id': uid } : {};
```
- **Source**: OWASP MASVS-AUTH-1; sec-web WEB-11/12; mukul975/Anthropic-Cybersecurity-Skills@54a79883 testing-mobile-api-authentication "Opaque Token Analysis"; bench mobile-1 GHSA-j266-j67c-xmc2, GHSA-p8rp-xgj3-272h
### MOB-21 Improper mobile OAuth/OIDC implementation · default P1 (P0 if account takeover is possible)
- **What to look for**: third-party login pages opened in an embedded WebView (the app can read passwords/cookies, and Google and others reject it); no PKCE; `client_secret` bundled into the app; redirect via a custom scheme that other apps can register, without PKCE; `state` not verified.
- **Also check**: web helper pages the app opens in the system browser for OAuth, WebAuthn or 2FA (e.g. `/webauthnmobile?cb=…`) must allowlist the app callback URL/scheme they return the result to; a caller-supplied callback turns the page into a 2FA-signing or credential oracle for any phishing link (P1; P0 when it completes account takeover). Source: https://github.com/tutao/tutanota/security/advisories/GHSA-mgq4-4gm5-rcw9
- **How to confirm**: check whether the authorization request carries `code_challenge`; check the redirect URI type.
- **False positives**: uses AppAuth / `ASWebAuthenticationSession` / Custom Tabs + PKCE, with the redirect being a verified App Link / Universal Link.
- **Fix**: RFC 8252: system browser (`ASWebAuthenticationSession`, Custom Tabs, or `flutter_appauth`/`react-native-app-auth`/`expo-auth-session`) + PKCE S256; no secret in public clients.
- **Source**: RFC 8252 (OAuth 2.0 for Native Apps); OWASP MASVS-AUTH-1; sec-web WEB-14; cloudflare/security-audit-skill@c1c8a8c1 DESKTOP-MOBILE-AND-LOCAL-IPC.md "App and account handoff confusion"
### MOB-22 App lock: no attempt limit and no auto-lock · default P2 (P1 for wallets, see WAL-03)
- **What to look for**: local PIN can be retried indefinitely (counter stored in clearable prefs); no re-lock after backgrounding/idle; sensitive operations (transfers, export, changing withdrawal address) do not require re-authentication.
- **How to confirm**: enter a wrong PIN repeatedly; return after staying in the background. Follow the **failure branch** of the over-limit action (logout, data wipe, lock) to the end: when the action depends on a network request (server-side logout, token revocation), check whether the local session and data are still cleared after the request fails, times out or throws; a `catch` that just `return`s or only shows a message is fail-open, and an attacker can retry indefinitely by going offline.
- **False positives**: wrong PINs are counted and locked server-side, and attempts cannot continue offline.
- **Fix**: keep the failure counter in Keychain/Keystore or on the server, with exponential backoff; re-lock after N minutes in the background; require re-authentication for sensitive operations (MASVS-AUTH-3).
- **Source**: OWASP MASVS-AUTH-2, MASVS-AUTH-3; sec-wallet-dapp WAL-03
### D. Network (MASVS-NETWORK-1/2)
### MOB-23 iOS ATS exceptions · default P2 (P1 when the production API uses cleartext)
- **What to look for**: in `Info.plist`, `NSAllowsArbitraryLoads = YES`, `NSExceptionAllowsInsecureHTTPLoads`, `NSExceptionMinimumTLSVersion` lowered to 1.0/1.1, `NSAllowsArbitraryLoadsInWebContent`; the same settings in Expo `app.json` `ios.infoPlist`; exceptions added for debugging that ship in Release.
- **How to confirm**: `plutil -p Info.plist`; check the plist for each configuration.
- **False positives**: narrow exceptions only for third-party media domains that genuinely require HTTP, carrying no sensitive data.
- **Fix**: remove global exceptions; use a separate `Info-Debug.plist` for development.
- **Source**: OWASP MASVS-NETWORK-1; Apple "NSAppTransportSecurity" documentation; affaan-m/ECC@b38be6a7 .cursor/rules/swift-security.md "Transport Security"
### MOB-24 Android cleartext traffic and insecure network_security_config · default P2 (P1 when the production API uses cleartext)
- **What to look for**: `android:usesCleartextTraffic="true"`; `<base-config cleartextTrafficPermitted="true">`; `<trust-anchors>` in `<base-config>` containing `<certificates src="user"/>` (Release trusts user-installed CAs and can be intercepted); user CAs trusted by default when `minSdk < 24`; hardcoded `http://` base URLs.
- **How to confirm**: check the merged manifest and `res/xml/network_security_config.xml`; Lint `UsingHttp`, `InsecureBaseConfiguration`, `AcceptsUserCertificates`, `DefaultCleartextTraffic`.
- **False positives**: user CAs only inside `<debug-overrides>`.
- **Fix**:
```xml
<network-security-config>
<base-config cleartextTrafficPermitted="false"><trust-anchors><certificates src="system"/></trust-anchors></base-config>
<debug-overrides><trust-anchors><certificates src="user"/></trust-anchors></debug-overrides>
</network-security-config>
```
- **Source**: OWASP MASVS-NETWORK-1; Android Developers "Network security configuration"; affaan-m/ECC@b38be6a7 agents/flutter-reviewer.md "Cleartext traffic"
### MOB-25 Custom certificate validation accepts everything · default P1 (P0 when wallet/payment traffic carries signing requests or tokens)
- **What to look for**: Kotlin `X509TrustManager.checkServerTrusted` with an empty body, `HostnameVerifier { _, _ -> true }`, OkHttp `hostnameVerifier { _, _ -> true }`; WebView `onReceivedSslError { handler.proceed() }`; iOS `URLSessionDelegate` answering `.serverTrust` with `completionHandler(.useCredential, URLCredential(trust:))` without evaluation; Dart `badCertificateCallback = (cert, host, port) => true`, `HttpOverrides.global` allowing everything globally; the same patterns in RN native modules.
- **Also check**: pin or trust evaluation that runs but is not enforced on every path (the delegate computes the hash, then a mismatch, exception or fallthrough still reaches `.useCredential`/`performDefaultHandling`/`proceed`), and hand-written hostname or wildcard matchers that replace the platform verifier (`*` must match exactly one left-most label, RFC 6125 §6.4.3). Source: Tella 3.0 audit https://tella-app.org/fr/assets/files/2026.07%20-%20Horizontal%20x%20Convocation%20Research+Design%20%20A%20Comprehensive%20Security%20Audit%20for%20Tella%203.0.0+-88536eebfe781b0c58f5df54006b3c51.pdf TELLA3-010; Conversations audit https://conversations.im/2025_audit_conversations.pdf CLN-005
- **How to confirm**: grep for the patterns above; Lint `TrustAllX509TrustManager`, `BadHostnameVerifier`, `AllowAllHostnameVerifier`, `WebViewClientOnReceivedSslError`; mobsfscan rule `webview_ignore_ssl_errors`.
- **False positives**: only in the Debug source set (`src/debug/`) or `kDebugMode` and stripped at compile time.
- **Fix**: remove custom validation; for a private CA use network_security_config `<domain-config>` / `SecTrustSetAnchorCertificates` / Dart `SecurityContext(withTrustedRoots:false)..setTrustedCertificatesBytes()`.
- **Source**: OWASP MASVS-NETWORK-1; CWE-295; sec-web WEB-47; mukul975/Anthropic-Cybersecurity-Skills@54a79883 performing-mobile-app-certificate-pinning-bypass (TrustManager/NSURLSession validation points)
### MOB-26 Certificate pinning missing or fragile · default P2 (wallet/payment/financial apps) · P3 (general apps)
- **What to look for**: high-value apps without SPKI pinning for their own API; pinning only the leaf certificate with no backup pin (certificate rotation causes a global outage and the team then disables pinning); Flutter assuming Android `<pin-set>` applies (Dart `HttpClient` does not use the platform TLS stack); RN pinning only on iOS; pinning covers only some clients (WebView, image libraries, third-party SDKs use another stack).
- **Also check**: clients of user-chosen servers (mail, XMPP, self-hosted) that cannot pin rely on the device trust store alone; on unpatched devices they accept distrusted or compromised CAs. Ship a CA distrust list or bundled trust store (e.g. Conscrypt), and consider CT/revocation checks (P3; P2 when credentials or OAuth tokens flow over it). Source: https://github.com/thunderbird/thunderbird-android/security/advisories/GHSA-mm8q-8263-vjf4
- **How to confirm**: check `CertificatePinner`, `<pin-set>`, `NSPinnedDomains`, TrustKit, `react-native-ssl-public-key-pinning`, `http_certificate_pinning`/Dio `validateCertificate`; verify with mitmproxy + user CA (Debug) or Objection.
- **False positives**: ordinary content apps without pinning (P3 recommendation).
- **Fix**: pin the intermediate CA or SPKI public key hash, with at least two pins (current + backup), an expiration and a remote kill switch; implement per stack, see refs.
```xml
<domain-config><domain includeSubdomains="true">api.example.com</domain>
<pin-set expiration="2027-06-01"><pin digest="SHA-256">AAA…=</pin><pin digest="SHA-256">BBB…=</pin></pin-set></domain-config>
```
- **Source**: OWASP MASVS-NETWORK-2; Android Developers "Network security configuration: Pin certificates"; Apple "Identity Pinning: How to configure server certificates for your app"; mukul975/Anthropic-Cybersecurity-Skills@54a79883 performing-mobile-app-certificate-pinning-bypass
### MOB-27 Debug proxies and development network config left in release builds · default P1
- **What to look for**: Dio/OkHttp with hardcoded `findProxy`/`Proxy(HTTP, 192.168.x.x:8888)`; Charles/mitmproxy CA bundled in `res/raw` and added to trust anchors; API environment switching/pinning disable available from a hidden menu in Release; `10.0.2.2`, `localhost`, staging URLs in release config; Lint `UnintendedExposedUrl`, `UnintendedPrivateIpAddress`.
- **How to confirm**: decompile the release build and search for IPs/staging domains and `.pem/.crt`; check whether environment-switching code is gated by build type.
- **False positives**: environment switching exists only in `debug`/`internal` flavors and is stripped at compile time.
- **Fix**: separate environments with flavors / build configurations / `--dart-define`; remove debug code from release at compile time.
- **Source**: OWASP MASVS-NETWORK-1, MASVS-CODE-4; Android security lint (com.android.security.lint)
### MOB-28 Assuming "only my app calls the API" · default P1 (P0 when relied on for authorization, see WEB-01/02)
- **What to look for**: the backend relies on hidden endpoints, an in-app signing key (HMAC request signing), User-Agent/package-name headers or client timestamps to "prevent forgery"; mobile-only endpoints without object-level authorization; prices/amounts computed by the app and submitted (WEB-48).
- **How to confirm**: extract the signing key from the app and forge requests with a script; swap resource IDs.
- **False positives**: signing is used only for anti-scraping/rate limiting and the server still performs full authorization.
- **Fix**: server-side authorization and validation (sec-web); when device trust is needed use **server-side** verification of Play Integrity / App Attest (MOB-51) as a risk signal.
- **Source**: OWASP MASVS-AUTH-1; sec-web WEB-01/02/48; mukul975/Anthropic-Cybersecurity-Skills@54a79883 testing-mobile-api-authentication
### E. Platform interaction (MASVS-PLATFORM-1/2/3)
### MOB-29 Unprotected exported components · default P1 (P0 when able to trigger payments/password changes/data export)
- **What to look for**: Activities/Services/Receivers/Providers with `android:exported="true"` or an `<intent-filter>` that perform sensitive operations without `android:permission` (or with a custom permission of `protectionLevel="normal"`); with targetSdk below 31, components with intent-filters are exported by default; exported components brought in by third-party libraries via manifest merging.
- **How to confirm**: check the **merged** manifest; `adb shell am start -n pkg/.AdminActivity --es user_id 1`, `am broadcast`; Lint `ExportedService`, `ExportedReceiver`, `ExportedContentProvider`, `InsecurePermissionProtectionLevel`.
- **False positives**: Launcher Activity, share entry points that only display public content; `protectionLevel="signature"`.
- **Fix**: default to `exported="false"`; when export is required add a `signature`-level permission and validate parameters and login state at the entry point.
- **Source**: OWASP MASVS-PLATFORM-1; mukul975/Anthropic-Cybersecurity-Skills@54a79883 testing-android-intents-for-vulnerabilities "Enumerate Exported Components"; cloudflare/security-audit-skill@c1c8a8c1 DESKTOP-MOBILE-AND-LOCAL-IPC.md "Exported service, activity, receiver, or provider overreach"
### MOB-30 Intent redirection (forwarding untrusted Intents) · default P1
- **What to look for**: an `Intent` taken from extras (`getParcelableExtra("next")`) then passed to `startActivity`/`startService`/`setResult`; the forwarded Intent carries `FLAG_GRANT_READ/WRITE_URI_PERMISSION` and can access private Providers; `Intent.parseUri(url, URI_INTENT_SCHEME)` from a web page/deep link.
- **How to confirm**: in exported components trace `getParcelableExtra` → `startActivity`; Lint `UnsafeIntentLaunch`, `UnsafeImplicitIntentLaunch`.
- **False positives**: before forwarding, the target component is verified against an allowlist within this package and grant flags are cleared.
- **Fix**: use `androidx.core.content.IntentSanitizer` or manually verify the package/class name from `resolveActivity` and strip URI grant flags; do not deserialize Intents from external input.
- **Source**: OWASP MASVS-PLATFORM-1; Android Developers "Intent redirection" (App security best practices); Android Lint UnsafeIntentLaunch
### MOB-31 Mutable + implicit PendingIntent · default P1
- **What to look for**: `PendingIntent.getActivity(ctx, 0, Intent(), FLAG_MUTABLE)` (empty/implicit base Intent) handed to notifications, widgets or third-party SDKs; on Android 12+ omitting mutability crashes, and developers "fix" it by choosing `FLAG_MUTABLE`.
- **How to confirm**: Lint `MutableImplicitPendingIntent`, `UnspecifiedImmutableFlag`.
- **False positives**: MUTABLE is genuinely required (inline reply, bubbles) and the base Intent has an explicit component.
- **Fix**: `FLAG_IMMUTABLE` + an explicit Intent (`Intent(ctx, Target::class.java)`).
- **Source**: OWASP MASVS-PLATFORM-1; Android Developers "PendingIntent" security guidance; mukul975/Anthropic-Cybersecurity-Skills@54a79883 testing-android-intents-for-vulnerabilities "Pending Intent"
### MOB-32 ContentProvider / FileProvider exposed too broadly · default P1
- **What to look for**: `<root-path>` or `path="."`/`"/"` in `file_paths.xml`; exported Providers without read/write permissions; `query()` concatenating `selection`/`sortOrder` into SQL; `openFile()` concatenating `uri.lastPathSegment`, causing path traversal; `grantUriPermissions="true"` combined with Intent redirection; file names received from other apps' Providers used directly as local paths.
- **How to confirm**: Lint `ExposedRootPath`, `GrantAllUris`, `UnsanitizedFilenameFromContentProvider`; `adb shell content query --uri content://…`.
- **False positives**: read-only public content.
- **Fix**: FileProvider exposes only a dedicated subdirectory; parameterized queries; `File(base, name).canonicalPath.startsWith(base.canonicalPath)`; generate new names for external file names.
- **Source**: OWASP MASVS-PLATFORM-1; mukul975/Anthropic-Cybersecurity-Skills@54a79883 testing-android-intents-for-vulnerabilities "Test Content Providers"
### MOB-33 Broadcasts carrying sensitive data or unrestricted dynamic receivers · default P2
- **What to look for**: implicit broadcasts like `sendBroadcast(Intent("com.x.LOGIN").putExtra("token", t))`; `registerReceiver` without `RECEIVER_NOT_EXPORTED` (mandatory to specify explicitly for targetSdk 34 from Android 14); receivers performing transfers/resets without verifying the sender.
- **Also check**: a receiver registered with `RECEIVER_NOT_EXPORTED` is still reachable through any `PendingIntent` the app or a library hands out that targets it (notification actions, alarms); validate extras and handle malformed input without crashing regardless of the export flag. Source: Ceno/Ouinet https://7asecurity.com/reports/pentest-ouinet-ceno-RC1.2b.pdf OUI-01-022
- **How to confirm**: search for `sendBroadcast`, `registerReceiver`; Lint `UnsafeProtectedBroadcastReceiver`.
- **False positives**: in-process communication via Flow/LiveData only (`LocalBroadcastManager` is deprecated; just migrate).
- **Fix**: explicit `setPackage(packageName)`; `ContextCompat.registerReceiver(ctx, r, filter, RECEIVER_NOT_EXPORTED)`; do not use broadcasts for in-process events.
- **Source**: OWASP MASVS-PLATFORM-1; mukul975/Anthropic-Cybersecurity-Skills@54a79883 testing-android-intents-for-vulnerabilities "Test Broadcast Receivers"
### MOB-34 Deep link parameters directly drive sensitive operations · default P1 (P0 when able to transfer funds/authorize/leak tokens directly)
- **What to look for**: `myapp://transfer?to=…&amount=…` pre-fills and allows one-tap confirmation; `?redirect=`/`?url=` loaded into a WebView with a bridge (MOB-36/37); `?api=`/`?host=` switching the backend address, or triggering a probe request to a new host carrying existing session credentials (credential exfiltration is P0, see MOB-20); `?token=` auto-login (login CSRF / session fixation); routing libraries (go_router, React Navigation linking, Navigation component deep link) exposing arbitrary routes externally.
- **How to confirm**: `adb shell am start -a android.intent.action.VIEW -d 'myapp://…'`, `xcrun simctl openurl booted 'myapp://…'`.
- **False positives**: navigates only to public pages and changes no state.
- **Fix**: deep links navigate, they do not execute; allowlist parameters + type validation; sensitive actions show full content and require user confirmation/re-authentication; list externally reachable routes explicitly.
- **Source**: OWASP MASVS-PLATFORM-1, MASVS-CODE-4; cloudflare/security-audit-skill@c1c8a8c1 DESKTOP-MOBILE-AND-LOCAL-IPC.md "Custom-scheme and deep-link ambiguity"; affaan-m/ECC@b38be6a7 agents/flutter-reviewer.md "Unsafe deep links"
### MOB-35 Hijackable custom schemes / unverified App Links and Universal Links · default P2 (P1 when carrying OAuth codes, magic links or payment callbacks)
- **What to look for**: OAuth/magic link/payment callbacks over `myapp://` (any app can register the same scheme); Android `https` intent-filters missing `android:autoVerify="true"` or with mismatched `/.well-known/assetlinks.json` fingerprints; iOS `apple-app-site-association` missing/with overly broad paths, Associated Domains not configured.
- **How to confirm**: `adb shell pm get-app-links <pkg>` for verification status; curl the AASA/assetlinks; Lint `MissingAutoVerifyAttribute`.
- **False positives**: the scheme only opens the app home screen.
- **Fix**: sensitive callbacks use verified App Links / Universal Links + PKCE/one-time state; assetlinks contain the release signing fingerprint (including Play App Signing).
- **Source**: OWASP MASVS-PLATFORM-1; Android Developers "Verify Android App Links"; Apple "Supporting associated domains"; RFC 8252 §7
### MOB-36 WebView JS bridge exposes native capabilities to untrusted pages · default P1 (P0 when exposing signing, key retrieval, transfers, file read/write)
- **What to look for**: Android `addJavascriptInterface(obj, "Native")` followed by loading remote/navigable pages (any frame can call it); iOS `WKScriptMessageHandler` not checking `message.frameInfo.securityOrigin`/`isMainFrame`; RN `react-native-webview` `onMessage` not checking `event.nativeEvent.url`; Flutter `addJavaScriptChannel`, `flutter_inappwebview` `addJavaScriptHandler` not validating origin; bridge methods being a generic `invoke(method, args)`. Providers injected by DApp browsers/embedded wallets are especially dangerous (WAL-14).
- **Also check**: an "allowed" origin that is itself chosen by remote config, a server `.well-known` file, a homeserver or tenant setting, or another party the user does not control is not a trust anchor: the page loaded from it must not receive keys, tokens or media secrets over the bridge unless the app pins the origin or verifies what it loads (P1; P0 when it yields keys or decrypted content). Source: https://github.com/element-hq/element-x-ios/security/advisories/GHSA-69qf-p24v-rf8j
- **How to confirm**: list all bridge methods × loadable origins; check whether they can be called from any page after navigation.
- **False positives**: loads only bundled resources (`WebViewAssetLoader`/local HTML) and navigation away is blocked.
- **Fix**: prefer `WebViewCompat.addWebMessageListener(webView, "bridge", setOf("https://app.example.com"), listener)` (per-origin injection); validate the caller origin and a method allowlist on every call; show a native confirmation UI for sensitive operations like signing (WAL-15).
- **Source**: OWASP MASVS-PLATFORM-2; cloudflare/security-audit-skill@c1c8a8c1 DESKTOP-MOBILE-AND-LOCAL-IPC.md "Navigation-origin to bridge confusion", "Over-broad native bridge capabilities"; Android Lint AddJavascriptInterface, JavascriptInterface
### MOB-37 WebView loads untrusted URLs and navigation is uncontrolled · default P1
- **What to look for**: `loadUrl(intent.getStringExtra("url"))`, deep link `?url=`; `shouldOverrideUrlLoading` not restricting domains or allowing `intent://`, `file://`, `javascript:`; RN `originWhitelist={['*']}`; `setSupportMultipleWindows`/`javaScriptCanOpenWindowsAutomatically` opening arbitrary windows; `mixedContentMode = ALWAYS_ALLOW`; `setSafeBrowsingEnabled(false)`.
- **Also check**: app-origin internal routes and custom-scheme/asset handlers (`WKURLSchemeHandler`, `shouldInterceptRequest`, `WebViewAssetLoader` path handlers, framework routes such as Capacitor's `/_capacitor_http_interceptor_`): the navigation guard must match path as well as scheme and host, and no handler may fetch a remote or caller-chosen URL and serve it at the privileged origin (that gives the attacker page the plugin bridge, P0 when sensitive plugins are registered); handlers must not crash on unknown or relative paths from untrusted content (remote DoS, P2). Every entry that loads a URL into a WebView (custom schemes like `io.element.call://`, deep links) must apply the same allowlist. Also check WebView media/geolocation grants (`WKUIDelegate.requestMediaCapturePermissionFor`, Android `onPermissionRequest`, `onGeolocationPermissionsShowPrompt`) are given only to allowlisted origins, never `.grant` for any origin. Source: https://github.com/ionic-team/capacitor/security/advisories/GHSA-rvm3-566m-v7fv; https://github.com/element-hq/element-x-ios/security/advisories/GHSA-54w7-rw44-49m7; https://github.com/tutao/tutanota/security/advisories/GHSA-jj2j-5x96-gf8h
- **How to confirm**: check whether an externally supplied `https://evil.example` gets loaded.
- **False positives**: the URL is fully parsed and the host exactly matches an allowlist (not `startsWith`/`contains`).
- **Fix**: `Uri.parse(u).let { it.scheme == "https" && it.host in ALLOWED }`; hand anything outside the allowlist to the system browser; `MIXED_CONTENT_NEVER_ALLOW`.
- **Source**: OWASP MASVS-PLATFORM-2; Android Lint SetJavaScriptEnabled, DisabledAllSafeBrowsing; mobsfscan rules webview_*
### MOB-38 WebView file access and cross-origin access · default P1
- **What to look for**: `setAllowFileAccess(true)` combined with `setAllowFileAccessFromFileURLs`/`setAllowUniversalAccessFromFileURLs(true)`; loading `file://` HTML that can be written externally; iOS `loadFileURL(_:allowingReadAccessTo:)` granting the whole `Documents`/container directory; RN `allowFileAccess`, `allowUniversalAccessFromFileURLs`; the same-named options in flutter_inappwebview.
- **How to confirm**: mobsfscan `webview_set_allow_file_access`; check whether local HTML can `fetch('file:///data/data/<pkg>/shared_prefs/…')`.
- **False positives**: set to false (Android API 30+ defaults to `allowFileAccess=false`).
- **Fix**: serve local resources via `WebViewAssetLoader` at `https://appassets.androidplatform.net/`; on iOS grant only the smallest directory containing the page.
- **Source**: OWASP MASVS-PLATFORM-2; cloudflare/security-audit-skill@c1c8a8c1 DESKTOP-MOBILE-AND-LOCAL-IPC.md "Webview file and universal access"
### MOB-39 WebView/JS debugging enabled in release builds · default P2
- **What to look for**: `WebView.setWebContentsDebuggingEnabled(true)` not gated by `BuildConfig.DEBUG`; iOS 16.4+ `webView.isInspectable = true` in Release; RN `webviewDebuggingEnabled`; Hermes/JSC debugger connectable in release.
- **How to confirm**: mobsfscan `webview_debugging`; check whether the Release build appears in `chrome://inspect` / the Safari Develop menu.
- **False positives**: Debug builds only.
- **Fix**: `WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG)`; wrap `isInspectable` in `#if DEBUG`.
- **Source**: OWASP MASVS-PLATFORM-2, MASVS-RESILIENCE-4; mobsfscan rule webview_debugging
### MOB-40 iOS App Extension, App Group and Keychain sharing boundaries · default P2
- **What to look for**: Share/Notification/Widget/Keyboard extensions reading the main app's tokens/mnemonics via the App Group container or a shared Keychain access group; extensions processing external input (shared-in URLs/files) and then directly calling login-required APIs; `keychain-access-groups` containing unneeded groups.
- **How to confirm**: check `com.apple.security.application-groups` and `keychain-access-groups` in `*.entitlements`; see which items extension code reads.
- **False positives**: the extension only reads non-sensitive shared configuration.
- **Fix**: use a separate access group for sensitive items, readable only by the main app; extensions get only least-privilege short-lived tokens; validate external input per MOB-34.
- **Source**: OWASP MASVS-PLATFORM-1; cloudflare/security-audit-skill@c1c8a8c1 DESKTOP-MOBILE-AND-LOCAL-IPC.md "Credential-store and local-secret boundary mismatch", "File-open and intent authority confusion"
### MOB-41 Overlay tapjacking and task hijacking · default P2 (wallet confirmation/authorization buttons) · P3 (other)
- **What to look for**: transfer/authorization confirmation buttons without `filterTouchesWhenObscured`; not using `setHideOverlayWindows(true)` (API 31+); `taskAffinity`/`launchMode="singleTask"` configuration making StrandHogg-style task hijacking feasible (Lint `StrandhoggVulnerable`, `TapjackingVulnerable`).
- **How to confirm**: check View attributes and Activity configuration on critical confirmation screens.
- **False positives**: Android 12+ blocks touches through untrusted overlays by default (protection on critical screens is still recommended).
- **Fix**: confirmation buttons `android:filterTouchesWhenObscured="true"`; critical Activities `window.setHideOverlayWindows(true)` (requires the `HIDE_OVERLAY_WINDOWS` permission); `android:taskAffinity=""`.
- **Source**: OWASP MASVS-PLATFORM-3; Android Developers "Tapjacking", "StrandHogg" security guidance; Android security lint
### MOB-42 Received shared/opened files and content not validated · default P2
- **What to look for**: `content://` or `file://` received via `ACTION_SEND`/`ACTION_VIEW` copied directly into a private directory (file name traversal: building `File(cacheDir, name)` from the sender's `OpenableColumns.DISPLAY_NAME`/`_display_name`, i.e. "Dirty Stream", which can overwrite private files; rate P1 per MOB-32, see AND-19), extracted (Zip Slip, WEB-40), or imported as wallet backups/config; iOS `application(_:open:options:)`, `onOpenURL` importing files without confirming source and content.
- **Also check**: the same traversal and overwrite rules apply to file names and paths received over the app's own network endpoints (LAN/P2P transfer APIs, local web upload), not only IPC shares; P1 when a nearby device can write outside the download directory, especially with auto-accept ("Quick Save") on. See MOB-56. Source: https://github.com/localsend/localsend/security/advisories/GHSA-f7jp-p6j4-3522
- **How to confirm**: share a crafted file name `../../shared_prefs/x.xml` from another app. Also check **this app's own provider**: whether the share entry point accepts URIs pointing to this app's FileProvider / private directory (`content://<this app's authority>/...`, `file:///data/data/<this package>/...`). If it does, a malicious app can make the user "share" this app's private files (databases, keys, cached attachments) out: default P2; P1 when code has a path that sends without user confirmation (direct share into a conversation, auto-upload).
- **False positives**: preview only, nothing written to disk; the share entry point rejects this app's authority and private paths.
- **Fix**: generate new file names; validate MIME/size/format; require user confirmation and parse/validate before importing sensitive config.
- **Source**: OWASP MASVS-CODE-4, MASVS-PLATFORM-1; cloudflare/security-audit-skill@c1c8a8c1 DESKTOP-MOBILE-AND-LOCAL-IPC.md "File-open and intent authority confusion"
### F. Code and build (MASVS-CODE-1/2/3/4)
### MOB-43 Debuggable release builds or leftover development features · default P1
- **What to look for**: manifest hardcoding `android:debuggable="true"` (Lint `HardcodedDebugMode`); release `buildTypes` with `isDebuggable = true`; iOS Release with `get-task-allow`; RN release including Flipper/dev menu/`__DEV__` backdoors; Flutter debug screens reachable outside `kDebugMode`; "master OTP" or "skip KYC" switches; test account autofill.
- **How to confirm**: `aapt dump badging app.apk | grep debuggable`; `codesign -d --entitlements - App.app`; search for `debugMenu|bypass|skipOtp|backdoor|TEST_MODE`.
- **False positives**: internal/QA flavors that are not published to stores.
- **Fix**: debug capabilities only in debug source sets/flavors; release is built by CI, which checks debuggable and entitlements.
- **Source**: OWASP MASVS-CODE-4, MASVS-RESILIENCE-4; sec-web WEB-44; Android Lint HardcodedDebugMode
### MOB-44 Third-party SDK over-collection and supply-chain risk · default P2 (P0 when collecting mnemonics/passwords/card numbers)
- **What to look for**: Session Replay (Sentry, LogRocket, Smartlook, UXCam, etc.) recording input fields and sensitive screens; Analytics auto-capturing text/screenshots; ad/attribution SDKs reading the clipboard, the installed app list or precise location; SDKs bringing in exported components and permissions; versions flagged by Google Play SDK Index (Lint `RiskyLibrary`, `PlaySdkIndexDeprecated`, `OutdatedLibrary`).
- **How to confirm**: list all SDKs and their init parameters and the permissions/components they add to the merged manifest; intercept traffic to see what is reported.
- **False positives**: masking is configured and collection is disabled on sensitive screens.
- **Fix**: disable replay on sensitive screens and mask inputs; minimize SDKs and initialize on demand; use only packages from official channels.
- **Source**: OWASP MASVS-CODE-3, MASVS-PRIVACY-1; sec-wallet-dapp WAL-06; Android Lint RiskyLibrary
### MOB-45 Outdated dependencies and platform versions · default P2 (P1/P0 when a reachable known high-severity vulnerability exists, see WEB-55)
- **What to look for**: known vulnerabilities in `pubspec.lock`, `package-lock.json`/`yarn.lock`, `Podfile.lock`, `Package.resolved` or Gradle dependencies; lockfiles not committed; `targetSdkVersion` below Play requirements (Lint `ExpiredTargetSdkVersion`); `minSdk`/iOS Deployment Target too low to enable protections such as MOB-06/31; typosquatted or hallucinated package names.
- **How to confirm**: `osv-scanner scan source -r .` (Gradle needs dependency locking or verification-metadata enabled; CocoaPods is outside its default resolution and must be checked manually); `flutter pub outdated`; `npm audit`.
- **False positives**: the vulnerable code path is unreachable (state the reason).
- **Fix**: commit lockfiles; upgrade; Gradle `dependencyLocking { lockAllConfigurations() }` then `./gradlew dependencies --write-locks`.
- **Source**: OWASP MASVS-CODE-1, MASVS-CODE-3; sec-web WEB-55
### MOB-46 OTA / hot update packages without signature verification · default P1 (P0 for wallet/payment apps)
- **What to look for**: Expo Updates without `codeSigningCertificate`/`codeSigningMetadata`; self-hosted CodePush servers without code signing (`react-native-code-push` is marked deprecated on npm and App Center was retired on 2025-03-31; signing is often dropped during migration); home-grown "download JS bundle/Dart patch/resource pack" relying only on HTTPS without signatures; update channel URLs modifiable via deep links/remote config.
- **How to confirm**: check `app.json` `updates`, `expo-updates` configuration, CodePush `CodePushPublicKey`, and the verification logic after home-grown downloads.
- **False positives**: only non-executable static content (copy, images) is delivered, with full integrity checks.
- **Fix**: Expo: `npx expo-updates codesigning:generate` and configure the certificate and `keyid/alg` in `app.json`; home-grown: Ed25519 signatures + public key pinned in the app + version numbers to prevent rollback; private key in CI secrets/KMS.
- **Source**: OWASP MASVS-CODE-2, MASVS-RESILIENCE-2; Expo "Code signing for EAS Update"; cloudflare/security-audit-skill@c1c8a8c1 DESKTOP-MOBILE-AND-LOCAL-IPC.md "Install, update, and repair path trust"
### MOB-47 Dynamically loading executable code · default P1
- **What to look for**: `DexClassLoader`/`PathClassLoader` loading from external storage or the downloads directory; `System.load(path)` pointing to a writable location (Lint `UnsafeDynamicallyLoadedCode`, `UnsafeNativeCodeLocation`); `JSContext.evaluateScript(downloaded)`, RN runtime `eval` of remote scripts; WebView injecting arbitrary server-delivered JS into bridged pages.
- **How to confirm**: search for `DexClassLoader|System.load\(|evaluateScript|new Function|eval\(`.
- **False positives**: only loads native libraries from `lib/` inside the APK.
- **Fix**: ship code with the store package; when dynamic delivery is required, verify signatures per MOB-46 and store in a private directory. Both Google Play and App Store review guidelines restrict downloading executable code (Review Guideline 2.5.2).
- **Source**: OWASP MASVS-CODE-4, MASVS-RESILIENCE-2; Android Lint UnsafeDynamicallyLoadedCode; App Store Review Guidelines 2.5.2
### G. Anti-reversing and integrity (MASVS-RESILIENCE-1/2/3/4) - defense in depth
### MOB-48 Root / jailbreak environment not detected or handled · default P3 (P2 for wallet/payment)
- **What to look for**: high-value apps with no environment detection at all; or a single boolean check (`isRooted()` → dialog) whose result is used only on the client and can be hooked in one step; detection results used to "block login" but never reported to the server.
- **How to confirm**: check the detection library (`freerasp`, `jail-monkey`, `safe_device`, RootBeer, IOSSecuritySuite) and where its result goes.
- **False positives**: not detecting in low-value apps is a reasonable choice.
- **Fix**: report detection results to the server as a risk signal (combined with MOB-51) and restrict sensitive operations (large transfers, mnemonic export) on high-risk devices rather than just showing a dialog; do not treat detection as a substitute for storage encryption.
- **Source**: OWASP MASVS-RESILIENCE-1; mukul975/Anthropic-Cybersecurity-Skills@54a79883 conducting-mobile-app-penetration-test
### MOB-49 Not obfuscated or readable symbols retained · default P3 (P2 for wallet core logic)
- **What to look for**: Android release `isMinifyEnabled = false`; Flutter release without `--obfuscate --split-debug-info`; RN assuming Hermes bytecode equals obfuscation; iOS packaging dSYMs or debug symbols into the IPA; blanket `-keep class ** { *; }` in `proguard-rules.pro`.
- **How to confirm**: open the release APK in jadx; `strings libapp.so`.
- **False positives**: open-source apps.
- **Fix**: R8 full mode + precise keep rules; `flutter build apk --obfuscate --split-debug-info=build/symbols`; upload symbol files to the crash platform and do not ship them in the package. **Obfuscation does not protect secrets** (see MOB-13).
- **Source**: OWASP MASVS-RESILIENCE-3; Android Developers "Shrink, obfuscate, and optimize your app"; Flutter docs "Obfuscating Dart code"
### MOB-50 No anti-tampering / repackaging / dynamic instrumentation detection · default P3 (P2 for wallets)
- **What to look for**: signing certificate digest and install source not verified; no Frida/debugger detection; a repackaged app can call the backend normally.
- **How to confirm**: re-sign with apktool and run it to see whether it is detected.
- **False positives**: already covered by server-side integrity attestation (MOB-51).
- **Fix**: report signature verification and hook detection as signals; put the real enforcement point on the server (MOB-51).
- **Source**: OWASP MASVS-RESILIENCE-2, MASVS-RESILIENCE-4
### MOB-51 Integrity attestation missing or decided on the client · default P2 (P1 when the verdict is parsed on the client and used to grant access)
- **What to look for**: high-value endpoints (sign-up rewards, withdrawals, device binding) without Play Integrity / App Attest; decoding the Integrity token inside the app or only checking "call succeeded"; no binding to a nonce/request hash, so tokens can be replayed; still using the shut-down SafetyNet Attestation.
- **How to confirm**: check whether the token is sent to the backend and the backend calls Google to decrypt it / verifies the Apple attestation and assertion counter.
- **False positives**: low-value apps.
- **Fix**: backend generates a one-time nonce → app obtains the token → backend verifies (Play Integrity server-side decryption; App Attest certificate chain, `clientDataHash`, monotonically increasing counter) → use as a risk signal, not as the sole authorization.
- **Source**: OWASP MASVS-RESILIENCE-1/2; Android Developers "Play Integrity API"; Apple "Establishing your app's integrity" (DCAppAttestService)
### H. Privacy (MASVS-PRIVACY-1/2/3/4)
### MOB-52 Excessive permission requests · default P3 (P2 when reading contacts/SMS/precise location without need)
- **What to look for**: requesting `READ_SMS` (auto-reading OTPs should use the SMS Retriever / SMS User Consent API instead), `READ_CONTACTS`, `ACCESS_FINE_LOCATION`, `QUERY_ALL_PACKAGES`, `MANAGE_EXTERNAL_STORAGE`; iOS `NS*UsageDescription` entries far exceeding features; requesting all permissions at launch.
- **How to confirm**: compare the merged manifest / Info.plist with actual features.
- **False positives**: the feature genuinely needs it and it is explained.
- **Fix**: request on demand, at the time of use; use alternative APIs (Photo Picker, SMS Retriever, approximate location); remove unused permissions brought in by SDKs (`tools:node="remove"`).
- **Source**: OWASP MASVS-PRIVACY-1; Android Developers "Permissions best practices"
### MOB-53 Tracking SDKs, ATT and privacy declarations inconsistent · default P3 (P2 when PII is uploaded without consent)
- **What to look for**: iOS accessing IDFA without `ATTrackingManager` authorization; missing `PrivacyInfo.xcprivacy` or required-reason APIs (`UserDefaults`, file timestamps, etc.) not declared; Google Play Data safety form not matching actual collection; analytics/ad SDKs initialized before consent.
- **How to confirm**: check SDK initialization timing and the consent flow; the privacy report generated by Xcode.
- **False positives**: no tracking SDKs.
- **Fix**: initialize after consent; complete the privacy manifest and store declarations; users can withdraw consent.
- **Source**: OWASP MASVS-PRIVACY-3, MASVS-PRIVACY-4; Apple "Privacy manifest files", "App Tracking Transparency"
### MOB-54 Excessive collection of device identifiers and PII · default P2
- **What to look for**: collecting IMEI/serial number/MAC (Lint `HardwareIds`) as user IDs; uploading contacts, installed app lists, precise location traces; linking phone number/email/wallet address with advertising IDs and sending them to third parties; PII in URL queries.
- **How to confirm**: intercept traffic to see reported fields; search for `getDeviceId|Build.SERIAL|identifierForVendor|advertisingIdentifier`.
- **False positives**: device fingerprinting necessary for risk control, disclosed in the privacy policy and sent only to your own backend.
- **Fix**: use resettable app-scoped IDs; minimize and anonymize; send only aggregated data to third parties.
- **Source**: OWASP MASVS-PRIVACY-1, MASVS-PRIVACY-2; Android Lint HardwareIds
### I. Local services, nearby peers and hybrid UI (MASVS-NETWORK-1, MASVS-PLATFORM-1/2, MASVS-CODE-4)
### MOB-55 Local loopback/LAN servers, proxies and sockets without client authentication · default P1 (P0 when the listener relays the user's traffic, tokens or keys and another app can call it or pre-bind its port) · P2 (DoS only)
- **What to look for**: listeners the app opens: `ServerSocket`, NanoHTTPD/Ktor/`com.sun.net.httpserver`, Android `LocalServerSocket` (abstract namespace is reachable by every app), iOS `NWListener`/GCDWebServer/Swifter/Telegraph, Dart `HttpServer.bind`/`shelf`/`shelf_static`, embedded proxies and daemons (Tor, P2P/CDN clients, VPN helpers, `setListenOnTcp`), "share via link" or local web-UI servers. Flag: a fixed port constant or binding `0.0.0.0`/`InternetAddress.anyIPv4` when only loopback is needed; requests served without a per-session random token, client certificate or same-UID check; the app's own client (WebView/GeckoView proxy setting, native HTTP client) connecting to `127.0.0.1:<fixed port>` without authenticating the listener, so a malicious app that binds the port first receives or rewrites the traffic; bind failure ignored (endless spinner, silent fallback to direct traffic); pages built from peer or file names (MOB-57).
- **How to confirm**: grep for `bind(`, `listen(`, `ServerSocket(`, `HttpServer`, port constants in `BuildConfig`/resources; on a device `adb shell ss -ltnp` or `netstat -an`; from a test app with only `INTERNET`, send requests to the port; pre-bind the port before launch (`adb shell nc -Lp <port>`) and see whether the app hangs or sends its traffic to the squatter.
- **False positives**: loopback listener that rejects any request without an unguessable per-launch secret the server and client share privately (not in logs, URLs other apps can read, or world-readable files); Unix domain socket in the app's private directory; listener compiled only into debug builds.
- **Fix**: prefer in-process APIs or a private-directory Unix socket; otherwise bind `127.0.0.1` on an ephemeral port (`0`), require a random per-session secret on every request, and have the client authenticate the server (shared secret or a pinned self-generated certificate) so a squatter cannot impersonate it; on Android `LocalSocket.getPeerCredentials().uid` must equal the app UID; on bind failure fail closed with a visible error; stop the listener when not in use.
- **Source**: Ceno/Ouinet 7ASecurity pentest https://7asecurity.com/reports/pentest-ouinet-ceno-RC1.2b.pdf OUI-01-016, OUI-01-017, OUI-01-018; https://github.com/localsend/localsend/security/advisories/GHSA-34v6-52hh-x4r4 (web-share server)
### MOB-56 Nearby sharing and P2P transfer: unauthenticated discovery and peer TLS · default P1 (P0 when files, keys or credentials move between peers and a same-network attacker can impersonate a peer without user action)
- **What to look for**: discovery over UDP multicast/broadcast, mDNS/Bonjour (`NsdManager`, `NWBrowser`, `multicast_dns`, `bonsoir`), BLE advertisements, Wi-Fi Direct, or DNS/DHT bootstrap; handlers that take the sender IP, alias or "fingerprint" field from an announcement and list it as a peer (or match it to a favourite/trusted device) without a cryptographic handshake; trusted peers keyed by IP, alias or device name instead of a pinned public key; peer TLS with self-generated certificates where the client accepts any certificate (`badCertificateCallback => true`, trust-all `SSLContext` or `URLSessionDelegate` used only for peer sockets) or computes a pin but does not enforce it (MOB-25); no QR/PIN/short-code comparison at first pairing and no warning when a known peer's key changes; bootstrap hostnames resolved over plain DNS with no authenticated fallback (blocking or redirecting the swarm); peer-supplied file names used as paths (MOB-42).
- **How to confirm**: from another host on the same Wi-Fi send a forged announcement claiming a known peer's identity (spoofed source IP or copied alias/fingerprint field) and check whether it appears as that peer; put an intercepting TLS endpoint between two devices and see whether the transfer proceeds; spoof DNS for bootstrap hosts.
- **False positives**: first pairing binds the peer's public key through an out-of-band check (QR code, PIN, short authentication string) and every later session uses mutual TLS pinned to that key; discovery data is used only as a hint before that check.
- **Fix**: give each device a long-term key pair; verify it out of band at pairing and pin it (TOFU at minimum, with a blocking warning on change); run transfers over mutual TLS (or Noise) bound to the pinned keys; never derive trust from IP or announced fields; sanitise received names (MOB-42); use authenticated bootstrap (DoH/pinned endpoints, signed fallback lists).
- **Source**: https://github.com/localsend/localsend/security/advisories/GHSA-424h-5f6m-x63f; Tella 3.0 audit https://tella-app.org/fr/assets/files/2026.07%20-%20Horizontal%20x%20Convocation%20Research+Design%20%20A%20Comprehensive%20Security%20Audit%20for%20Tella%203.0.0+-88536eebfe781b0c58f5df54006b3c51.pdf TELLA3-018, TELLA3-010; Ceno/Ouinet https://7asecurity.com/reports/pentest-ouinet-ceno-RC1.2b.pdf OUI-01-013
### MOB-57 Untrusted content rendered as HTML in hybrid/WebView app UI or app-served pages · default P1 (P0 when script runs in a page whose bridge exposes keys, signing, file access or account actions, MOB-36) · P2 (page served to other browsers with no session or bridge)
- **What to look for**: Cordova/Capacitor/Ionic, RN WebView, Flutter WebView and shared web/desktop UI code that puts mail, chat, contact, file-name or peer data into `innerHTML`/`outerHTML`/`insertAdjacentHTML`, `dangerouslySetInnerHTML`, `v-html`, `[innerHTML]`, jQuery `.html()`, template strings, or into selector strings parsed as markup (Mithril/hyperscript `m("a[href=" + x + "]")`, `querySelector` built from data); HTML templates the app serves from a local server that concatenate names (MOB-55); `injectJavaScript`/`evaluateJavascript` strings built from data; CSP missing or allowing `unsafe-inline`.
- **How to confirm**: put `<img src=x onerror=alert(1)>` and `][href=https://example.org][style=position:fixed;inset:0` into a contact field, file name or message and open the view; check which origin the view runs in and which bridge/plugins it can reach.
- **False positives**: data rendered via text APIs (`textContent`, framework text binding) or passed through a maintained sanitiser (DOMPurify) with a strict CSP; selector values escaped (`CSS.escape`) or passed as attributes objects.
- **Fix**: render untrusted data as text or attribute objects, never as markup or selector strings; sanitise rich content with DOMPurify in a sandboxed frame without bridge access; strict CSP (no inline script); pass data to `evaluateJavascript` as JSON, not code. Sink and sanitiser details: [WEB-29/30](../sec-web/refs/items-client.md), WEB-115; desktop shells WEB-130.
- **Source**: https://github.com/tutao/tutanota/security/advisories/GHSA-24v3-254g-jv85; https://github.com/localsend/localsend/security/advisories/GHSA-34v6-52hh-x4r4
---
## Self-check workflow
1. **Identify the stack**: `pubspec.yaml` → Flutter; `package.json` + `app.json`/`metro.config.js` → RN/Expo; `*.xcodeproj` / `build.gradle(.kts)` → native. Read the matching refs.
2. **Read the manifests**: merged `AndroidManifest.xml`, `network_security_config.xml`, `file_paths.xml`, `Info.plist` (each configuration), `*.entitlements`, `app.json`. Go through MOB-06/23/24/29/35/43 first.
3. **Find all secrets and storage writes**: search for the intersection of `token|secret|password|mnemonic|privateKey|apiKey` and storage APIs (MOB-01–05, 13); for wallets switch to WAL-01–09.
4. **Find all TLS and HTTP clients**: OkHttp/Retrofit, URLSession/Alamofire, Dart `HttpClient`/Dio/http, RN fetch/axios, WebView, each SDK (MOB-23–27).
5. **Find all external entry points**: exported components, deep links/App Links/Universal Links, notification actions, share extensions, clipboard, WebView bridges (MOB-29–42), local listeners and nearby/P2P endpoints (MOB-55/56), untrusted content rendered in hybrid UI (MOB-57). For each entry point write "who can call it → what it passes → what it triggers".
6. **Find biometrics and local authentication**: `LAContext`, `BiometricPrompt`, `local_auth`, `expo-local-authentication` (MOB-17–22).
7. **Check build and release**: release config, OTA, obfuscation, debug switches, SDK list (MOB-43–51).
8. **Run tools**: see README; tool results are only leads.
9. **Conclusion**: P0/P1 findings include `file:line` + exploitation path (attacker capability: same Wi-Fi, malicious app, physical access to an unlocked/locked device, rooted device) + impact; facts outside the repo such as signing configuration, assetlinks/AASA and backend verification are marked "needs-verification".
### Noise reduction: the following are usually **not** reported, or are downgraded to P3
- Data already in Keychain/Keystore that can only be read with root/jailbreak + physical access (this is the platform trust boundary itself).
- Firebase `apiKey`, restricted Maps keys, Stripe `pk_`, Sentry DSN appearing in the package (check Firebase Rules and key restrictions instead).
- Ordinary apps without certificate pinning, root detection or obfuscation (P3 recommendation); upgrade per item only for wallet/payment apps.
- Debug code only inside `src/debug/`, `#if DEBUG`, `kDebugMode`, `__DEV__` and removed at compile time.
- "Self-attacks" within the same OS user and the same app sandbox.
- **Cap the number of P3 hardening items**: P3 hardening items without a concrete exploitation path (overlay protection, permission requests, obfuscation, root detection, backup flags, etc., such as MOB-07/41/48–52) get at most 5 standalone findings per perspective; merge the rest into a "hardening list" appendix (one line each: location + one-sentence recommendation); in the client report these items all go into a single hardening summary table rather than separate sections. This is presentation only, not root-cause merging; issues with an exploitation path are still reported individually. Source: bench mobile-1.
---
## Audit perspectives
For a full audit, go through each of the four perspectives (can be split across sub-agents in parallel); each perspective outputs "checked list + findings" (write P3 hardening items according to the cap rule under "Noise reduction").
### 1. Local storage and keys
- List every class of data the app persists (token, refresh token, PIN, mnemonic/private key, PII, transaction records, cache, logs, screenshots) → location → encryption method → where the key lives → what happens to it on backup/migration/uninstall/logout.
- For Keychain/Keystore items, verify accessibility, `ThisDeviceOnly`, access control, biometric binding and invalidation policy.
- Items: MOB-01–16, MOB-17/18/22; WAL-01–09.
### 2. Network and backend trust
- Enumerate all HTTP stacks and domains: TLS validation, ATS/cleartext, pinning coverage, leftover debug proxies.
- Review the backend assuming "the attacker has the app package and can intercept traffic": secrets in the package, client-side authorization, request signing, OTP echo, whether integrity attestation is verified server-side.
- Items: MOB-13, MOB-19–21, MOB-23–28, MOB-51, MOB-56; WEB-01/02/05/08–14/48.
### 3. Platform interaction (IPC, deep links, WebView)
- Draw an entry point map: exported components, Intents/PendingIntents, Providers, broadcasts, deep links and verified links, extensions, notification actions, clipboard, shared files, local loopback/LAN listeners, every WebView (which origins it loads, which bridge methods it has, file access settings).
- For each entry point confirm: whether the caller's identity is verified, whether parameters are validated, whether current user confirmation is required, whether it can reach a sensitive sink (signing, transfers, token retrieval, file reads).
- Items: MOB-29–42, MOB-55, MOB-57; WAL-14, WAL-15; WEB-29/30/32.
### 4. Build, release and protections
- Check release builds: debuggable, entitlements, log stripping, WebView debugging, environment switching, obfuscation, symbols, SDK list and permissions, privacy manifest.
- Check the update chain: custody of the store signing key, OTA signing and anti-rollback, dynamic loading.
- Assess whether defense in depth matches asset value (wallet/payment: root/jailbreak signals, integrity attestation, overlay protection).
- Items: MOB-07, MOB-39, MOB-43–54.
---
## Further reading
- Framework specifics: [Flutter](refs/flutter.md) · [React Native / Expo](refs/react-native-expo.md) · [iOS / Swift](refs/ios-swift.md) · [Android / Kotlin](refs/android-kotlin.md)
- OWASP MASVS v2 (CC-BY-SA-4.0, IDs cited only): https://mas.owasp.org/MASVS/
- OWASP MASTG test cases and MASWE weakness catalog (CC-BY-SA-4.0, linked only): https://mas.owasp.org/MASTG/ · https://mas.owasp.org/MASWE/
- Android App security best practices / Security risks guides: https://developer.android.com/privacy-and-security/security-tips · https://developer.android.com/privacy-and-security/risks
- Android Lint security checks list: https://googlesamples.github.io/android-custom-lint-rules/checks/categories.md.html
- Apple Platform Security Guide: https://support.apple.com/guide/security/welcome/web
- RFC 8252 OAuth 2.0 for Native Apps: https://www.rfc-editor.org/rfc/rfc8252
- Wallet keys and signing: [sec-wallet-dapp](../sec-wallet-dapp/SKILL.md); backend API: [sec-web](../sec-web/SKILL.md)