Seyed Masoud Hosseini · Overview · Study log · Weekly summaries · Ideas · Search · Transcript · RSS feed
Computer Security · Lecture 19 of 22 · 1:22:00
Lecture 20: Mobile Phone Security
Study guide
What this lecture covers
This lecture treats Android as a case study in a system designed with security in mind from the start, unlike Unix or web browsers where security was added later. It walks through how an Android application is structured into components, how permissions ("labels") are declared and enforced, and why some resources are checked by a central reference monitor while others are enforced directly through Linux user and group IDs.
It follows the Android security paper and sits alongside the course's earlier Unix and browser security material, reusing ideas like UID-based isolation from an earlier lab. After watching, you should be able to describe Android's four component types, explain how the reference monitor mediates intents, and identify concrete weaknesses in how permission labels are defined and checked.
Key ideas
- Reference monitor: a central Android process that mediates intents (inter-app messages) between applications and checks permission labels before delivering them.
- Components: every Android app is built from activities (UI), services (background work), content providers (SQL-like data storage), and broadcast receivers (system-wide messages), rather than one monolithic program.
- Manifest: an XML file listing an app's requested permissions and the permissions required to interact with its components, letting the framework enforce a security policy separately from the app's code.
- Labels as strings: permissions are arbitrary, developer-defined strings (like
dial perm), not centrally allocated identifiers, which makes them flexible but vulnerable to naming collisions. - UID/GID enforcement: performance-sensitive resources like network sockets, SD card access, and hardware devices are checked directly by the Linux kernel via group membership, not routed through the reference monitor.
- Explicit vs. implicit intents: explicit intents name a target component and can be checked by the receiver; implicit intents let the reference monitor choose a suitable, sufficiently-permissioned app.
- Label types:
normalpermissions are granted silently,dangerousones require user approval at install time, andsignaturepermissions are only granted to apps signed with the same developer key. - First-come, first-served labels: because nothing ties a permission string to its "true" owner, a malicious app installed first can define a label's type and description before the legitimate app does.
Walkthrough
Threat model and application components (2:02)
The lecture opens by framing the threat model: malicious apps that want to steal data or trigger paid actions (SMS, calls), and buggy apps written by non-expert developers. It notes Android still has CVE-tracked bugs like buffer overflows and bad crypto defaults, but argues the design keeps these manageable. It then introduces the four component types — activity, service, content provider, broadcast receiver — noting that only one activity receives user input at a time, which helps prevent one app from grabbing another's screen taps.
Manifests, labels and the reference monitor (9:07)
Each app ships with Java code plus a manifest describing its own permissions and the permissions required to reach its components. Cross-app communication happens through intents — structured messages naming a component, an action, and data — routed through a reference monitor that sits between apps and the kernel via a Tor-like pipe mechanism called binder. Class discussion establishes why permission checks live in the reference monitor rather than the sender (an untrusted, possibly compromised app) or the receiver (would require every developer to get the check right): centralizing it in one audited, always-invoked place is simpler and reduces the chance of an app bug leaking a permission check.
Why not desktop or web apps (27:21)
A class discussion compares Android's model to desktop apps (no isolation between installed programs, but easy file sharing between them) and web apps (strong same-origin isolation and easy deployment, but at the time no APIs for phone hardware, limited cross-app sharing, and poor offline support). Android's component model is presented as a middle path: isolated like a web app but with a broker (the reference monitor) that lets apps request specific, mediated interactions with each other and with hardware.
UIDs, GIDs and enforcing permissions outside intents (43:29)
Not everything goes through the reference monitor for performance reasons. Network sockets, SD card access, and direct hardware access (camera, GPS) are gated by Linux kernel group membership instead: a permission string like android.permission.internet maps to a magic GID, and the kernel simply refuses the underlying system call if the calling process lacks that GID. Each app also gets a private directory that only its own UID can read, which is how content-provider databases stay isolated without going through intents at all.
Where permission strings and label types come from (1:00:38)
Labels are not predefined by Android; they are contracts an app defines when it wants to protect one of its own components, and other apps request them by string name. A label carries a type: normal (silently granted), dangerous (shown to the user at install time, who can only accept or reject the whole permission list, not pick individual ones, in the paper's version of Android), and signature (granted only to apps signed with the same key, useful for letting a developer's own apps cooperate without exposing an internal API to everyone).
Weaknesses: label squatting and broadcast receiver authentication (1:10:43)
Because label strings are first-come, first-served and not cryptographically tied to a developer identity, a malicious app installed before a legitimate one can define a sensitive-sounding label as normal with an innocuous description, and the legitimate app is stuck with that definition — Android silently ignores the second definition rather than warning the user. The lecture also covers broadcast receivers: early Android let any app subscribe to any broadcast, so a later addition let senders restrict broadcasts to receivers holding a specific label, and a checkCallingPermission-style function lets a component ask the framework whether a message's sender actually holds a given label, which matters especially for direct RPC channels that bypass the reference monitor after the initial bind.
Before you watch
- Review the earlier Unix lecture and lab on UIDs and file permissions; Android's kernel-level enforcement directly reuses those mechanisms.
- Recall the same-origin policy from the browser security lectures, since it's used as the point of comparison when the lecture asks why Android didn't just build on the web app model.
Check your understanding
- Why does Android check permissions in a central reference monitor rather than trusting the sending or receiving app to check them?
- For which kinds of resources does Android bypass the reference monitor and enforce permissions through Linux UIDs and GIDs instead, and why?
- What is the practical difference between a
normal,dangerous, andsignaturepermission label? - Explain the "first-come, first-served" label problem: how could a malicious app undermine a legitimate app's permission before it's even installed?
- Why does Java's role in Android have more to do with portability and developer productivity than with security, according to the lecture?
Vocabulary
- case study (noun)
- A detailed example used to illustrate a general point.
Android is treated as a case study in security-first design. - reference monitor (noun)
- A trusted, central part of a system that checks every access request against security rules.
The reference monitor checks permission labels before delivering a message. - mediate (verb)
- To act as a controlling middle party between two sides.
The reference monitor mediates messages between apps. - intent (noun)
- A structured message Android apps use to request an action or share data with another component.
An app sends an intent to open the camera app. - component (noun)
- One self-contained building block that makes up a larger app.
Every Android app is built from several kinds of components. - manifest (noun)
- A file that declares an app's structure and required permissions.
The manifest lists which permissions the app requests. - permission (noun)
- A right granted to an app to access a specific resource or action.
Reading contacts requires a specific permission. - label (noun)
- A named tag used to mark and control access to a resource.
A permission label protects access to a sensitive component. - collision (naming) (noun)
- A conflict that happens when two different things use the same name.
Permission strings are vulnerable to naming collisions. - UID (user ID) (noun)
- A unique number the operating system uses to identify a user or process.
Each app runs under its own UID for isolation. - GID (group ID) (noun)
- A number identifying a group that a process can belong to, used for access control.
Network access is controlled via a special GID. - explicit intent (noun)
- A message that names exactly which component should receive it.
An explicit intent targets one specific activity. - implicit intent (noun)
- A message describing an action without naming which component should handle it.
An implicit intent lets the system choose a suitable app. - install time (noun)
- The moment when an app is first set up on a device.
Dangerous permissions are shown to the user at install time. - sign (with a key) (verb)
- To cryptographically mark software as coming from a specific developer.
Signature permissions require apps signed with the same key. - first-come, first-served (phrase)
- Decided by whoever arrives or acts earliest.
Permission labels are assigned on a first-come, first-served basis. - squatting (noun)
- Claiming a name or resource before its intended owner can, to cause problems.
Label squatting lets a malicious app claim a sensitive name first. - broadcast receiver (noun)
- An Android component that listens for system-wide messages.
A broadcast receiver can react when the phone finishes booting. - isolation (noun)
- Keeping systems or data separate so one cannot affect another.
Isolation between apps prevents one app from reading another's files. - monolithic (adjective)
- Built as one single large unit rather than several separate parts.
Unlike a monolithic program, Android apps are split into components.
From the YouTube description
MIT 6.858 Computer Systems Security, Fall 2014
View the complete course: http://ocw.mit.edu/6-858F14
Instructor: Nickolai Zeldovich
In this lecture, Professor Zeldovich discusses the Android platform and its security design.
License: Creative Commons BY-NC-SA
More information at http://ocw.mit.edu/terms
More courses at http://ocw.mit.edu
← Lecture 19: Anonymous Communication (Tor) · 21. Data Tracking →
