安全增强功能

Android 一直在不断改进其安全功能和产品/服务。您可以在左侧导航栏中查看各个版本的增强功能列表。

Android 14

Every Android release includes dozens of security enhancements to protect users. Here are some of the major security enhancements available in Android 14:

  • Hardware-assisted AddressSanitizer (HWASan), introduced in Android 10, is a memory error detection tool similar to AddressSanitizer. Android 14 brings significant improvements to HWASan. Learn how it helps prevent bugs from making it into Android releases, HWAddressSanitizer
  • In Android 14, starting with apps that share location data with third-parties, the system runtime permission dialog now includes a clickable section that highlights the app's data-sharing practices, including information such as why an app may decide to share data with third parties.
  • Android 12 introduced an option to disable 2G support at the modem level, which protects users from the inherent security risk from 2G's obsolete security model. Recognizing how critical disabling 2G could be for enterprise customers, Android 14 enables this security feature in Android Enterprise, introducing support for IT admins to restrict the ability of a managed device to downgrade to 2G connectivity.
  • Added support to reject null-ciphered cellular connections, ensuring that circuit-switched voice and SMS traffic is always encrypted and protected from passive over-the-air interception. Learn more about Android's program to harden cellular connectivity.
  • Added support for multiple IMEIs
  • Since Android 14, AES-HCTR2 is the preferred mode of filenames encryption for devices with accelerated cryptography instructions.
  • Cellular connectivity
  • Documentation added for Android Safety Center
  • If your app targets Android 14 and uses Dynamic Code Loading (DCL), all dynamically-loaded files must be marked as read-only. Otherwise, the system throws an exception. We recommend that apps avoid dynamically loading code whenever possible, as doing so greatly increases the risk that an app can be compromised by code injection or code tampering.

Check out our full AOSP release notes and the Android Developer features and changes list.

Android 13

Every Android release includes dozens of security enhancements to protect users. Here are some of the major security enhancements available in Android 13:

  • Android 13 adds multi-document presentation support. This new Presentation Session interface enables an app to do a multi-document presentation, something which isn't possible with the existing API. For further information, refer to Identity Credential
  • In Android 13, intents originating from external apps are delivered to an exported component if and only if the intents match their declared intent-filter elements.
  • Open Mobile API (OMAPI) is a standard API used to communicate with a device's Secure Element. Before Android 13, only apps and framework modules had access to this interface. By converting it to a vendor stable interface, HAL modules are also capable of communicating with the secure elements through the OMAPI service. For more information, see OMAPI Vendor Stable Interface.
  • As of Android 13-QPR, shared UIDs are deprecated. Users of Android 13 or higher should put the line `android:sharedUserMaxSdkVersion="32"` in their manifest. This entry prevents new users from getting a shared UID. For further information on UIDs, see App signing.
  • Android 13 added support Keystore symmetric cryptographic primitives such as AES (Advanced Encryption Standard), HMAC (Keyed-Hash Message Authentication Code), and asymmetric cryptographic algorithms (including Elliptic Curve, RSA2048, RSA4096, and Curve 25519)
  • Android 13 (API level 33) and higher supports a runtime permission for sending non-exempt notifications from an app. This gives users control over which permission notifications they see.
  • Added per-use prompt for apps requesting access to all device logs, giving users the ability to allow or deny access.
  • introduced the Android Virtualization Framework (AVF), which brings together different hypervisors under one framework with standardized APIs. It provides secure and private execution environments for executing workloads isolated by hypervisor.
  • Introduced APK signature scheme v3.1 All new key rotations that use apksigner use the v3.1 signature scheme by default to target rotation for Android 13 and higher.

Check out our full AOSP release notes and the Android Developer features and changes list.

Android 12

