Skip to content

Interview question · Mobile Application Security

How does the Android application sandbox work, and what role do app signing and permissions play?

The sandbox is a Linux user ID, SELinux and a signature that decides who you are. Get those three right and most Android security questions become reasoning rather than recall.

easyEssentialNewPreparation tags: Google, Meta, MicrosoftUpdated Nov 2026

TL;DR: Each Android app is installed with its own Linux user ID, so the kernel's ordinary file and process isolation keeps apps apart, and SELinux adds a mandatory policy on top that confines apps even further. The app's signing certificate is its identity: updates must be signed with the same key, and signature-level permissions are granted only to apps signed by the same key as the app that defined them. Permissions gate access to sensitive platform resources: normal ones are granted at install, dangerous ones (camera, location, contacts) need the user's consent at runtime, and signature ones only go to apps from the same signer. An app's private files, its exported components and its signing key are therefore the three things to get right.

How to approach it

Explain isolation (UID plus SELinux), identity (signing) and authority (permissions) as three separate mechanisms, then show how they combine when one app talks to another. Finish with what breaks each one: a leaked signing key, an exported component with no permission, and a rooted device.

A strong answer

FIG · ANDROID APP ISOLATION · FOUR LAYERS
Kernel identity, mandatory policy, permissions and the signing key
  1. 1

    1 · Linux UID per app

    Kernel file and process isolation

    • Private data directory readable only by that UID
  2. 2

    2 · SELinux

    Mandatory policy over every app domain

    • Confines apps even where file permissions would allow
  3. 3

    3 · Permissions

    Normal, dangerous (runtime), signature

    • Signature-level permissions only for apps with the same signer
  4. 4

    4 · Signing certificate

    The app's identity

    • Updates must match it or follow its rotation lineage

Isolation by user ID. At install, the package manager assigns the app a unique UID. Its private directory (/data/data/<package>, or the per-user equivalent) is owned by that UID with permissions that exclude others, and its processes run as that UID. Another app cannot read those files or attach to those processes without root. Android layers SELinux in enforcing mode over this: apps run in confined domains (such as untrusted_app) whose policy limits what even a compromised app process can touch in the system. Native code in an app runs in the same sandbox; writing in C does not escape it.

Identity by signature. An APK is signed with the developer's key (with Play App Signing, Google holds the app signing key and the developer signs uploads with a separate upload key). The platform uses the certificate to decide:

  • whether an update may replace an installed app (same signer, or a valid key rotation),
  • whether a signature-level permission may be granted,
  • whether two apps may share data through mechanisms restricted to the same signer.

A stolen signing key lets an attacker ship an "update" that inherits the app's data and trust, which is why release keys belong in hardware-backed storage with tight access.

Authority by permission.

LevelGrantedExample
NormalAutomatically at installInternet access
Dangerous (runtime)User prompt, revocableCamera, location, contacts, microphone
SignatureOnly to apps signed by the same key as the defining appA company's own apps sharing a private service
SpecialSettings screens, high frictionDraw over other apps, accessibility service, install unknown apps

Special permissions such as accessibility and overlay are what Android banking malware typically asks users for, because they allow reading screen contents and drawing fake interfaces.

Crossing the boundary on purpose. Apps talk through intents, bound services, broadcast receivers and content providers. A component that other apps may call must be exported, and since Android 12 an app that declares intent filters must state android:exported explicitly. The receiving component should require a permission (often signature-level for internal use) and validate everything it receives, because the caller may be any app on the device.

What breaks the model.

  • Exported components without permission checks: another app invokes privileged functionality or reads data.
  • Data written outside the sandbox: shared storage, logs, the clipboard, or backups that include sensitive files.
  • A rooted device: the owner (or malware with root) can read any app's files and instrument its process.
  • A leaked signing key: forged updates.

What interviewers probe next

  • "Does writing the sensitive part in native code protect it?" No. Native code runs in the same sandbox under the same UID; it is only harder to read, not isolated.
  • "How would two apps from the same company share a secret safely?" A service or provider protected by a signature-level permission, with the secret released only after checking the caller, or better, each app fetching its own credential from the server.
  • "What changes on a rooted device?" The UID boundary no longer holds against the owner, so on-device secrets and checks are readable and modifiable; the server must not rely on them.

What if?

What if · interview follow-ups

Hold your answer as the constraints change

A colleague asks what stops a malicious app on the same Android phone from reading your app's database.

  1. Start here

    What isolates apps on Android?

How it's scored

Weak: "Apps are sandboxed and need permissions."

Hire: Explains per-app UIDs and private storage, signing as update identity, and normal versus dangerous versus signature permissions.

Strong Hire: Adds SELinux confinement, Play App Signing and key protection, special permissions abused by malware, exported components and the Android 12 exported rule, and lists what breaks each mechanism.

Common mistakes

  • Believing native code escapes or strengthens the sandbox.
  • Forgetting that signature permissions depend on protecting the signing key.
  • Exporting components with intent filters and no permission requirement.
  • Treating files on shared storage as private.
You just read a free answer. Every topic opens its first 5 answers to anyone. Sign in and the count per topic goes to 10, and we keep track of how far you get in every topic.Google sign-in · free · no payment details
HOW DID IT GO?
0
READING SIGNED OUT

Signing in doubles your free answers, from 5 to 10 per topic, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free
UP NEXT ON YOUR JOURNEY
DISCUSSION · 0

No comments yet. Share a correction or a different way to answer it.