[ Web Proxy ]
URL:
Viewing: https://source.android.com/docs/security/best-practices/system [Back]  [Original]

System security best practices  |  Android Open Source Project Skip to main content
Android Open Source Project [Android Open Source Project]

System security best practices Stay organized with collections Save and categorize content based on your preferences.

This section contains recommendations for ensuring the security of the core Android operating system and devices.

Biometric authentication

Acquire, store, and process biometric data for user authentication carefully. You should:

Devices with biometrics should support the BiometricPrompt API, which offers a common and consistent interface for app developers to take advantage of biometrics-based authentication in their apps. Only strong biometrics can integrate with BiometricPrompt and integrations must follow Android Compatibility Definition Document (CDD) guidelines.

For more biometric guidelines, see Biometric HAL implementation guidelines.

SELinux

SELinux provides the definition and enforcement of much of Android's security model. Correctly using SELinux is critical to the security of Android devices and can help mitigate the impact of security vulnerabilities. All Android devices should implement a robust SELinux policy for this reason.

Dynamic loading of SELinux policy

Don't dynamically load SELinux policy on Android devices. Doing so can result in issues, such as:

Backdoors

Android apps shouldn't have any backdoors or ways to access the system or data that bypass normal security mechanisms. This includes diagnostics, debugging, development, or warranty repair special access gated by secrets known to the developer. To prevent backdoors:

Development tools

Development tools, such as debugging, testing, and diagnostic tools, can often create unintended security gaps on your device by revealing how they operate and the data that they collect. To make sure that development tools don't make it into production builds:

Here are some additional suggestions to refer to when implementing disclosure and consent:

In-app disclosure

Embedded functionality in AOSP

Embedding additional functionality in AOSP can often have unexpected behavior and consequences; proceed with caution.

Security updates

Android devices should receive ongoing security support for at least two years from launch. This includes receiving regular updates that address known security vulnerabilities.

Dynamic kernel updates

Don't dynamically modify critical system components. While there is some research to suggest that dynamic kernel updates help protect against emergency threats, the assessed cost currently outweighs the benefits. Instead, create a robust OTA update method to quickly distribute vulnerability protections.

Key management

Maintain good key management policies and practices to ensure the security of signing keys.

System image signing

The signature of the system image is critical to determine device integrity.

Unlockable bootloaders

Many Android devices support unlocking, enabling the device owner to modify the system partition or install a custom operating system. Common use cases include installing a third-party system image and performing systems-level development on the device. For example, to unlock the system image on a Google Nexus or Pixel, a user can run fastboot oem unlock, which displays this message:

Unlock bootloader?

If you unlock the bootloader, you can install custom operating system software on this phone.

A custom OS isn't subject to the same testing as the original OS, and can cause your phone and installed apps to stop working properly.

To prevent unauthorized access to your personal data, unlocking the bootloader also deletes all personal data from your phone (a "factory data reset").

Press the Volume Up/Down buttons to select Yes or No. Then press the Power button to continue.

Yes: Unlock bootloader (may void warranty)

No: Don't unlock bootloader and restart phone.

As a best practice, unlockable Android devices must securely erase all user data prior to being unlocked. Failure to properly delete all data on unlocking may allow a physically proximate attacker to gain unauthorized access to confidential Android user data. To prevent the disclosure of user data, a device that supports unlocking must implement it properly.

These requirements ensure that all data is destroyed upon the completion of an unlock operation. Failure to implement these protections is considered a moderate level security vulnerability.

A device that is unlocked may be subsequently relocked using the fastboot oem lock command. Locking the bootloader provides the same protection of user data with the new custom OS as was available with the original device manufacturer OS (for example, user data is wiped if the device is unlocked again).

Device pentesting

Devices should be reviewed by a competent pentester prior to shipment. Pentesting should establish that the device followed security guidance provided here as well as internal OEM security guidance.

Security testing

Use the Security Testing tools provided by AOSP. In particular

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2024-09-24 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-24 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page