Every Android release includes dozens of security enhancements to protect users. Here are some of the major security enhancements available in Android 12:

  • Android 12 introduces the BiometricManager.Strings API, which provides localized strings for apps that use BiometricPrompt for authentication. These strings are intended to be device-aware and provide more specificity about which authentication types might be used. Android 12 also includes support for under-display fingerprint sensors
  • Support added for under-display fingerprint sensors
  • Introduction of the Fingerprint Android Interface Definition Language (AIDL)
  • Support for new Face AIDL
  • Introduction of Rust as a language for platform development
  • The option for users to grant access only to their approximate location added
  • Added Privacy indicators on the status bar when an app is using the camera or microphone
  • Android's Private Compute Core (PCC)
  • Added an option to disable 2G support

Android 11

每个 Android 版本中都包含数十项用于保护用户的安全增强功能。如需查看 Android 11 中提供的一些主要安全增强功能的列表,请参阅 Android 版本说明

Android 10

每个 Android 版本中都包含数十项用于保护用户的安全增强功能。Android 10 包含多项安全和隐私增强功能。如需查看 Android 10 中变化的完整列表,请参阅 Android 10 版本说明

安全性

BoundsSanitizer

Android 10 在蓝牙和编解码器中部署了 BoundsSanitizer (BoundSan)。BoundSan 使用 UBSan 的边界排错程序。该缓解功能在各个模块级别启用,有助于确保 Android 关键组件的安全性,因此不应停用。以下编解码器启用了 BoundSan:

  • libFLAC
  • libavcdec
  • libavcenc
  • libhevcdec
  • libmpeg2
  • libopus
  • libvpx
  • libspeexresampler
  • libvorbisidec
  • libaac
  • libxaac

只执行内存

默认情况下,AArch64 系统二进制文件的可执行代码部分会被标记为只执行(不可读取),作为应对即时代码重用攻击的安全强化缓解方法。将数据和代码混合在一起的代码以及有目的地检查这些部分的代码(无需首先将内存段重新映射为可读)将不再起作用。如果目标 SDK 为 Android 10(API 级别 29 或更高)的应用尝试读取内存中已启用只执行内存 (XOM) 的系统库的代码部分,而未首先将该部分标记为可读,则此类应用将会受到影响。

扩展访问权限

可信代理是 Smart Lock 等三重身份验证机制使用的底层机制,只能在 Android 10 中延长解锁时间。可信代理无法再解锁已锁定的设备,并且最多只能将设备解锁状态维持四个小时。

人脸识别身份验证

借助人脸识别身份验证功能,用户只需将面孔对准设备正面即可将其解锁。Android 10 添加了对一种全新人脸识别身份验证堆栈的支持,该堆栈可安全处理相机帧,从而在支持的硬件上进行人脸识别身份验证时保障安全和隐私。Android 10 还提供了一种快捷的方式来集成符合安全标准的实现方案,让人们能通过集成应用来处理一些事务(如网上银行或其他服务)。

整数溢出排错功能

Android 10 在软件编解码器中启用了整数溢出排错功能 (IntSan)。确保播放性能对于设备硬件中不支持的任何编解码器而言都在接受范围内。 以下编解码器启用了 IntSan:

  • libFLAC
  • libavcdec
  • libavcenc
  • libhevcdec
  • libmpeg2
  • libopus
  • libvpx
  • libspeexresampler
  • libvorbisidec

模块化系统组件

Android 10 采用模块化方式处理一些 Android 系统组件,使其能够在 Android 的常规发布周期外的时间进行更新。下面列举了几种模块:

OEMCrypto

Android 10 使用 OEMCrypto API 版本 15。

Scudo

Scudo 是一个动态的用户模式内存分配器,旨在提高遇到堆相关漏洞时的复原能力。它提供了标准 C 分配和取消分配基元,以及 C++ 基元。

ShadowCallStack

ShadowCallStack (SCS) 是一种 LLVM 插桩模式,可将函数的返回地址保存到非叶函数的函数 prolog 中单独分配的 ShadowCallStack 实例,并从函数 epilog 中的 ShadowCallStack 实例加载返回地址,从而防止返回地址覆盖(比如堆栈缓冲区溢出)。

