Mobile Application Security

Mobile Application Security

A mobile app runs on a device the user — or an attacker — physically owns: it can be inspected, rooted/jailbroken, instrumented, and run under a debugger, so the client is fully untrusted and the server stays authoritative. This lesson builds the mobile threat model across three trust boundaries (device, network, neighbouring apps), then walks app sandboxing and the iOS/Android permission models, insecure data-at-rest storage (the #1 mobile risk), insecure communication (TLS, hostname verification, certificate pinning), authentication/authorization and session handling for native apps, platform crypto primitives (Keychain/Keystore and biometrics), reverse engineering / tampering / anti-resilience controls, mobile malware and side-loading risk, enterprise mobility (MDM/MAM/BYOD), and the OWASP MAS frameworks and testing methodology that tie it all together.

The ten pillars of mobile application security

From the untrusted-device threat model to the OWASP MAS testing methodology — each grounded in real ATT&CK Mobile technique IDs, CVE/CWE numbers, OWASP MAS codes, and RFC/NIST/ISO references.

1

The mobile threat model — untrusted device, untrusted network

Key points

  • Core premise: unlike a server you control, a mobile app runs on a device the user (or an attacker) physically owns and can inspect, modify, root/jailbreak, or run under a debugger. Treat the client as fully untrusted: any secret shipped in the binary is already disclosed, and any client-side security check can be bypassed.
  • Three trust boundaries define mobile risk: (1) the device/OS (lost, stolen, rooted, or malware-infected), (2) the network (hostile Wi-Fi, rogue access points, on-path/MITM attackers), and (3) other apps on the device (IPC, shared storage, clipboard, deep links).
  • Initial access on mobile commonly comes via phishing/smishing, malicious or trojanized apps, drive-by compromise of the mobile browser, and software/kernel exploitation including zero-click chains delivered over messaging.
  • Real-world severity anchor: the FORCEDENTRY zero-click iMessage exploit (CVE-2021-30860, a CoreGraphics integer overflow) and the earlier 'Trident' iOS jailbreak chain (CVE-2016-4655, CVE-2016-4656, CVE-2016-4657) used by Pegasus spyware show that exploitation-for-initial-access can require zero user interaction.
  • Server-side controls remain authoritative: authorization, rate limiting, input validation, and business-logic enforcement must all be re-checked on the backend because the mobile client can be tampered with.

References

MITRE ATT&CK Mobile T1660 — Phishing
MITRE ATT&CK Mobile T1456 — Drive-By Compromise
MITRE ATT&CK Mobile T1664 — Exploitation for Initial Access
MITRE ATT&CK Mobile T1404 — Exploitation for Privilege Escalation
CVE-2021-30860
CVE-2016-4655
CVE-2016-4656
CVE-2016-4657
OWASP MASVS (Mobile Application Security Verification Standard) v2.1
NIST SP 800-163 Rev.1 — Vetting the Security of Mobile Applications
2

App sandboxing and the platform permission models

Key points

  • Both platforms isolate apps in a sandbox: iOS gives each app a unique container and enforces code signing + entitlements; Android assigns each app a distinct Linux UID and isolates app data under per-app directories, with SELinux mandatory access control enforced kernel-side.
  • Permission models are user-mediated and runtime-scoped: Android requests dangerous permissions at runtime (since Android 6.0) and supports one-time and 'while using the app' grants; iOS prompts per resource (location, camera, contacts, photos, tracking) and exposes purpose strings.
  • Least privilege applies to permissions: request only what the feature needs, declare purpose strings honestly, and prefer scoped access (Android Scoped Storage, iOS limited Photos access) over broad grants. Over-permissioned apps expand the attack surface and violate privacy expectations.
  • Inter-process surfaces are part of the sandbox boundary: Android exported components (Activities, Services, BroadcastReceivers, ContentProviders), implicit intents, and deep links / App Links must be access-controlled; iOS URL schemes and Universal Links must validate caller and payload. Misconfigured IPC is a classic privilege/data-leak vector.
  • Side-channels that bypass intent of the sandbox: clipboard, screenshots/app snapshots, logcat/unified logging, and shared 'external' storage are all readable by other apps or the user and must never carry secrets.

References

OWASP MASVS-PLATFORM
OWASP Mobile Top 10 (2024) M8: Security Misconfiguration
OWASP Mobile Top 10 (2024) M6: Inadequate Privacy Controls
CWE-926 — Improper Export of Android Application Components
CWE-250 — Execution with Unnecessary Privileges
CWE-200 — Exposure of Sensitive Information to an Unauthorized Actor
MITRE ATT&CK Mobile T1626 — Abuse Elevation Control Mechanism
NIST SP 800-124 Rev.2 — Guidelines for Managing the Security of Mobile Devices in the Enterprise
3

Insecure data storage — the #1 mobile risk (data-at-rest)

Key points

  • The most common and impactful mobile flaw: storing sensitive data (credentials, tokens, PII, keys) in plaintext or in world-readable/unprotected locations such as SharedPreferences/NSUserDefaults, SQLite databases, plist/XML files, cache, or external storage.
  • Cleartext storage and missing encryption are the root weaknesses; on a rooted/jailbroken device or via a backup, an attacker reads these directly. Never roll your own 'encryption' by obfuscation — store keys in hardware-backed key stores, not in the file you are trying to protect.
  • Use platform key storage as the trust anchor: iOS Keychain (with appropriate accessibility classes like kSecAttrAccessibleWhenUnlockedThisDeviceOnly and, where available, Secure Enclave) and the Android Keystore (hardware-backed / StrongBox where present). Sensitive blobs should be encrypted with keys that never leave the secure hardware.
  • Beware unintended data leakage paths: debug logs, crash reports/analytics, keyboard caches, auto-generated app snapshots, and platform/cloud backups (iCloud, Android Auto Backup) can exfiltrate secrets — exclude sensitive items from backup and disable verbose logging in release builds.
  • Adversary view: on a compromised device, stored app data and credential stores are read directly, and tokens are stolen for account takeover, so storage hygiene plus short-lived, revocable tokens limits blast radius.

References

OWASP Mobile Top 10 (2024) M9: Insecure Data Storage
OWASP MASVS-STORAGE
CWE-312 — Cleartext Storage of Sensitive Information
CWE-311 — Missing Encryption of Sensitive Data
CWE-922 — Insecure Storage of Sensitive Information
CWE-921 — Storage of Sensitive Data in a Mechanism Without Access Control
CWE-215 — Insertion of Sensitive Information Into Debugging Code
MITRE ATT&CK Mobile T1409 — Stored Application Data
MITRE ATT&CK Mobile T1533 — Data from Local System
MITRE ATT&CK Mobile T1635 — Steal Application Access Token
4

Insecure communication — TLS, hostname verification, certificate pinning

Key points

  • Data-in-transit must use modern TLS (prefer TLS 1.3, minimum TLS 1.2) with full certificate-chain validation per X.509 and correct hostname/SAN verification — never disable validation, accept all certs, or trust user-added CAs for sensitive traffic.
  • The classic failure is improper certificate validation (custom TrustManager that accepts everything, ignored hostname mismatch), enabling on-path interception of credentials and tokens on hostile networks.
  • Platform transport hardening: Apple App Transport Security (ATS) enforces HTTPS + TLS minimums by default; Android Network Security Configuration lets you forbid cleartext (cleartextTrafficPermitted=false) and restrict trusted CAs. Use these declarative controls rather than ad-hoc per-connection code.
  • Certificate / public-key pinning binds the app to an expected server identity to resist a fraudulent-but-valid CA-issued certificate; pin to a SPKI hash, keep backup pins, and plan rotation. Note that HTTP Public Key Pinning (HPKP, RFC 7469) is deprecated for browsers — pinning on mobile is done in-app, not via the HPKP header.
  • Defense-in-depth: combine HSTS on web endpoints, no mixed cleartext fallbacks, and treat pinning as an obstacle to interception/instrumentation rather than a complete anti-MITM guarantee, since pinning itself can be bypassed on an instrumented device.

References

OWASP Mobile Top 10 (2024) M5: Insecure Communication
OWASP MASVS-NETWORK
CWE-319 — Cleartext Transmission of Sensitive Information
CWE-295 — Improper Certificate Validation
RFC 8446 — TLS 1.3
RFC 5280 — Internet X.509 PKI Certificate and CRL Profile
RFC 6125 — Service Identity Verification in TLS
RFC 6797 — HTTP Strict Transport Security (HSTS)
RFC 7469 — Public Key Pinning Extension for HTTP (deprecated)
MITRE ATT&CK Mobile T1521 — Encrypted Channel
5

Authentication, authorization, and session handling

Key points

  • Improper credential usage: hardcoded API keys/secrets in the binary, reused credentials, and credentials sent or stored insecurely. Anything compiled into the app is recoverable by reverse engineering, so it is not a secret.
  • Use the right OAuth flow for native apps: the Authorization Code flow with PKCE in the system browser / authorization agent (not an embedded WebView), never the implicit flow, and never embed client secrets in a public client.
  • Session/token handling: prefer short-lived access tokens with refresh tokens stored in Keychain/Keystore, bind sessions server-side, support revocation/logout, and never rely on client-side-only authorization decisions — the server must enforce every access check.
  • Multi-factor and step-up: support MFA and phishing-resistant authentication (FIDO2/WebAuthn passkeys) where possible; follow NIST SP 800-63B for authenticator and session lifecycle requirements.
  • Avoid client-side trust pitfalls: client-side authentication, predictable session IDs, and 'reliance on a single factor' for sensitive operations are common, exploitable weaknesses.

References

OWASP Mobile Top 10 (2024) M1: Improper Credential Usage
OWASP Mobile Top 10 (2024) M3: Insecure Authentication/Authorization
OWASP MASVS-AUTH
CWE-798 — Use of Hard-coded Credentials
CWE-603 — Use of Client-Side Authentication
CWE-654 — Reliance on a Single Factor in a Security Decision
RFC 8252 — OAuth 2.0 for Native Apps
RFC 7636 — Proof Key for Code Exchange (PKCE)
RFC 6238 — TOTP
NIST SP 800-63B — Digital Identity Guidelines: Authentication and Lifecycle Management
6

Platform crypto primitives — Keychain/Keystore and biometric authentication

Key points

  • Use platform cryptography, not homegrown schemes: rely on vetted libraries and avoid weak/broken algorithms (DES, RC4, MD5, SHA-1 for security), ECB mode, hardcoded keys/IVs, and insufficiently random values.
  • Hardware-backed key storage: iOS Secure Enclave and Android Keystore (with StrongBox on supported hardware) generate and use keys that are non-exportable; gate cryptographic operations behind device unlock and/or user authentication.
  • Biometric auth done right: Face ID/Touch ID via LocalAuthentication and Android BiometricPrompt should be used to release/authorize a hardware-bound key (setUserAuthenticationRequired), not as a boolean 'isAuthenticated' the app trusts. A returned 'true' on a tampered device is meaningless unless tied to a Keystore/Keychain operation.
  • Set correct accessibility/protection: iOS Keychain accessibility classes (e.g., WhenUnlockedThisDeviceOnly) and Android key auth-validity windows define when keys are usable; choose the most restrictive class the UX allows and avoid AlwaysAccessible.
  • Consider passkeys (FIDO2/WebAuthn) as a phishing-resistant, hardware-backed replacement for passwords, leveraging the same secure-element protections.
  • Match crypto to data sensitivity and rotate keys; insufficient cryptography (weak algorithm/short key/poor key management) is an explicit Mobile Top 10 category.

References

OWASP Mobile Top 10 (2024) M10: Insufficient Cryptography
OWASP MASVS-CRYPTO
CWE-327 — Use of a Broken or Risky Cryptographic Algorithm
CWE-326 — Inadequate Encryption Strength
CWE-330 — Use of Insufficiently Random Values
CWE-321 — Use of Hard-coded Cryptographic Key
NIST SP 800-63B — Digital Identity Guidelines (biometrics as authentication factor)
RFC 9106 — Argon2 (recommended password-based KDF)
7

Reverse engineering, tampering, and anti-resilience controls

Key points

  • Mobile binaries are distributed to attackers: APK/IPA can be decompiled (jadx, Hopper, Ghidra) and instrumented dynamically (Frida, objection, Xposed) to read secrets, bypass checks, and hook crypto/network calls.
  • Insufficient binary protections is its own risk class: lack of code obfuscation, missing integrity checks, and absent anti-tamper controls make repackaging and logic bypass cheap.
  • Resilience controls (defense-in-depth, not primary security): root/jailbreak detection, anti-debugging/anti-hooking, emulator detection, code/string obfuscation (e.g., R8/ProGuard, commercial protectors), and runtime integrity/attestation. These raise attacker cost but must never be the only line of defense.
  • Critical caveat: obfuscation and client-side detection are 'security through obscurity' — a determined attacker on a controlled device defeats them. Keep authoritative secrets and authorization on the server; use platform attestation (Play Integrity API, Apple App Attest / DeviceCheck) as a server-validated signal rather than a client-trusted verdict.
  • Adversary techniques map to obfuscation, runtime code loading, and subverting trust/signing controls when repackaging or downloading malicious payloads at runtime.

References

OWASP Mobile Top 10 (2024) M7: Insufficient Binary Protections
OWASP MASVS-RESILIENCE
CWE-656 — Reliance on Security Through Obscurity
CWE-693 — Protection Mechanism Failure
MITRE ATT&CK Mobile T1406 — Obfuscated Files or Information
MITRE ATT&CK Mobile T1407 — Download New Code at Runtime
MITRE ATT&CK Mobile T1632 — Subvert Trust Controls
MITRE ATT&CK Mobile T1404 — Exploitation for Privilege Escalation
8

Mobile malware and side-loading risk

Key points

  • Side-loading and third-party app stores bypass platform review, the primary vector for trojanized and fake apps; Android allows installs from unknown sources, while iOS sideloading historically required enterprise certs or, in some regions, alternative marketplaces.
  • Common malware capabilities: overlay/GUI input capture to phish credentials, keylogging, accessibility-service abuse, screen capture, SMS interception for OTP theft, and location tracking/surveillance (spyware/stalkerware).
  • Supply-chain risk inside the app itself: malicious or vulnerable third-party SDKs and dependencies, and compromised build tooling, can inject malware into otherwise legitimate apps — exemplified historically by the XcodeGhost campaign that trojanized iOS apps via a tampered Xcode.
  • Defenses: install only from official stores, keep 'install unknown apps' disabled, verify publisher and permissions, keep OS/apps patched against known exploited vulnerabilities (e.g., Stagefright, CVE-2015-1538), and use mobile threat defense (MTD) on managed fleets.
  • Persistent/advanced threats: nation-state spyware (e.g., Pegasus) chains zero-click exploits with privilege escalation and stealthy C2 over standard application-layer protocols.

References

OWASP Mobile Top 10 (2024) M2: Inadequate Supply Chain Security
MITRE ATT&CK Mobile T1474 — Supply Chain Compromise
MITRE ATT&CK Mobile T1417.001 — Input Capture: Keylogging
MITRE ATT&CK Mobile T1417.002 — Input Capture: GUI Input Capture
MITRE ATT&CK Mobile T1513 — Screen Capture
MITRE ATT&CK Mobile T1430 — Location Tracking
MITRE ATT&CK Mobile T1437 — Application Layer Protocol
MITRE ATT&CK Mobile T1655 — Masquerading
CVE-2015-1538
9

Enterprise mobility — MDM, MAM, and BYOD

Key points

  • Mobile Device Management (MDM) enforces device-level policy (passcode complexity, disk encryption, OS patch level, remote lock/wipe, jailbreak/root detection, app allow/deny) via the platform MDM protocols (Apple MDM, Android Enterprise/Android Management API).
  • Mobile Application Management (MAM) protects corporate data at the app level (managed app config, per-app VPN, copy/paste and 'open-in' containment, selective wipe of work data) — essential for BYOD where the company cannot fully wipe a personal device.
  • Android Enterprise work profile and iOS User Enrollment create a managed/personal split so IT controls only corporate data and apps, preserving employee privacy while containing leakage.
  • Layer enterprise controls: conditional access tied to device compliance, app vetting before distribution, certificate-based auth, and Mobile Threat Defense integration for runtime detection.
  • Follow recognized guidance for the full lifecycle (provisioning, configuration, monitoring, deprovisioning) and align with an ISMS control set.

References

NIST SP 800-124 Rev.2 — Guidelines for Managing the Security of Mobile Devices in the Enterprise
NIST SP 800-163 Rev.1 — Vetting the Security of Mobile Applications
ISO/IEC 27001:2022 — Information Security Management Systems
ISO/IEC 27002:2022 — Information Security Controls (incl. mobile device & teleworking controls)
MITRE ATT&CK Mobile T1626 — Abuse Elevation Control Mechanism
10

OWASP MAS frameworks and testing — MASVS, MASTG, Mobile Top 10, ATT&CK Mobile

Key points

  • Distinguish the three OWASP artifacts: the Mobile Top 10 is an awareness/risk ranking; MASVS is the verification standard (the 'what' — security requirements by category); MASTG (Mobile Application Security Testing Guide) is the testing manual (the 'how' — concrete static/dynamic test cases) plus the MAS Checklist linking them.
  • MASVS v2.x organizes requirements into eight control groups: MASVS-STORAGE, MASVS-CRYPTO, MASVS-AUTH, MASVS-NETWORK, MASVS-PLATFORM, MASVS-CODE, MASVS-RESILIENCE, and MASVS-PRIVACY. MASVS-RESILIENCE/anti-tamper is treated as defense-in-depth, applicable to high-risk apps.
  • Build a test workflow: static analysis (decompile, secret scanning, manifest/entitlement review), dynamic analysis (intercept TLS, attempt pinning bypass on a controlled device, inspect storage at runtime), and IPC/deep-link fuzzing — driven by MASTG test cases and recorded against the MAS Checklist.
  • Map adversary behavior with the ATT&CK Mobile matrix to design detections and prioritize controls (initial access, credential access, collection, exfiltration), complementing the requirement-driven MASVS view with a threat-driven view.
  • Integrate findings into SDLC: shift-left with SAST/dependency scanning, gate releases on MASVS conformance for the app's risk tier, and re-test after dependency or platform updates (MASVS-CODE: keep the app and its components patched).

References

OWASP MASVS v2.1 — Mobile Application Security Verification Standard
OWASP MASTG — Mobile Application Security Testing Guide
OWASP Mobile Top 10 (2024)
OWASP MASVS-CODE
OWASP MASVS-PRIVACY
MITRE ATT&CK for Mobile (matrix)
OWASP Mobile Top 10 (2024) M4: Insufficient Input/Output Validation

Verify against the standard

Turn these principles into checks: take an app through the OWASP MASVS control groups and the MASTG test cases — static analysis, TLS interception, a pinning-bypass attempt, and runtime storage inspection — recording each result against the MAS Checklist for the app's risk tier.