Android App Security

The Android-specific attack surface: the app sandbox and its IPC (intents, exported components, ContentProviders), local storage, WebViews, native and dynamic code, and the platform mitigations (SELinux, Verified Boot, Play Integrity) that app and OS security test against.

The sandbox and what breaks it

Each app gets its own UID and a private data directory; SELinux confines a normal app to the untrusted_app domain. Most Android app bugs are failures to respect that boundary at an IPC edge, not memory corruption. The canonical mistakes:

  • Exported components. An android:exported="true" Activity/Service/Receiver (or one with an intent filter) is reachable by any installed app. Dangerous when it forwards attacker data to a privileged sink — see Mobile OAuth and Deep Link Attacks for intent redirection and deep-link abuse.
  • ContentProviders. exported="true" + grantUriPermissions providers that build SQL from caller input are still exploitable by SQL Injection (Ostorlab’s Yahoo Weather example) or leak/write files. GitHub Security Lab’s AI taskflows found exported MapActivity in OsmAnd (10M+ installs) accepting silent_import/replace extras to plant tracking config.
  • FileProvider misconfig. A library shipping exported="true" on an Activity plus root-scoped <paths> (com.canhub:android-image-cropper) gave any app an arbitrary-file-overwrite primitive in every consumer — the default was the vuln, not the integrator.
  • Dynamic code loading + path traversal → RCE (Adobe Acrobat for Android, CVE-2021-40724 class).
  • Exported everything (AndroGoat). One exported="true" attribute undid four gates: adb shell am start opened a PIN-protected Activity directly, am startservice triggered a download service, am broadcast was accepted with no sender check, and a custom scheme (androgoat://vulnapp) reached the same Activity. Default to exported="false"; if a component must be exported, gate it with a signature-level permission and check getCallingUid()/getCallingPackage() AndroGoat.

Local data exposure

  • Insecure storage. Secrets in SharedPreferences, plaintext files, or logs. allowBackup=true can push “local” data to cloud/ADB backups — set android:allowBackup="false". Insecure logging leaks secrets to logcat in plaintext (grep over a log stream), bypassing at-rest thinking.
  • EncryptedSharedPreferences is deprecated. Jetpack Security Crypto was abandoned over Keystore inconsistencies across OEMs/versions; Google now steers to Jetpack DataStore + Google Tink (AEAD) with hardware-backed Keystore keys. Best practice remains: don’t persist secrets at all, else encrypt before disk.
  • Clipboard. Since Android 12 a toast warns when an app reads the clipboard; a 2025 technique hides that toast with no permission (Google rated it Moderate, Won’t Fix), so copied passwords/2FA codes remain readable by the next app.
  • Keystore / biometrics. BiometricPrompt, Credential Manager and hardware-backed Keystore are the correct primitives; client-side role/authZ checks are bypassable with Frida.
  • AndroGoat storage and side channels AndroGoat:
    • Plaintext credentials in shared_prefs/*.xml, an unencrypted SQLite users table, File.createTempFile() leftovers in the data dir, and credentials on /sdcard/Android/data/<pkg>/files/ that persist after uninstall.
    • A score in SharedPreferences edited from 200 to 10,000: anything with business value stored client-side needs a MAC and server-side authority.
    • Credential fields without textNoSuggestions (keyboard learning), credentials logged to logcat, an OTP copied to the global clipboard.
    • Hardcoded promo code, OpenAI key and live AWS keys (listing real S3 buckets) — use a backend or short-lived scoped credentials (e.g. Cognito). See Hardcoded Secrets.
    • android:debuggable="true" in release: adb forward tcp:7777 jdwp:<pid> plus jdb gives live control. MD5-hashed PIN. An isAdmin boolean flipped with Frida. A biometric failure callback hooked into the success path; bind BiometricPrompt to a CryptoObject the server can verify.

WebView, native and cross-platform

  • WebView is the single largest Android bug source — its own page: WebView Vulnerabilities (addJavascriptInterface RCE, UXSS, file/content access, auth-header injection).
  • Cross-platform frameworks widen the surface: Flutter ships its own TLS stack (see Certificate Pinning Bypass); .NET MAUI compiles shared C# that decompiles cleanly with ILSpy (Bishop Fox), so a single bug hits both platforms.
  • Native .so code is reached via JNI; reverse with JADX (DEX→Java) + Ghidra. R8/ProGuard obfuscation raises cost but DEX decompiles far more cleanly than a stock iOS binary.

Platform mitigations and their failure modes

  • Play Integrity / key attestation is undermined by leaked keyboxes — genuine attestation private keys that forge Strong/Device verdicts for any app/device state (Promon found one in a repackaged Hirudo banking app; a survey of 551 public keyboxes found all 551 revoked). Google’s move to Remote Key Provisioning (RKP) changes the economics. See Jailbreak and Root Detection Bypass.
  • ADB over on-device loopback enables LPE chains (CVE-2026-0073, adbd zero-click RCE); Google is considering restricting on-device ADB, which would also break Shizuku-style tooling.
  • OEM additions are a weak point. OxygenOS AtlasService/OLC2 HAL chained untrusted_app→root on OnePlus 15 with no permissions (151+ devices patched). Firmware access-control analysis (Callix) found 819 vulnerable paths across 1,750 preinstalled apps.
  • Repackaging. Attackers keep the package name, re-sign with their own key, add a DEX payload (SkyHook embeds a Frida agent; Hirudo hides accessibility services and strips FLAG_SECURE). Detect by package-name/signature mismatch (Promon’s Koodous sweeps).
  • AI-assisted banking malware. Bazuka and ArcticRAT pair local LLMs with fake overlays and ADB debugging to automate financial theft and target selection (partial article) Ismail Tasdelen.

Testing

Decompile with jadx/apktool; scan with MobSF/mobsfscan or Fridexa (redacted evidence with file:line snapshots and generated Frida scripts, explicitly not runtime proof Fridexa); instrument with Frida/Objection; intercept via Certificate Pinning Bypass; verify against MASVS/MASTG. Setup: rooted device or emulator (Magisk), frida-server, Burp/mitmproxy. See the hub for the full toolchain.

Sources