WPA3 和 Wi-Fi Enhanced Open

Android 10 添加了对 Wi-Fi Protected Access 3 (WPA3) 和 Wi-Fi Enhanced Open 安全标准的支持,可更好地保护隐私,更稳健地防御已知攻击。

隐私设置

以 Android 9 或更低版本为目标平台时的应用访问权限

如果您的应用在 Android 10 或更高版本上运行,但其目标平台是 Android 9(API 级别 28)或更低版本,则 Android 平台具有以下行为:

  • 如果您的应用为 ACCESS_FINE_LOCATIONACCESS_COARSE_LOCATION 声明了 <uses-permission> 元素,则系统会在安装期间自动为 ACCESS_BACKGROUND_LOCATION 添加 <uses-permission> 元素。
  • 如果您的应用请求了 ACCESS_FINE_LOCATIONACCESS_COARSE_LOCATION,系统会自动将 ACCESS_BACKGROUND_LOCATION 添加到请求中。

后台 Activity 限制

从 Android 10 开始,系统会增加针对从后台启动 Activity 的限制。此项行为变更有助于最大限度地减少对用户造成的干扰,并且可以让用户更好地控制其屏幕上显示的内容。只要您的应用启动 activity 是因用户互动直接引发的,该应用就极有可能不会受到这些限制的影响。
如需详细了解从后台启动 activity 的建议替代方法,请参阅有关如何在应用中提醒用户注意有时效性的事件的指南。

相机元数据

Android 10 更改了 getCameraCharacteristics() 方法默认返回的信息的广度。具体而言,您的应用必须具有 CAMERA 权限才能访问此方法的返回值中可能包含的设备特定元数据。
如需详细了解这些变更,请参阅关于需要权限的相机字段的部分。

剪贴板数据

对于 Android 10 或更高版本,除非您的应用是默认输入法 (IME) 或是目前聚焦的应用,否则它无法访问剪贴板中的数据。

设备位置

为了让用户更好地控制应用对位置信息的访问权限,Android 10 引入了 ACCESS_BACKGROUND_LOCATION 权限。
不同于 ACCESS_FINE_LOCATIONACCESS_COARSE_LOCATION 权限,ACCESS_BACKGROUND_LOCATION 权限仅会影响应用在后台运行时对位置信息的访问权限。除非符合以下条件之一,否则应用将被视为在后台访问位置信息:

外部存储空间

默认情况下,以 Android 10 及更高版本为目标平台的应用在访问外部存储设备中的文件时存在范围限制,即分区存储。此类应用可以查看外部存储设备内以下类型的文件,无需请求任何与存储相关的用户权限:

  • 特定于应用的目录中的文件(使用 getExternalFilesDir() 访问)。
  • 应用创建的照片、视频和音频片段(通过媒体库访问)。

如需详细了解分区存储以及如何共享、访问和修改在外部存储设备上保存的文件,请参阅有关如何管理外部存储设备中的文件以及如何访问和修改媒体文件的指南。

随机分配 MAC 地址

默认情况下,在搭载 Android 10 或更高版本的设备上,系统会传输随机分配的 MAC 地址。
如果您的应用处理企业使用场景,Android 平台会提供 API,用于执行与 MAC 地址相关的几个操作。

  • 获取随机分配的 MAC 地址:设备所有者应用和资料所有者应用可以通过调用 getRandomizedMacAddress() 检索分配给特定网络的随机分配 MAC 地址。
  • 获取实际的出厂 MAC 地址:设备所有者应用可以通过调用 getWifiMacAddress() 检索设备的实际硬件 MAC 地址。此方法对于跟踪设备队列非常有用。

不可重置的设备标识符

从 Android 10 开始,应用必须具有 READ_PRIVILEGED_PHONE_STATE 特许权限才能访问设备的不可重置标识符(包括 IMEI 和序列号)。

