blob: 8c5a8643f5e661367d4cf0dfb92c47bf14af7ab1 [file] [log] [blame]
Robert Ly35f2fda2013-01-29 16:27:05 -08001page.title=Android Security Overview
2@jd:body
3
4<!--
5 Copyright 2010 The Android Open Source Project
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18-->
19<h2 id="introduction">Introduction</h2>
20<p>Android is a modern mobile platform that was designed to be truly open. Android
21applications make use of advanced hardware and software, as well as local and
22served data, exposed through the platform to bring innovation and value to
23consumers. To protect that value, the platform must offer an application
24environment that ensures the security of users, data, applications, the device,
25and the network.</p>
26<p>Securing an open platform requires a robust security architecture and rigorous
27security programs. Android was designed with multi-layered security that
28provides the flexibility required for an open platform, while providing
29protection for all users of the platform.</p>
30<p>Android was designed with developers in mind. Security controls were designed
31to reduce the burden on developers. Security-savvy developers can easily work
32with and rely on flexible security controls. Developers less familiar with
33security will be protected by safe defaults.</p>
34<p>Android was designed with device users in mind. Users are provided visibility
35into how applications work, and control over those applications. This design
36includes the expectation that attackers would attempt to perform common
37attacks, such as social engineering attacks to convince device users to install
38malware, and attacks on third-party applications on Android. Android was
39designed to both reduce the probability of these attacks and greatly limit the
40impact of the attack in the event it was successful.</p>
41<p>This document outlines the goals of the Android security program, describes the
42fundamentals of the Android security architecture, and answers the most
43pertinent questions for system architects and security analysts. This document
44focuses on the security features of Android's core platform and does not
45discuss security issues that are unique to specific applications, such as those
46related to the browser or SMS application. Recommended best practices for
47building Android devices, deploying Android devices, or developing applications
48for Android are not the goal of this document and are provided elsewhere.</p>
49<h1 id="background">Background</h1>
50<p>Android provides an open source platform and application environment for mobile
51devices.</p>
52<p>The main Android platform building blocks are:</p>
53<ul>
54<li>
55<p><strong>Device Hardware</strong>: Android runs on a wide range of hardware configurations
56including smart phones, tablets, and set-top-boxes. Android is
57processor-agnostic, but it does take advantage of some hardware-specific
58security capabilities such as ARM v6 eXecute-Never.</p>
59</li>
60<li>
61<p><strong>Android Operating System</strong>: The core operating system is built on top of
62the Linux kernel. All device resources, like camera functions, GPS data,
63Bluetooth functions, telephony functions, network connections, etc. are
64accessed through the operating system.</p>
65</li>
66<li>
67<p><strong>Android Application Runtime</strong>: Android applications are most often written
68in the Java programming language and run in the Dalvik virtual machine.
69However, many applications, including core Android services and applications
70are native applications or include native libraries. Both Dalvik and native
71applications run within the same security environment, contained within the
72Application Sandbox. Applications get a dedicated part of the filesystem in
73which they can write private data, including databases and raw files.</p>
74</li>
75</ul>
76<p>Android applications extend the core Android operating system. There are two
77primary sources for applications:</p>
78<ul>
79<li>
80<p><strong>Pre-Installed Applications</strong>: Android includes a set of pre-installed
81applications including phone, email, calendar, web browser, and contacts. These
82function both as user applications and to provide key device capabilities that
83can be accessed by other applications. Pre-installed applications may be part
84of the open source Android platform, or they may be developed by an OEM for a
85specific device.</p>
86</li>
87<li>
88<p><strong>User-Installed Applications</strong>: Android provides an open development
89environment supporting any third-party application. Google Play offers
90users hundreds of thousands of applications.</p>
91</li>
92</ul>
93<p>Google provides a set of cloud-based services that are available to any
94compatible Android device. The primary services are:</p>
95<ul>
96<li>
97<p><strong>Google Play</strong>: Google Play is a collection of services that
98allow users to discover, install, and purchase applications from their Android
99device or the web. Google Play makes it easy for developers to reach Android
100users and potential customers. Google Play also provides community review,
101application <a href="https://developer.android.com/guide/publishing/licensing.html">license
102verification</a>,
103and other security services.</p>
104</li>
105<li>
106<p><strong>Android Updates</strong>: The Android update service delivers new capabilities and
107security updates to Android devices, including updates through the web or over
108the air (OTA).</p>
109</li>
110<li>
111<p><strong>Application Services</strong>: Frameworks that allow Android applications to use
112cloud capabilities such as (<a href="https://developer.android.com/guide/topics/data/backup.html">backing
113up</a>) application
114data and settings and cloud-to-device messaging
115(<a href="https://code.google.com/android/c2dm/index.html">C2DM</a>)
116for push messaging.</p>
117</li>
118</ul>
119<p>These services are not part of the Android Open Source Project and are out
120of scope for this document. But they are relevant to the security of most
121Android devices, so a related security document titled “Google Services for
122Android: Security Overview” is available.</p>
123<h2 id="android-security-program-overview">Android Security Program Overview</h2>
124<p>Early on in development, the core Android development team recognized that a
125robust security model was required to enable a vigorous ecosystem of
126applications and devices built on and around the Android platform and supported
127by cloud services. As a result, through its entire development lifecycle,
128Android has been subjected to a professional security program. The Android team
129has had the opportunity to observe how other mobile, desktop, and server platforms
130prevented and reacted to security issues and built a security
131program to address weak points observed in other offerings.</p>
132<p>The key components of the Android Security Program include:</p>
133<ul>
134<li><strong>Design Review</strong>: The Android security process begins early in the
135development lifecycle with the creation of a rich and configurable security
136model and design. Each major feature of the platform is reviewed by engineering
137and security resources, with appropriate security controls integrated into the
138architecture of the system.</li>
139<li><strong>Penetration Testing and Code Review</strong>: During the development of the
140platform, Android-created and open-source components are subject to vigorous
141security reviews. These reviews are performed by the Android Security Team,
142Google’s Information Security Engineering team, and independent security
143consultants. The goal of these reviews is to identify weaknesses and possible
144vulnerabilities well before the platform is open-sourced, and to simulate the
145types of analysis that will be performed by external security experts upon
146release.</li>
147<li><strong>Open Source and Community Review</strong>: The Android Open Source Project enables
148broad security review by any interested party. Android also uses open source
149technologies that have undergone significant external security review,
150such as the Linux kernel. Google Play provides a forum for users and companies
151to provide information about specific applications directly to users.</li>
152<li><strong>Incident Response</strong>: Even with all of these precautions, security issues
153may occur after shipping, which is why the Android project has created a
154comprehensive security response process. A full-time Android security team
155constantly monitors Android-specific and the general security community for
156discussion of potential vulnerabilities. Upon the discovery of legitimate
157issues, the Android team has a response process that enables the rapid
158mitigation of vulnerabilities to ensure that potential risk to all Android
159users is minimized. These cloud-supported responses can include updating the
160Android platform (over-the-air updates), removing applications from Google
161Play, and removing applications from devices in the field.</li>
162</ul>
163<h2 id="android-platform-security-architecture">Android Platform Security Architecture</h2>
164<p>Android seeks to be the most secure and usable operating system for mobile
165platforms by re-purposing traditional operating system security controls to:</p>
166<ul>
167<li>Protect user data</li>
168<li>Protect system resources (including the network)</li>
169<li>Provide application isolation</li>
170</ul>
171<p>To achieve these objectives, Android provides these key security features:</p>
172<ul>
173<li>Robust security at the OS level through the Linux kernel</li>
174<li>Mandatory application sandbox for all applications</li>
175<li>Secure interprocess communication</li>
176<li>Application signing</li>
177<li>Application-defined and user-granted permissions</li>
178</ul>
179<p>The sections below describe these and other security features of the Android
180platform. <em>Figure 1</em> summarizes the security components and considerations of
181the various levels of the Android software stack. Each component assumes that
182the components below are properly secured. With the exception of a small amount
183of Android OS code running as root, all code above the Linux Kernel is
184restricted by the Application Sandbox.</p>
185<p><img alt="Figure 1: Android software stack" src="images/image00.png" /></p>
186<p><em>Figure 1: Android software stack.</em></p>
187<h1 id="system-and-kernel-level-security">System and Kernel Level Security</h1>
188<p>At the operating system level, the Android platform provides the security of
189the Linux kernel, as well as a secure inter-process communication (IPC)
190facility to enable secure communication between applications running in
191different processes. These security features at the OS level ensure that even
192native code is constrained by the Application Sandbox. Whether that code is
193the result of included application behavior or a exploitation of an application
194vulnerability, the system would prevent the rogue application from harming
195other applications, the Android system, or the device itself.</p>
196<h2 id="linux-security">Linux Security</h2>
197<p>The foundation of the Android platform is the Linux kernel. The Linux kernel
198itself has been in widespread use for years, and is used in millions of
199security-sensitive environments. Through its history of constantly being
200researched, attacked, and fixed by thousands of developers, Linux has become a
201stable and secure kernel trusted by many corporations and security
202professionals.</p>
203<p>As the base for a mobile computing environment, the Linux kernel provides
204Android with several key security features, including:</p>
205<ul>
206<li>A user-based permissions model</li>
207<li>Process isolation</li>
208<li>Extensible mechanism for secure IPC</li>
209<li>The ability to remove unnecessary and potentially insecure parts of the kernel</li>
210</ul>
211<p>As a multiuser operating system, a fundamental security objective of the Linux
212kernel is to isolate user resources from one another. The Linux security
213philosophy is to protect user resources from one another. Thus, Linux:</p>
214<ul>
215<li>Prevents user A from reading user B's files</li>
216<li>Ensures that user A does not exhaust user B's memory</li>
217<li>Ensures that user A does not exhaust user B's CPU resources</li>
218<li>Ensures that user A does not exhaust user B's devices (e.g. telephony, GPS,
219bluetooth)</li>
220</ul>
221<h2 id="the-application-sandbox">The Application Sandbox</h2>
222<p>The Android platform takes advantage of the Linux user-based protection as a
223means of identifying and isolating application resources. The Android system
224assigns a unique user ID (UID) to each Android application and runs it as that user
225in a separate process. This approach is different from other operating systems
226(including the traditional Linux configuration), where multiple applications
227run with the same user permissions.</p>
228<p>This sets up a kernel-level Application Sandbox. The kernel enforces security
229between applications and the system at the process level through standard Linux
230facilities, such as user and group IDs that are assigned to applications. By
231default, applications cannot interact with each other and applications have
232limited access to the operating system. If application A tries to do something
233malicious like read application B's data or dial the phone without permission
234(which is a separate application), then the operating system protects against
235this because application A does not have the appropriate user privileges. The
236sandbox is simple, auditable, and based on decades-old UNIX-style user
237separation of processes and file permissions.</p>
238<p>Since the Application Sandbox is in the kernel, this security model extends to
239native code and to operating system applications. All of the software above the
240kernel in <em>Figure 1</em>, including operating system libraries, application
241framework, application runtime, and all applications run within the Application
242Sandbox. On some platforms, developers are constrained to a specific
243development framework, set of APIs, or language in order to enforce security.
244On Android, there are no restrictions on how an application can be written that
245are required to enforce security; in this respect, native code is just as
246secure as interpreted code.</p>
247<p>In some operating systems, memory corruption errors generally lead to
248completely compromising the security of the device. This is not the case in
249Android due to all applications and their resources being sandboxed at the OS
250level. A memory corruption error will only allow arbitrary code execution in
251the context of that particular application, with the permissions established by
252the operating system.</p>
253<p>Like all security features, the Application Sandbox is not unbreakable.
254However, to break out of the Application Sandbox in a properly configured
255device, one must compromise the security of the the Linux kernel.</p>
256<h2 id="system-partition-and-safe-mode">System Partition and Safe Mode</h2>
257<p>The system partition contains Android's kernel as well as the operating system
258libraries, application runtime, application framework, and applications. This
259partition is set to read-only. When a user boots the device into Safe Mode,
260only core Android applications are available. This ensures that the user can
261boot their phone into an environment that is free of third-party software.</p>
262<h2 id="filesystem-permissions">Filesystem Permissions</h2>
263<p>In a UNIX-style environment, filesystem permissions ensure that one user cannot
264alter or read another user's files. In the case of Android, each application
265runs as its own user. Unless the developer explicitly exposes files to other
266applications, files created by one application cannot be read or altered by
267another application.</p>
268<h2 id="filesystem-encryption">Filesystem Encryption</h2>
269<p>Android 3.0 and later provides full filesystem encryption, so all user data can
270be encrypted in the kernel using the dmcrypt implementation of AES128 with CBC
271and ESSIV:SHA256. The encryption key is protected by AES128 using a key
272derived from the user password, preventing unauthorized access to stored data
273without the user device password. To provide resistance against systematic
274password guessing attacks (e.g. “rainbow tables” or brute force), the
275password is combined with a random salt and hashed repeatedly with SHA1 using
276the standard PBKDF2 algorithm prior to being used to decrypt the filesystem
277key. To provide resistance against dictionary password guessing attacks,
278Android provides password complexity rules that can be set by the device
279administrator and enforced by the operating system. Filesystem encryption
280requires the use of a user password, pattern-based screen lock is not supported.</p>
281<p>More details on implementation of filesystem encryption are available at
282<a href="/
283tech/encryption/android_crypto_implementation.html">https://source.android.com/tech/encryption/android_crypto_implementation.html</a></p>
284<h2 id="password-protection">Password Protection</h2>
285<p>Android can be configured to verify a user-supplied password prior to providing
286access to a device. In addition to preventing unauthorized use of the device,
287this password protects the cryptographic key for full filesystem encryption.</p>
288<p>Use of a password and/or password complexity rules can be required by a device
289administrator.</p>
290<h2 id="device-administration">Device Administration</h2>
291<p>Android 2.2 and later provide the Android Device Administration API, which
292provides device administration features at the system level. For example, the
293built-in Android Email application uses the APIs to improve Exchange support.
294Through the Email application, Exchange administrators can enforce password
295policies — including alphanumeric passwords or numeric PINs — across
296devices. Administrators can also remotely wipe (that is, restore factory
297defaults on) lost or stolen handsets.</p>
298<p>In addition to use in applications included with the Android system, these APIs
299are available to third-party providers of Device Management solutions. Details
300on the API are provided here:
301<a href="https://devel
302oper.android.com/guide/topics/admin/device-admin.html">https://developer.android.com/guide/topics/admin/device-admin.html</a>.</p>
303<h2 id="memory-management-security-enhancements">Memory Management Security Enhancements</h2>
304<p>Android includes many features that make common security issues harder to
305exploit. The Android SDK, compilers, and OS use tools to make common memory
306corruption issues significantly harder to exploit, including:</p>
307<p><strong>Android 1.5+</strong></p>
308<ul>
309<li>ProPolice to prevent stack buffer overruns (-fstack-protector)</li>
310<li>safe_iop to reduce integer overflows</li>
311<li>Extensions to OpenBSD dlmalloc to prevent double free() vulnerabilities and
312to prevent chunk consolidation attacks. Chunk consolidation attacks are a
313common way to exploit heap corruption.</li>
314<li>OpenBSD calloc to prevent integer overflows during memory allocation</li>
315</ul>
316<p><strong>Android 2.3+</strong></p>
317<ul>
318<li>Format string vulnerability protections (-Wformat-security -Werror=format-security)</li>
319<li>Hardware-based No eXecute (NX) to prevent code execution on the stack and heap</li>
320<li>Linux mmap_min_addr to mitigate null pointer dereference privilege
321escalation (further enhanced in Android 4.1)</li>
322</ul>
323<p><strong>Android 4.0+</strong></p>
324<ul>
325<li>Address Space Layout Randomization (ASLR) to randomize key locations in memory</li>
326</ul>
327<p><strong>Android 4.1+</strong></p>
328<ul>
329<li>PIE (Position Independent Executable) support</li>
330<li>Read-only relocations / immediate binding (-Wl,-z,relro -Wl,-z,now)</li>
331<li>dmesg_restrict enabled (avoid leaking kernel addresses)</li>
332<li>kptr_restrict enabled (avoid leaking kernel addresses)</li>
333</ul>
334<h2 id="rooting-of-devices">Rooting of Devices</h2>
335<p>By default, on Android only the kernel and a small subset of the core
336applications run with root permissions. Android does not prevent a user or
337application with root permissions from modifying the operating system, kernel,
338and any other application. In general, root has full access to all
339applications and all application data. Users that change the permissions on an
340Android device to grant root access to applications increase the security
341exposure to malicious applications and potential application flaws.</p>
342<p>The ability to modify an Android device they own is important to developers
343working with the Android platform. On many Android devices users have the
344ability to unlock the bootloader in order to allow installation of an alternate
345operating system. These alternate operating systems may allow an owner to gain
346root access for purposes of debugging applications and system components or to
347access features not presented to applications by Android APIs.</p>
348<p>On some devices, a person with physical control of a device and a USB cable is
349able to install a new operating system that provides root privileges to the
350user. To protect any existing user data from compromise the bootloader unlock
351mechanism requires that the bootloader erase any existing user data as part of
352the unlock step. Root access gained via exploiting a kernel bug or security
353hole can bypass this protection.</p>
354<p>Encrypting data with a key stored on-device does not protect the application
355data from root users. Applications can add a layer of data protection using
356encryption with a key stored off-device, such as on a server or a user
357password. This approach can provide temporary protection while the key is not
358present, but at some point the key must be provided to the application and it
359then becomes accessible to root users.</p>
360<p>A more robust approach to protecting data from root users is through the use of
361hardware solutions. OEMs may choose to implement hardware solutions that limit
362access to specific types of content such as DRM for video playback, or the
363NFC-related trusted storage for Google wallet.</p>
364<p>In the case of a lost or stolen device, full filesystem encryption on Android
365devices uses the device password to protect the encryption key, so modifying
366the bootloader or operating system is not sufficient to access user data
367without the user’s device password.</p>
368<h1 id="android-application-security">Android Application Security</h1>
369<h2 id="elements-of-applications">Elements of Applications</h2>
370<p>Android provides an open source platform and application environment for mobile
371devices. The core operating system is based on the Linux kernel. Android
372applications are most often written in the Java programming language and run in
373the Dalvik virtual machine. However, applications can also be written in native
374code. Applications are installed from a single file with the .apk file
375extension.</p>
376<p>The main Android application building blocks are:</p>
377<ul>
378<li>
379<p><strong>AndroidManifest.xml</strong>: The
380<a href="https://developer.android.com/guide/topics/manifest/manifes
381t-intro.html">AndroidManifest.xml</a> file is the control file that tells the system what to do with
382all the top-level components (specifically activities, services, broadcast
383receivers, and content providers described below) in an application. This also
384specifies which permissions are required.</p>
385</li>
386<li>
387<p><strong>Activities</strong>: An
388<a href="https://developer.android.com/guide/topics/fundamentals/activities.htm
389l">Activity</a> is, generally, the code for a single, user-focused task. It usually
390includes displaying a UI to the user, but it does not have to -- some
391Activities never display UIs. Typically, one of the application's Activities
392is the entry point to an application.</p>
393</li>
394<li>
395<p><strong>Services</strong>: A
396<a href="https://developer.android.com/guide/topics/fundamentals/services.html">Service</a>
397is a body of code that runs in the background. It can run in its own process,
398or in the context of another application's process. Other components "bind" to
399a Service and invoke methods on it via remote procedure calls. An example of a
400Service is a media player: even when the user quits the media-selection UI, the
401user probably still intends for music to keep playing. A Service keeps the
402music going even when the UI has completed.</p>
403</li>
404<li>
405<p><strong>Broadcast Receiver</strong>: A
406<a href="https://developer.android.com/reference/android/content/Broad
407castReceiver.html">BroadcastReceiver</a> is an object that is instantiated when an IPC mechanism
408known as an
409<a href="https://developer.android.com/reference/android/content/Intent.html">Intent</a>
410is issued by the operating system or another application. An application may
411register a receiver for the low battery message, for example, and change its
412behavior based on that information.</p>
413</li>
414</ul>
415<h2 id="the-android-permission-model-accessing-protected-apis">The Android Permission Model: Accessing Protected APIs</h2>
416<p>By default, an Android application can only access a limited range of system
417resources. The system manages Android application access to resources that, if
418used incorrectly or maliciously, could adversely impact the user experience,
419the network, or data on the device.</p>
420<p>These restrictions are implemented in a variety of different forms. Some
421capabilities are restricted by an intentional lack of APIs to the sensitive
422functionality (e.g. there is no Android API for directly manipulating the SIM
423card). In some instances, separation of roles provides a security measure, as
424with the per-application isolation of storage. In other instances, the
425sensitive APIs are intended for use by trusted applications and protected
426through a security mechanism known as Permissions.</p>
427<p>These protected APIs include:</p>
428<ul>
429<li>Camera functions</li>
430<li>Location data (GPS)</li>
431<li>Bluetooth functions</li>
432<li>Telephony functions</li>
433<li>SMS/MMS functions</li>
434<li>Network/data connections</li>
435</ul>
436<p>These resources are only accessible through the operating system. To make use
437of the protected APIs on the device, an application must define the
438capabilities it needs in its manifest. When preparing to install an
439application, the system displays a dialog to the user that indicates the
440permissions requested and asks whether to continue the installation. If the
441user continues with the installation, the system accepts that the user has
442granted all of the requested permissions. The user can not grant or deny
443individual permissions -- the user must grant or deny all of the requested
444permissions as a block.</p>
445<p>Once granted, the permissions are applied to the application as long as it is
446installed. To avoid user confusion, the system does not notify the user again
447of the permissions granted to the application, and applications that are
448included in the core operating system or bundled by an OEM do not request
449permissions from the user. Permissions are removed if an application is
450uninstalled, so a subsequent re-installation will again result in display of
451permissions.</p>
452<p>Within the device settings, users are able to view permissions for applications
453they have previously installed. Users can also turn off some functionality
454globally when they choose, such as disabling GPS, radio, or wi-fi.</p>
455<p>In the event that an application attempts to use a protected feature which has
456not been declared in the application's manifest, the permission failure will
457typically result in a security exception being thrown back to the application.
458Protected API permission checks are enforced at the lowest possible level to
459prevent circumvention. An example of the user messaging when an application is
460installed while requesting access to protected APIs is shown in <em>Figure 2</em>.</p>
461<p>The system default permissions are described at
462<a href="https://developer.android.com/reference/android/Manifest.permission.html">https://developer.android.com/reference/android/Manifest.permission.html</a>.
463Applications may declare their own permissions for other applications to use.
464Such permissions are not listed in the above location.</p>
465<p>When defining a permission a protectionLevel attribute tells the system how the
466user is to be informed of applications requiring the permission, or who is
467allowed to hold a permission. Details on creating and using application
468specific permissions are described at
469<a href="https://develo
470per.android.com/guide/topics/security/security.html">https://developer.android.com/guide/topics/security/security.html</a>.</p>
471<p>There are some device capabilities, such as the ability to send SMS broadcast
472intents, that are not available to third-party applications, but that may be
473used by applications pre-installed by the OEM. These permissions use the
474signatureOrSystem permission.</p>
475<h2 id="how-users-understand-third-party-applications">How Users Understand Third-Party Applications</h2>
476<p>Android strives to make it clear to users when they are interacting with
477third-party applications and inform the user of the capabilities those
478applications have. Prior to installation of any application, the user is shown
479a clear message about the different permissions the application is requesting.
480After install, the user is not prompted again to confirm any permissions.</p>
481<p>There are many reasons to show permissions immediately prior to installation
482time. This is when user is actively reviewing information about the
483application, developer, and functionality to determine whether it matches their
484needs and expectations. It is also important that they have not yet
485established a mental or financial commitment to the app, and can easily compare
486the application to other alternative applications.</p>
487<p>Some other platforms use a different approach to user notification, requesting
488permission at the start of each session or while applications are in use. The
489vision of Android is to have users switching seamlessly between applications at
490will. Providing confirmations each time would slow down the user and prevent
491Android from delivering a great user experience. Having the user review
492permissions at install time gives the user the option to not install the
493application if they feel uncomfortable.</p>
494<p>Also, many user interface studies have shown that over-prompting the user
495causes the user to start saying "OK" to any dialog that is shown. One of
496Android's security goals is to effectively convey important security
497information to the user, which cannot be done using dialogs that the user will
498be trained to ignore. By presenting the important information once, and only
499when it is important, the user is more likely to think about what they are
500agreeing to.</p>
501<p>Some platforms choose not to show any information at all about application
502functionality. That approach prevents users from easily understanding and
503discussing application capabilities. While it is not possible for all users to
504always make fully informed decisions, the Android permissions model makes
505information about applications easily accessible to a wide range of users. For
506example, unexpected permissions requests can prompt more sophisticated users to
507ask critical questions about application functionality and share their concerns
508in places such as <a href="htts://play.google.com">Google Play</a> where they
509are visible to all users.</p>
510<table>
511<tr>
512<td><strong>Permissions at Application Install -- Google Maps</strong></td>
513<td><strong>Permissions of an Installed Application -- gMail</strong></td>
514</tr>
515<tr>
516<td>
517<img alt="Permissions at Application Install -- Google Maps" width=250
518src="images/image_install.png"/>
519</td>
520<td>
521<img alt="Permissions of an Installed Application -- gMail" width=250
522src="images/image_gmail_installed.png"/>
523</td>
524</tr>
525</table>
526
527<p><em>Figure 2: Display of permissions for applications</em></p>
528<h2 id="interprocess-communication">Interprocess Communication</h2>
529<p>Processes can communicate using any of the traditional UNIX-type mechanisms.
530Examples include the filesystem, local sockets, or signals. However, the Linux
531permissions still apply.</p>
532<p>Android also provides new IPC mechanisms:</p>
533<ul>
534<li>
535<p><strong>Binder</strong>: A lightweight capability-based remote procedure call mechanism
536designed for high performance when performing in-process and cross-process
537calls. Binder is implemented using a custom Linux driver. See
538<a href="https://developer
539.android.com/reference/android/os/Binder.html">https://developer.android.com/reference/android/os/Binder.html</a>.</p>
540</li>
541<li>
542<p><strong>Services</strong>: Services (discussed above) can provide interfaces directly
543accessible using binder.</p>
544</li>
545<li>
546<p><strong>Intents</strong>: An Intent is a simple message object that represents an
547"intention" to do something. For example, if your application wants to display
548a web page, it expresses its "Intent" to view the URL by creating an Intent
549instance and handing it off to the system. The system locates some other piece
550of code (in this case, the Browser) that knows how to handle that Intent, and
551runs it. Intents can also be used to broadcast interesting events (such as a
552notification) system-wide. See
553[https://developer.android.com/reference/android/content/Intent.html](https://developer.android.com/reference/android/content/Intent.html.</p>
554</li>
555<li>
556<p><strong>ContentProviders</strong>: A ContentProvider is a data storehouse that provides
557access to data on the device; the classic example is the ContentProvider that
558is used to access the user's list of contacts. An application can access data
559that other applications have exposed via a ContentProvider, and an application
560can also define its own ContentProviders to expose data of its own. See
561<a href="https://developer.android.com/reference/android/content/ContentProvider.html">https://developer.android.com/reference/android/content/ContentProvider.html</a>.</p>
562</li>
563</ul>
564<p>While it is possible to implement IPC using other mechanisms such as network
565sockets or world-writable files, these are the recommended Android IPC
566frameworks. Android developers will be encouraged to use best practices around
567securing users' data and avoiding the introduction of security vulnerabilities.</p>
568<h2 id="cost-sensitive-apis">Cost-Sensitive APIs</h2>
569<p>A cost sensitive API is any function that might generate a cost for the user or
570the network. The Android platform has placed cost sensitive APIs in the list of
571protected APIs controlled by the OS. The user will have to grant explicit
572permission to third-party applications requesting use of cost sensitive APIs.
573These APIs include:</p>
574<ul>
575<li>Telephony</li>
576<li>SMS/MMS</li>
577<li>Network/Data</li>
578<li>In-App Billing</li>
579<li>NFC Access</li>
580</ul>
581<h2 id="sim-card-access">SIM Card Access</h2>
582<p>Low level access to the SIM card is not available to third-party apps. The OS
583handles all communications with the SIM card including access to personal
584information (contacts) on the SIM card memory. Applications also cannot access
585AT commands, as these are managed exclusively by the Radio Interface Layer
586(RIL). The RIL provides no high level APIs for these commands.</p>
587<h2 id="personal-information">Personal Information</h2>
588<p>Android has placed APIs that provide access to user data into the set of
589protected APIs. With normal usage, Android devices will also accumulate user
590data within third-party applications installed by users. Applications that
591choose to share this information can use Android OS permission checks to
592protect the data from third-party applications.</p>
593<p><img alt="Figure 3: Access to sensitive user data is only available through protected
594APIs" src="images/image03.png" /></p>
595<p><em>Figure 3: Access to sensitive user data is only available through protected
596APIs</em></p>
597<p>System content providers that are likely to contain personal or personally
598identifiable information such as contacts and calendar have been created with
599clearly identified permissions. This granularity provides the user with clear
600indication of the types of information that may be provided to the application.
601 During installation, a third-party application may request permission to
602access these resources. If permission is granted, the application can be
603installed and will have access to the data requested at any time when it is
604installed.</p>
605<p>Any applications which collect personal information will, by default, have that
606data restricted only to the specific application. If an application chooses to
607make the data available to other applications though IPC, the application
608granting access can apply permissions to the IPC mechanism that are enforced by
609the operating system.</p>
610<h2 id="sensitive-data-input-devices">Sensitive Data Input Devices</h2>
611<p>Android devices frequently provide sensitive data input devices that allow
612applications to interact with the surrounding environment, such as camera,
613microphone or GPS. For a third-party application to access these devices, it
614must first be explicitly provided access by the user through the use of Android
615OS Permissions. Upon installation, the installer will prompt the user
616requesting permission to the sensor by name.</p>
617<p>If an application wants to know the user's location, the application requires a
618permission to access the user's location. Upon installation, the installer will
619prompt the user asking if the application can access the user's location. At
620any time, if the user does not want any application to access their location,
621then the user can run the "Settings" application, go to "Location &amp; Security",
622and uncheck the "Use wireless networks" and "Enable GPS satellites". This will
623disable location based services for all applications on the user's device.</p>
624<h2 id="device-metadata">Device Metadata</h2>
625<p>Android also strives to restrict access to data that is not intrinsically
626sensitive, but may indirectly reveal characteristics about the user, user
627preferences, and the manner in which they use a device.</p>
628<p>By default applications do not have access to operating system logs,
629browser history, phone number, or hardware / network identification
630information. If an application requests access to this information at install
631time, the installer will prompt the user asking if the application can access
632the information. If the user does not grant access, the application will not be
633installed.</p>
634<h2 id="application-signing">Application Signing</h2>
635<p>Code signing allows developers to identify the author of the application and to
636update their application without creating complicated interfaces and
637permissions. Every application that is run on the Android platform must be
638signed by the developer. Applications that attempt to install without being
639signed will rejected by either Google Play or the package installer on
640the Android device.</p>
641<p>On Google Play, application signing bridges the trust Google has with the
642developer and the trust the developer has with their application. Developers
643know their application is provided, unmodified to the Android device; and
644developers can be held accountable for behavior of their application.</p>
645<p>On Android, application signing is the first step to placing an application in
646its Application Sandbox. The signed application certificate defines which user
647id is associated with which application; different applications run under
648different user IDs. Application signing ensures that one application cannot
649access any other application except through well-defined IPC.</p>
650<p>When an application (APK file) is installed onto an Android device, the Package
651Manager verifies that the APK has been properly signed with the certificate
652included in that APK. If the certificate (or, more accurately, the public key
653in the certificate) matches the key used to sign any other APK on the device,
654the new APK has the option to specify in the manifest that it will share a UID
655with the other similarly-signed APKs.</p>
656<p>Applications can be signed by a third-party (OEM, operator, alternative market)
657or self-signed. Android provides code signing using self-signed certificates
658that developers can generate without external assistance or permission.
659Applications do not have to be signed by a central authority. Android currently
660does not perform CA verification for application certificates.</p>
661<p>Applications are also able to declare security permissions at the Signature
662protection level, restricting access only to applications signed with the same
663key while maintaining distinct UIDs and Application Sandboxes. A closer
664relationship with a shared Application Sandbox is allowed via the <a href="https://developer.android.com/guide/topics/manifest/manifest-element.html#uid">shared UID
665feature</a>
666where two or more applications signed with same developer key can
667declare a shared UID in their manifest.</p>
668<h2 id="digital-rights-management">Digital Rights Management</h2>
669<p>The Android platform provides an extensible DRM framework that lets
670applications manage rights-protected content according to the license
671constraints that are associated with the content. The DRM framework supports
672many DRM schemes; which DRM schemes a device supports is left to the device
673manufacturer.</p>
674<p>The <a href="https://developer.android.com/reference/android/drm/package-summary.html">Android DRM
675framework</a>
676is implemented in two architectural layers (see figure below):</p>
677<ul>
678<li>
679<p>A DRM framework API, which is exposed to applications through the Android
680application framework and runs through the Dalvik VM for standard applications.</p>
681</li>
682<li>
683<p>A native code DRM manager, which implements the DRM framework and exposes an
684interface for DRM plug-ins (agents) to handle rights management and decryption
685for various DRM schemes</p>
686</li>
687</ul>
688<p><img alt="Figure 4: Architecture of Digital Rights Management on Android
689platform" src="images/image02.png" /></p>
690<p><em>Figure 4: Architecture of Digital Rights Management on Android platform</em></p>
691<h1 id="android-updates">Android Updates</h1>
692<p>Android provides system updates for both security and feature related purposes.</p>
693<p>There are two ways to update the code on most Android devices: over-the-air
694(OTA updates) or side-loaded updates. OTA updates can be rolled out over a
695defined time period or be pushed to all devices at once, depending on how the
696OEM and/or carrier would like to push the updates. Side-loaded updates can be
697provided from a central location for users to download as a zip file to their
698local desktop machine or directly to their handset. Once the update is copied
699or downloaded to the SD card on the device, Android will recognize the update,
700verify its integrity and authenticity, and automatically update the device.</p>
701<p>If a dangerous vulnerability is discovered internally or responsibly reported
702to Google or the Android Open Source Project, the Android security team will
703start the following process.</p>
704<ol>
705<li>The Android team will notify companies who have signed NDAs regarding the
706problem and begin discussing the solution.</li>
707<li>The owners of code will begin the fix.</li>
708<li>The Android team will fix Android-related security issues.</li>
709<li>When a patch is available, the fix is provided to the NDA companies.</li>
710<li>The Android team will publish the patch in the Android Open Source Project</li>
711<li>OEM/carrier will push an update to customers.</li>
712</ol>
713<p>The NDA is required to ensure that the security issue does not become public
714prior to availabilty of a fix and put users at risk. Many OHA members run their
715own code on Android devices such as the bootloader, wifi drivers, and the
716radio. Once the Android Security team is notified of a security issue in this
717partner code, they will consult with OHA partners to quickly find a fix for the
718problem at hand and similar problems. However, the OHA member who wrote the
719faulty code is ultimately responsible for fixing the problem.</p>
720<p>If a dangerous vulnerability is not responsibly disclosed (e.g., if it is
721posted to a public forum without warning), then Google and/or the Android Open
722Source Project will work as quickly as possible to create a patch. The patch
723will released to the public (and any partners) when the patch is tested and
724ready for use.</p>
725<p>At Google I/O 2011, many of the largest OHA partners committed to providing
726updates to devices for 18 months after initial shipment. This will provide
727users with access to the most recent Android features, as well as security
728updates.</p>
729<p>Any developer, Android user, or security researcher can notify the Android
730security team of potential security issues by sending email to
731security@android.com. If desired, communication can be encrypted using the
732Android security team PGP key available here:
733<a href="https://developer.android.com/security_at_android_dot_com.txt">https://developer.android.com/security_at_android_dot_com.txt</a>.</p>
734<h1 id="other-resources">Other Resources</h1>
735<p>Information about the Android Open Source Project is available at
736<a href="https://source.android.com">https://source.android.com</a>.</p>
737<p>Information for Android application developers is here:
738<a href="https://developer.android.com">https://developer.android.com</a>.</p>
739<p>The Android Security team can be reached at
740<a href="mailto:security@android.com">security@android.com</a>.</p>
741<p>Security information exists throughout the Android Open Source and Developer
742Sites. A good place to start is here:
743<a href="https://developer.android.com/guide/topics/security/security.html">https://developer.android.com/guide/topics/security/security.html</a>.</p>
744<p>A Security FAQ for developers is located here:
745<a href="https://developer.android.com/resources/faq/security.html">https://developer.android.com/resources/faq/security.html</a>.</p>
746<p>Security Best Practices for developers is located here:
747<a href="https://developer.android.com/guide/practices/security.html">https://developer.android.com/guide/practices/security.html</a>.</p>
748<p>A community resource for discussion about Android security exists here:
749<a href="https://groups.google.com/forum/?fromgroups#!forum/android-security-discuss">https://groups.google.com/forum/?fromgroups#!forum/android-security-discuss</a>.</p>