Android Security Internals

Book description

Android Security Internals delves into Android components and subsystems to give you a deep and complete understanding of the security internals of Android devices.

Table of contents

  1. Android Security Internals: An In-Depth Guide to Android’s Security Architecture
    1. About the Author
    2. About the Technical Reviewer
  2. Foreword
  3. Acknowledgments
  4. Introduction
    1. Who This Book Is For
    2. Prerequisites
    3. Android Versions
    4. How Is This Book Organized?
    5. Conventions
  5. 1. Android’s Security Model
    1. Android’s Architecture
      1. Linux Kernel
      2. Native Userspace
      3. Dalvik VM
      4. Java Runtime Libraries
      5. System Services
      6. Inter-Process Communication
      7. Binder
        1. Binder Implementation
        2. Binder Security
        3. Binder Identity
        4. Capability-Based Security
        5. Binder Tokens
        6. Accessing Binder Objects
        7. Other Binder Features
      8. Android Framework Libraries
      9. Applications
        1. System Apps
        2. User-Installed Apps
        3. Android App Components
    2. Android’s Security Model
      1. Application Sandboxing
      2. Permissions
      3. IPC
      4. Code Signing and Platform Keys
      5. Multi-User Support
      6. SELinux
      7. System Updates
      8. Verified Boot
    3. Summary
  6. 2. Permissions
    1. The Nature of Permissions
    2. Requesting Permissions
    3. Permission Management
    4. Permission Protection Levels
      1. normal
      2. dangerous
      3. signature
      4. signatureOrSystem
    5. Permission Assignment
      1. Permissions and Process Attributes
        1. Process Attribute Assignment
    6. Permission Enforcement
      1. Kernel-Level Enforcement
      2. Native Daemon-Level Enforcement
      3. Framework-Level Enforcement
        1. Dynamic Enforcement
        2. Static Enforcement
        3. Activity and Service Permission Enforcement
        4. Content Provider Permission Enforcement
        5. Broadcast Permission Enforcement
        6. Protected and Sticky Broadcasts
    7. System Permissions
      1. Signature Permissions
      2. Development Permissions
    8. Shared User ID
    9. Custom Permissions
    10. Public and Private Components
    11. Activity and Service Permissions
    12. Broadcast Permissions
    13. Content Provider Permissions
      1. Static Provider Permissions
      2. Dynamic Provider Permissions
    14. Pending Intents
    15. Summary
  7. 3. Package Management
    1. Android Application Package Format
    2. Code signing
      1. Java Code Signing
        1. Implementation
        2. JAR File Signing
        3. JAR File Verification
        4. Viewing or Extracting Signer Information
      2. Android Code Signing
        1. Android Code Signing Tools
        2. OTA File Code Signing
    3. APK Install Process
      1. Location of Application Packages and Data
      2. Active Components
        1. PackageInstaller System Application
        2. pm command
        3. PackageManagerService
        4. Installer class
        5. installd Daemon
        6. MountService
        7. vold daemon
        8. MediaContainerService
        9. AppDirObserver
      3. Installing a Local Package
        1. Parsing and Verifying the Package
        2. Accepting Permissions and Starting the Install Process
        3. Copying to the Application Directory
        4. The Package Scan
        5. Creating Data Directories
        6. Generating Optimized DEX
        7. File and Directory Structure
        8. Adding the New Package to packages.xml
        9. Package Attributes
        10. Updating Components and Permissions
      4. Updating a Package
        1. Signature Verification
        2. Updating Non-System Apps
        3. Updating System Apps
      5. Installing Encrypted APKs
        1. Creating and Installing an Encrypted APK
        2. Implementation and Encryption Parameters
        3. Installing an Encrypted APK with Integrity Check
      6. Forward Locking
      7. Android 4.1 Forward Locking Implementation
        1. Encrypted App Containers
        2. Installing Forward-Locked APKs
      8. Encrypted Apps and Google Play
    4. Package Verification
      1. Android Support for Package Verification
      2. Google Play Implementation
    5. Summary
  8. 4. User Management
    1. Multi-User Support Overview
    2. Types of Users
      1. The Primary User (Owner)
      2. Secondary Users
      3. Restricted Profiles
        1. User Restrictions
        2. Applying Restrictions
        3. Access to Online Accounts
      4. Guest User
    3. User Management
      1. Command-Line Tools
      2. User States and Related Broadcasts
    4. User Metadata
      1. The User List File
      2. User Metadata Files
      3. User System Directory
    5. Per-User Application Management
      1. Application Data Directories
      2. Application Sharing
    6. External Storage
      1. External Storage Implementations
      2. Multi-User External Storage
        1. Advanced Linux Mount Features
        2. Android Implementation
      3. External Storage Permissions
    7. Other Multi-User Features
    8. Summary
  9. 5. Cryptographic Providers
    1. JCA Provider Architecture
      1. Cryptographic Service Providers
        1. Provider Implementation
        2. Static Provider Registration
        3. Dynamic Provider Registration
    2. JCA Engine Classes
      1. Obtaining an Engine Class Instance
      2. Algorithm Names
      3. SecureRandom
      4. MessageDigest
      5. Signature
      6. Cipher
        1. Block Cipher Modes of Operation
        2. Obtaining a Cipher Instance
        3. Using a Cipher
      7. Mac
      8. Key
      9. SecretKey and PBEKey
      10. PublicKey, PrivateKey, and KeyPair
      11. KeySpec
      12. KeyFactory
      13. SecretKeyFactory
      14. KeyPairGenerator
      15. KeyGenerator
      16. KeyAgreement
      17. KeyStore
        1. KeyStore Types
        2. PKCS#12 File-Backed KeyStores
      18. CertificateFactory and CertPath
      19. CertPathValidator and CertPathBuilder
    3. Android JCA Providers
      1. Harmony’s Crypto Provider
      2. Android’s Bouncy Castle Provider
      3. AndroidOpenSSL Provider
      4. OpenSSL
    4. Using a Custom Provider
      1. Spongy Castle
    5. Summary
  10. 6. Network Security and PKI
    1. PKI and SSL Overview
      1. Public Key Certificates
      2. Direct Trust and Private CAs
      3. Public Key Infrastructure
      4. Certificate Revocation
    2. JSSE Introduction
      1. Secure Sockets
      2. Peer Authentication
      3. Hostname Verification
    3. Android JSSE Implementation
      1. Certificate Management and Validation
        1. System Trust Stores
        2. Android 4.x System Trust Store
        3. Using the System Trust Store
        4. System Trust Store APIs
      2. Certificate Blacklisting
        1. Handling CA Key Compromises
        2. Handling End Entity Key Compromises
        3. Android Certificate Blacklisting
      3. Reexamining the PKI Trust Model
        1. Trust Problems in Today’s PKI
        2. Radical Solutions
        3. Convergence and Trust Agility
        4. Certificate Pinning
        5. Certificate Pinning in Android
    4. Summary
  11. 7. Credential Storage
    1. VPN and Wi-Fi EAP Credentials
      1. Authentication Keys and Certificates
      2. The System Credential Store
    2. Credential Storage Implementation
      1. The keystore Service
      2. Key Blob Versions and Types
      3. Access Restrictions
      4. keymaster Module and keystore Service Implementation
      5. Nexus 4 Hardware-Backed Implementation
      6. Framework Integration
    3. Public APIs
      1. The KeyChain API
        1. The KeyChain Class
        2. Installing a PKCS#12 File
        3. Using a Private Key
        4. Installing a CA Certificate
        5. Deleting Keys and User Certificates
        6. Getting Information about Supported Algorithms
      2. KeyChain API Implementation
      3. Controlling Access to the Keystore
        1. KeyChainBroadcastReceiver
        2. Credential and Trust Store Summary
      4. Android Keystore Provider
    4. Summary
  12. 8. Online Account Management
    1. Android Account Management Overview
    2. Account Management Implementation
      1. AccountManagerService and AccountManager
      2. Authenticator Modules
      3. The Authenticator Module Cache
      4. AccountManagerService Operations and Permissions
        1. Listing and Authenticating Accounts
        2. Managing Accounts
        3. Using Account Credentials
        4. Requesting Authentication Token Access
      5. The Accounts Database
        1. Table Schema
        2. Table Access
        3. Password Security
      6. Multi-User Support
        1. Per-User Account Databases
        2. Shared Accounts
      7. Adding an Authenticator Module
    3. Google Accounts Support
      1. The Google Login Service
      2. Google Services Authentication and Authorization
        1. ClientLogin
        2. OAuth 2.0
      3. Google Play Services
    4. Summary
  13. 9. Enterprise Security
    1. Device Administration
      1. Implementation
        1. Privilege Management
        2. Policy Persistence
        3. Policy Enforcement
      2. Adding a Device Administrator
        1. Implementing a Device Administrator
        2. Setting the Device Owner
        3. Managed Devices
      3. Enterprise Account Integration
        1. Microsoft Exchange ActiveSync
        2. Google Apps
    2. VPN Support
      1. PPTP
      2. L2TP/IPSec
      3. IPSec Xauth
      4. SSL-Based VPNs
      5. Legacy VPN
        1. Implementation
        2. Profile and Credential Storage
        3. Accessing Credentials
        4. Always-On VPN
      6. Application-Based VPNs
        1. Declaring a VPN
        2. Preparing the VPN
        3. Establishing a VPN Connection
        4. Notifying the User About the VPN Connection
      7. Multi-User Support
        1. Linux Advanced Routing
        2. Multi-User VPN Implementation
    3. Wi-Fi EAP
      1. EAP Authentication Methods
      2. Android Wi-Fi Architecture
      3. EAP Credentials Management
      4. Adding an EAP Network with WifiManager
    4. Summary
  14. 10. Device Security
    1. Controlling OS Boot-Up and Installation
      1. Bootloader
      2. Recovery
    2. Verified Boot
      1. dm-verity Overview
      2. Android Implementation
      3. Enabling Verified Boot
    3. Disk Encryption
      1. Cipher Mode
      2. Key Derivation
      3. Disk Encryption Password
      4. Changing the Disk Encryption Password
      5. Enabling Encryption
        1. Controlling Device Encryption Using System Properties
        2. Unmounting /data
        3. Triggering the Encryption Process
        4. Updating the Crypto Footer and Encrypting Data
      6. Booting an Encrypted Device
        1. Obtaining the Disk Encryption Password
        2. Decrypting and Mounting /data
        3. Starting All System Services
    4. Screen Security
      1. Lockscreen Implementation
      2. Keyguard Unlock Methods
        1. Face Unlock
        2. Pattern Unlock
        3. PIN and Password Unlock
        4. PIN and PUK Unlock
      3. Brute-Force Attack Protection
    5. Secure USB Debugging
      1. ADB Overview
      2. The Need for Secure ADB
      3. Securing ADB
      4. Secure ADB Implementation
      5. ADB Authentication Keys
      6. Verifying the Host Key Fingerprint
    6. Android Backup
      1. Android Backup Overview
        1. Cloud Backup
        2. Local Backup
      2. Backup File Format
      3. Backup Encryption
      4. Controlling Backup Scope
    7. Summary
  15. 11. NFC and Secure Elements
    1. NFC Overview
    2. Android NFC Support
      1. Reader/Writer Mode
        1. Registering for Tag Dispatch
        2. Tag Technologies
        3. Reading a Tag
        4. Using Reader Mode
      2. Peer-to-Peer Mode
      3. Card Emulation Mode
    3. Secure Elements
      1. SE Form Factors in Mobile Devices
        1. UICC
        2. microSD-Based SE
        3. Embedded SE
      2. Accessing the Embedded SE
        1. Granting Access to the eSE
        2. Using the NfcExecutionEnvironment API
        3. eSE-Related Broadcasts
      3. Android SE Execution Environment
        1. SE Communication Protocols
        2. Querying the eSE Execution Environment
      4. UICC as a Secure Element
        1. SIM Cards and UICCs
        2. UICC Applications
        3. UICC Application Implementation and Installation
        4. Accessing the UICC
        5. Using the OpenMobile API
    4. Software Card Emulation
      1. Android 4.4 HCE Architecture
      2. APDU Routing
        1. Specifying Routing for HCE Services
        2. Specifying Routing for SE Applets
      3. Writing an HCE Service
      4. Security of HCE Applications
    5. Summary
  16. 12. Selinux
    1. SELinux Introduction
      1. SELinux Architecture
      2. Mandatory Access Control
      3. SELinux Modes
      4. Security Contexts
      5. Security Context Assignment and Persistence
      6. Security Policy
      7. Policy Statements
        1. Type and Attribute Statements
        2. User and Role Statements
        3. Object Class and Permission Statements
      8. Type Transition Rules
      9. Domain Transition Rules
      10. Access Vector Rules
        1. allow Rules
        2. auditallow Rules
        3. dontaudit Rules
        4. neverallow Rules
    2. Android Implementation
      1. Kernel Changes
      2. Userspace Changes
        1. Libraries and Tools
        2. System Initialization
        3. Labeling Files
        4. Labeling System Properties
        5. Labeling Application Processes
        6. Middleware MAC
      3. Device Policy Files
      4. Policy Event Logging
    3. Android 4.4 SELinux Policy
      1. Policy Overview
      2. Enforcing Domains
      3. Unconfined Domains
      4. App Domains
    4. Summary
  17. 13. System Updates and Root Access
    1. Bootloader
      1. Unlocking the Bootloader
      2. Fastboot Mode
        1. Android Partition Layout
        2. The Fastboot Protocol
        3. Fastboot Commands
    2. Recovery
      1. Stock Recovery
        1. Controlling the Recovery
        2. Sideloading an OTA Package
        3. OTA Signature Verification
        4. Starting the System Update Process
        5. Applying the Update
        6. Copying and Patching Files
        7. Setting File Ownership, Permissions, and Security Labels
        8. Finishing the Update
        9. Updating the Recovery
      2. Custom Recoveries
    3. Root Access
      1. Root Access on Engineering Builds
        1. Starting ADB as Root
        2. Using the su Command
    4. Root Access on Production Builds
      1. Rooting by Changing the boot or system Image
      2. Rooting by Flashing an OTA Package
        1. SuperSU
        2. How SuperSU Is Initialized
        3. Root Access on Custom ROMs
      3. Rooting via Exploits
    5. Summary
  18. Index
  19. Copyright

Product information

  • Title: Android Security Internals
  • Author(s):
  • Release date: October 2014
  • Publisher(s): No Starch Press
  • ISBN: 9781593275815