如果您的应用没有该权限,但您仍尝试查询不可重置标识符的相关信息,则 Android 平台的响应会因目标 SDK 版本而异:

  • 如果应用以 Android 10 或更高版本为目标平台,则会发生 SecurityException
  • 如果应用以 Android 9(API 级别 28)或更低版本为目标平台,则相应方法会返回 null 或占位符数据(如果应用具有 READ_PHONE_STATE 权限)。否则,会发生 SecurityException

身体活动识别

Android 10 针对需要检测用户步数或对用户的身体活动(例如步行、骑车或坐车)进行分类的应用引入了 android.permission.ACTIVITY_RECOGNITION 运行时权限。此项权限旨在让用户了解设备传感器数据在“设置”中的使用方式。
除非用户已向您的应用授予此权限,否则 Google Play 服务中的一些库(例如 Activity Recognition APIGoogle Fit API)不会提供结果。
设备上要求您声明此权限的内置传感器只有计步器步测器传感器。
如果您的应用以 Android 9(API 级别 28)或更低版本为目标平台,只要您的应用满足以下各项条件,系统会根据需要自动向您的应用授予 android.permission.ACTIVITY_RECOGNITION 权限:

  • 清单文件包含 com.google.android.gms.permission.ACTIVITY_RECOGNITION 权限。
  • 清单文件包含 android.permission.ACTIVITY_RECOGNITION 权限。

如果系统自动授予 android.permission.ACTIVITY_RECOGNITION 权限,当您将应用更新为以 Android 10 为目标平台后,您的应用会保留此权限。但是,用户可以随时在系统设置中撤消此权限。

/proc/net 文件系统限制

在搭载 Android 10 或更高版本的设备上,应用无法访问 /proc/net,包括与设备的网络状态相关的信息。需要访问此信息的应用(如 VPN)应使用 NetworkStatsManagerConnectivityManager 类。

从界面中移除了权限组

从 Android 10 开始,应用无法在界面中查询权限的分组方式

移除了联系人关系密切程度

从 Android 10 开始,平台不再记录联系人的关系密切程度信息。因此,如果您的应用对用户的联系人进行搜索,系统将不会按互动频率对搜索结果排序。
有关 ContactsProvider 的指南包含一项说明特定字段和方法已废弃的声明(从 Android 10 开始,这些字段和方法在所有设备上已作废)。

限制对屏幕内容的访问

为了保护用户的屏幕内容,Android 10 更改了 READ_FRAME_BUFFERCAPTURE_VIDEO_OUTPUTCAPTURE_SECURE_VIDEO_OUTPUT 权限的作用域,从而禁止以静默方式访问设备的屏幕内容。从 Android 10 开始,这些权限只能通过签名访问
需要访问设备屏幕内容的应用应使用 MediaProjection API,此 API 会显示要求用户同意访问的提示。

USB 设备序列号

如果您的应用以 Android 10 或更高版本为目标平台,则该应用只能在用户授予其访问 USB 设备或配件的权限后才能读取序列号。
如需详细了解如何使用 USB 设备,请参阅有关如何配置 USB 主机的指南。

Wi-Fi

以 Android 10 或更高版本为目标平台的应用无法启用或停用 Wi-Fi。WifiManager.setWifiEnabled() 方法始终返回 false
如果您需要提示用户启用或停用 Wi-Fi,请使用设置面板

对直接访问已配置的 Wi-Fi 网络实施了限制

为了保护用户隐私,只有系统应用和设备政策控制者 (DPC) 支持手动配置 Wi-Fi 网络列表。给定 DPC 可以是设备所有者,也可以是资料所有者。
如果应用以 Android 10 或更高版本为目标平台,并且应用不是系统应用或 DPC,则下列方法不会返回有用数据:

Android 9

