Situation & scope
Threat model for a mobile banking app that stores auth/access tokens, supports biometric login, and calls backend APIs.
Assets
- User credentials and refresh/access tokens
- Biometric auth assertion (local)
- PII / account balances / transaction history
- Session cookies, MFA secrets, device identifiers
- App binary & signing keys, TLS certs
Threat actors
- Remote attacker (MITM, API abuse)
- Local attacker (device thief, rogue app)
- Insider (backend misuse)
- OS compromise (root/jailbreak, malicious drivers)
- Supply-chain attacker (tampered SDK)
Attack vectors
- Token theft from storage or memory
- Biometric bypass or replay
- MITM / cert spoofing
- Side-loading, instrumentation, code tampering
- Jailbreak/root enabling privileged access
- Insecure session management (long-lived tokens)
Mitigations — App layer
- Store tokens in hardware-backed keystore/Secure Enclave (iOS Keychain with kSecAttrAccessControl + biometry; Android Keystore with StrongBox when available)
- Use short-lived access tokens + refresh tokens; bind refresh to device + rotate on logout
- Require biometric + device PIN (local auth as second factor) and use LocalAuthentication APIs without exporting biometrics
- Certificate pinning (public-key pinning with fallback/rollover) and strict hostname verification
- Runtime integrity: obfuscation, tamper detection, detect debugger/Frida, verify signature
- Jailbreak/root checks (multiple heuristics: protected paths, su binary, unusual permissions) but treat as signal — restrict high-risk features or require re-authentication
Mitigations — OS / platform
- Prefer Secure Enclave / StrongBox; mark keys non-exportable, require user presence for sensitive ops
- Use system-provided biometrics APIs (no custom biometric data storage)
- Minimize permissions; use Android SafetyNet / Play Integrity or iOS DeviceCheck for device attestation
- Enforce App Transport Security (iOS) / Network Security Config (Android)
Mitigations — Network / backend
- TLS 1.2+/mTLS for sensitive endpoints; enforce cipher suites
- Certificate pinning server-side rotation plan; monitor pin failures
- Backend: token binding to device fingerprint, anomaly detection, revoke on compromise
- Rate-limit, enforce strong auth flows (OAuth 2.0 best practices), server-side session expiry and refresh policies
Session & key lifecycle
- Short-lived access token, refresh token encrypted in keystore, bind refresh token to device key (sign token requests with asymmetric key in Secure Enclave)
- On logout or detected compromise: revoke tokens server-side and wipe local keystore
- Wipe sensitive data on app background/timeout
Trade-offs & residual risk
- Root/jailbreak detection can produce false positives; prefer feature restrictions over blocking.
- Pinning increases operational complexity (rollover pins).
- Hardware-backed keys not available on all devices — degrade gracefully but limit features.
This design balances usability with strong platform-backed protections appropriate for banking-grade security.