每个 Android 版本中都包含数十项用于保护用户的安全增强功能。如需 Android 9 中提供的一些主要安全增强功能的列表,请参阅 Android 版本说明

Android 8

Every Android release includes dozens of security enhancements to protect users. Here are some of the major security enhancements available in Android 8.0:

  • Encryption. Added support to evict key in work profile.
  • Verified Boot. Added Android Verified Boot (AVB). Verified Boot codebase supporting rollback protection for use in boot loaders added to AOSP. Recommend bootloader support for rollback protection for the HLOS. Recommend boot loaders can only be unlocked by user physically interacting with the device.
  • Lock screen. Added support for using tamper-resistant hardware to verify lock screen credential.
  • KeyStore. Required key attestation for all devices that ship with Android 8.0+. Added ID attestation support to improve Zero Touch Enrollment.
  • Sandboxing. More tightly sandboxed many components using Project Treble's standard interface between framework and device-specific components. Applied seccomp filtering to all untrusted apps to reduce the kernel's attack surface. WebView is now run in an isolated process with very limited access to the rest of the system.
  • Kernel hardening. Implemented hardened usercopy, PAN emulation, read-only after init, and KASLR.
  • Userspace hardening. Implemented CFI for the media stack. App overlays can no longer cover system-critical windows and users have a way to dismiss them.
  • Streaming OS update. Enabled updates on devices that are are low on disk space.
  • Install unknown apps. Users must grant permission to install apps from a source that isn't a first-party app store.
  • Privacy. Android ID (SSAID) has a different value for each app and each user on the device. For web browser apps, Widevine Client ID returns a different value for each app package name and web origin. net.hostname is now empty and the dhcp client no longer sends a hostname. android.os.Build.SERIAL has been replaced with the Build.SERIAL API which is protected behind a user-controlled permission. Improved MAC address randomization in some chipsets.

Android 7

每个 Android 版本中都包含数十项用于保护用户的安全增强功能。以下是 Android 7.0 中提供的一些主要安全增强功能:

  • 文件级加密:在文件级进行加密,而不是将整个存储区域作为单个单元进行加密。这种加密方式可以更好地隔离和保护设备上的不同用户和资料(例如个人资料和工作资料)。
  • 直接启动:通过文件级加密实现,允许特定应用(例如,闹钟和无障碍功能)在设备已开机但未解锁的情况下运行。
  • 验证启动:现在,验证启动会被严格强制执行,从而使遭到入侵的设备无法启动;验证启动支持纠错功能,有助于更可靠地防范非恶意数据损坏。
  • SELinux。更新后的 SELinux 配置和更高的 Seccomp 覆盖率有助于进一步锁定应用沙盒并减小受攻击面。
  • 库加载顺序随机化和改进的 ASLR。 增大随机性降低了某些代码重用攻击的有效性。
  • 内核加固:通过将内核内存的各个分区标记为只读,限制内核对用户空间地址的访问,并进一步减小现有的受攻击面,为更高版本的内核添加额外的内存保护。
  • APK 签名方案 v2:引入了一种全文件签名方案,该方案有助于加快验证速度并增强完整性保证。
  • 可信 CA 存储区。为了使应用更容易控制对其安全网络流量的访问,对于 API 级别为 24 及以上的应用,由用户安装的证书颁发机构以及通过 Device Admin API 安装的证书颁发机构在默认情况下不再受信任。此外,所有新的 Android 设备必须搭载相同的可信 CA 存储区。
  • 网络安全配置。通过声明式配置文件来配置网络安全设置和传输层安全协议 (TLS)。

Android 6

Every Android release includes dozens of security enhancements to protect users. Here are some of the major security enhancements available in Android 6.0:

  • Runtime Permissions. Apps request permissions at runtime instead of being granted at App install time. Users can toggle permissions on and off for both M and pre-M apps.
  • Verified Boot. A set of cryptographic checks of system software are conducted prior to execution to ensure the phone is healthy from the bootloader all the way up to the operating system.
  • Hardware-Isolated Security. New Hardware Abstraction Layer (HAL) used by Fingerprint API, Lockscreen, Device Encryption, and Client Certificates to protect keys against kernel compromise and/or local physical attacks
  • Fingerprints. Devices can now be unlocked with just a touch. Developers can also take advantage of new APIs to use fingerprints to lock and unlock encryption keys.
  • SD Card Adoption. Removable media can be adopted to a device and expand available storage for app local data, photos, videos, etc., but still be protected by block-level encryption.
  • Clear Text Traffic. Developers can use a new StrictMode to make sure their app doesn't use cleartext.
  • System Hardening. Hardening of the system via policies enforced by SELinux. This offers better isolation between users, IOCTL filtering, reduce threat of exposed services, further tightening of SELinux domains, and extremely limited /proc access.
  • USB Access Control: Users must confirm to allow USB access to files, storage, or other functionality on the phone. Default is now charge only with access to storage requiring explicit approval from the user.

Android 5

5.0

Every Android release includes dozens of security enhancements to protect users. Here are some of the major security enhancements available in Android 5.0:

  • Encrypted by default. On devices that ship with L out-of-the-box, full disk encryption is enabled by default to improve protection of data on lost or stolen devices. Devices that update to L can be encrypted in Settings > Security .
  • Improved full disk encryption. The user password is protected against brute-force attacks using scrypt and, where available, the key is bound to the hardware keystore to prevent off-device attacks. As always, the Android screen lock secret and the device encryption key are not sent off the device or exposed to any application.
  • Android sandbox reinforced with SELinux . Android now requires SELinux in enforcing mode for all domains. SELinux is a mandatory access control (MAC) system in the Linux kernel used to augment the existing discretionary access control (DAC) security model. This new layer provides additional protection against potential security vulnerabilities.
  • Smart Lock. Android now includes trustlets that provide more flexibility for unlocking devices. For example, trustlets can allow devices to be unlocked automatically when close to another trusted device (through NFC, Bluetooth) or being used by someone with a trusted face.
  • Multi user, restricted profile, and guest modes for phones and tablets. Android now provides for multiple users on phones and includes a guest mode that can be used to provide easy temporary access to your device without granting access to your data and apps.
  • Updates to WebView without OTA. WebView can now be updated independent of the framework and without a system OTA. This allows for faster response to potential security issues in WebView.
  • Updated cryptography for HTTPS and TLS/SSL. TLSv1.2 and TLSv1.1 is now enabled, Forward Secrecy is now preferred, AES-GCM is now enabled, and weak cipher suites (MD5, 3DES, and export cipher suites) are now disabled. See https://developer.android.com/reference/javax/net/ssl/SSLSocket.html for more details.
  • non-PIE linker support removed. Android now requires all dynamically linked executables to support PIE (position-independent executables). This enhances Android's address space layout randomization (ASLR) implementation.
  • FORTIFY_SOURCE improvements. The following libc functions now implement FORTIFY_SOURCE protections: stpcpy(), stpncpy(), read(), recvfrom(), FD_CLR(), FD_SET(), and FD_ISSET(). This provides protection against memory-corruption vulnerabilities involving those functions.
  • Security Fixes. Android 5.0 also includes fixes for Android-specific vulnerabilities. Information about these vulnerabilities has been provided to Open Handset Alliance members, and fixes are available in Android Open Source Project. To improve security, some devices with earlier versions of Android may also include these fixes.

Android 4 及更低版本

Every Android release includes dozens of security enhancements to protect users. The following are some of the security enhancements available in Android 4.4:

  • Android sandbox reinforced with SELinux. Android now uses SELinux in enforcing mode. SELinux is a mandatory access control (MAC) system in the Linux kernel used to augment the existing discretionary access control (DAC) based security model. This provides additional protection against potential security vulnerabilities.
  • Per User VPN. On multi-user devices, VPNs are now applied per user. This can allow a user to route all network traffic through a VPN without affecting other users on the device.
  • ECDSA Provider support in AndroidKeyStore. Android now has a keystore provider that allows use of ECDSA and DSA algorithms.
  • Device Monitoring Warnings. Android provides users with a warning if any certificate has been added to the device certificate store that could allow monitoring of encrypted network traffic.
  • FORTIFY_SOURCE. Android now supports FORTIFY_SOURCE level 2, and all code is compiled with these protections. FORTIFY_SOURCE has been enhanced to work with clang.
  • Certificate Pinning. Android 4.4 detects and prevents the use of fraudulent Google certificates used in secure SSL/TLS communications.
  • Security Fixes. Android 4.4 also includes fixes for Android-specific vulnerabilities. Information about these vulnerabilities has been provided to Open Handset Alliance members and fixes are available in Android Open Source Project. To improve security, some devices with earlier versions of Android may also include these fixes.

Every Android release includes dozens of security enhancements to protect users. The following are some of the security enhancements available in Android 4.3:

  • Android sandbox reinforced with SELinux. This release strengthens the Android sandbox using the SELinux mandatory access control system (MAC) in the Linux kernel. SELinux reinforcement is invisible to users and developers, and adds robustness to the existing Android security model while maintaining compatibility with existing apps. To ensure continued compatibility this release allows the use of SELinux in a permissive mode. This mode logs any policy violations, but will not break apps or affect system behavior.
  • No setuid or setgid programs. Added support for filesystem capabilities to Android system files and removed all setuid or setgid programs. This reduces root attack surface and the likelihood of potential security vulnerabilities.
  • ADB authentication. Starting in Android 4.2.2, connections to ADB are authenticated with an RSA keypair. This prevents unauthorized use of ADB where the attacker has physical access to a device.
  • Restrict Setuid from Android Apps. The /system partition is now mounted nosuid for zygote-spawned processes, preventing Android apps from executing setuid programs. This reduces root attack surface and the likelihood of potential security vulnerabilities.
  • Capability bounding. Android zygote and ADB now use prctl(PR_CAPBSET_DROP) to drop unnecessary capabilities prior to executing apps. This prevents Android apps and apps launched from the shell from acquiring privileged capabilities.
  • AndroidKeyStore Provider. Android now has a keystore provider that allows apps to create exclusive use keys. This provides apps with an API to create or store private keys that cannot be used by other apps.
  • KeyChain isBoundKeyAlgorithm. Keychain API now provides a method (isBoundKeyType) that allows apps to confirm that system-wide keys are bound to a hardware root of trust for the device. This provides a place to create or store private keys that can't be exported off the device, even in the event of a root compromise.
  • NO_NEW_PRIVS. Android zygote now uses prctl(PR_SET_NO_NEW_PRIVS) to block addition of new privileges prior to execution app code. This prevents Android apps from performing operations that can elevate privileges through execve. (This requires Linux kernel version 3.5 or greater).
  • FORTIFY_SOURCE enhancements. Enabled FORTIFY_SOURCE on Android x86 and MIPS and fortified strchr(), strrchr(), strlen(), and umask() calls. This can detect potential memory corruption vulnerabilities or unterminated string constants.
  • Relocation protections. Enabled read only relocations (relro) for statically linked executables and removed all text relocations in Android code. This provides defense in depth against potential memory corruption vulnerabilities.
  • Improved EntropyMixer. EntropyMixer now writes entropy at shutdown or reboot, in addition to periodic mixing. This allows retention of all entropy generated while devices are powered on, and is especially useful for devices that are rebooted immediately after provisioning.
  • Security fixes. Android 4.3 also includes fixes for Android-specific vulnerabilities. Information about these vulnerabilities has been provided to Open Handset Alliance members and fixes are available in Android Open Source Project. To improve security, some devices with earlier versions of Android may also include these fixes.

Android 提供了一个多层安全模型,Android 安全性概述中对该模型进行了介绍。每个 Android 更新版本中都包含数十项用于保护用户的安全增强功能。 以下是 Android 4.2 中引入的一些安全增强功能:

  • 应用验证:用户可以选择启用“验证应用”,并且可以选择在安装应用之前由应用验证程序对应用进行筛查。如果用户尝试安装的应用可能有害,应用验证功能可以提醒用户;如果应用的危害性非常大,应用验证功能可以阻止安装。
  • 加强对付费短信的控制:如果有应用尝试向使用付费服务的短号码发送短信(可能会产生额外的费用),Android 将会通知用户。用户可以选择是允许还是阻止该应用发送短信。
  • 始终开启的 VPN:可以配置 VPN,以确保在建立 VPN 连接之前应用无法访问网络。这有助于防止应用跨其他网络发送数据。
  • 证书锁定:Android 的核心库现在支持证书锁定。如果证书未关联到一组应关联的证书,锁定的域将会收到证书验证失败消息。这有助于保护证书授权机构免遭可能的入侵。
  • 改进后的 Android 权限显示方式:权限划分到了多个对用户来说更清晰明了的组中。在审核权限时,用户可以点击权限来查看关于相应权限的更多详细信息。
  • installd 安全强化:installd 守护程序不会以 root 用户身份运行,这样可以缩小 root 提权攻击的潜在攻击面。
  • init 脚本安全强化:init 脚本现在会应用 O_NOFOLLOW 语义来防范与符号链接相关的攻击。
  • FORTIFY_SOURCEAndroid 现在会实现 FORTIFY_SOURCE,以供系统库和应用用于防范内存损坏。
  • ContentProvider 默认配置:默认情况下,对于每个 content provider,以 API 级别 17 为目标的应用都会将 export 设为 false,以缩小应用的默认受攻击面。
  • 加密:修改了 SecureRandom 和 Cipher.RSA 的默认实现,以便使用 OpenSSL。为使用 OpenSSL 1.0.1 的 TLSv1.1 和 TLSv1.2 添加了安全套接字支持
  • 安全漏洞修复程序:升级了开放源代码库,在其中新增了一些安全漏洞修复程序,其中包括 WebKit、libpng、OpenSSL 和 LibXML。Android 4.2 中还包含针对 Android 特有漏洞的修复程序。有关这些漏洞的信息已提供给“开放手机联盟”(Open Handset Alliance) 成员,并且 Android 开放源代码项目中提供了相应的修复程序。为了提高安全性,部分搭载更低版本 Android 系统的设备可能也会包含这些修复程序。

Android provides a multi-layered security model described in the Android Security Overview. Each update to Android includes dozens of security enhancements to protect users. The following are some of the security enhancements introduced in Android versions 1.5 through 4.1:

Android 1.5
  • ProPolice to prevent stack buffer overruns (-fstack-protector)
  • safe_iop to reduce integer overflows
  • Extensions to OpenBSD dlmalloc to prevent double free() vulnerabilities and to prevent chunk consolidation attacks. Chunk consolidation attacks are a common way to exploit heap corruption.
  • OpenBSD calloc to prevent integer overflows during memory allocation
Android 2.3
  • Format string vulnerability protections (-Wformat-security -Werror=format-security)
  • Hardware-based No eXecute (NX) to prevent code execution on the stack and heap
  • Linux mmap_min_addr to mitigate null pointer dereference privilege escalation (further enhanced in Android 4.1)
Android 4.0
Address Space Layout Randomization (ASLR) to randomize key locations in memory
Android 4.1
  • PIE (Position Independent Executable) support
  • Read-only relocations / immediate binding (-Wl,-z,relro -Wl,-z,now)
  • dmesg_restrict enabled (avoid leaking kernel addresses)
  • kptr_restrict enabled (avoid leaking kernel addresses)