Lecture 2 PLATFORM SECURITY IN ANDROID OS



Similar documents
Lecture 17: Mobile Computing Platforms: Android. Mythili Vutukuru CS 653 Spring 2014 March 24, Monday

Analysis of advanced issues in mobile security in android operating system

Security Guide. BlackBerry Enterprise Service 12. for ios, Android, and Windows Phone. Version 12.0

Understanding Android s Security Framework

Android Security. Giovanni Russello

The Case for SE Android. Stephen Smalley Trust Mechanisms (R2X) National Security Agency

Key & Data Storage on Mobile Devices

A Perspective on the Evolution of Mobile Platform Security Architectures

ipad in Business Security

Example of Standard API

ANDROID OPERATING SYSTEM

BlackBerry Enterprise Service 10. Secure Work Space for ios and Android Version: Security Note

Mobile Platform Security Architectures A perspective on their evolution

APPENDIX B1 - FUNCTIONALITY AND INTEGRATION REQUIREMENTS RESPONSE FORM FOR A COUNTY HOSTED SOLUTION

iphone in Business Security Overview

WIND RIVER SECURE ANDROID CAPABILITY

Deploying iphone and ipad Security Overview

MOBILE SECURITY. As seen by FortConsult. Lars Syberg Head of Security Services

Tutorial on Smartphone Security

company policies are adhered to and all parties (traders,

BlackBerry Device Software. Protecting BlackBerry Smartphones Against Malware. Security Note

Security Technical. Overview. BlackBerry Enterprise Service 10. BlackBerry Device Service Solution Version: 10.2

An Introduction to Android

In-Depth Look at Capabilities: Samsung KNOX and Android for Work

ios Security Decoded Dave Test Classroom and Lab Computing Penn State ITS Feedback -

Android Programming and Security

A Look through the Android Stack

Overview of CS 282 & Android

Android Virtualization from Sierraware. Simply Secure

Hacking your Droid ADITYA GUPTA

QUIRE: : Lightweight Provenance for Smart Phone Operating Systems

ANDROID BASED MOBILE APPLICATION DEVELOPMENT and its SECURITY

Mobile Operating Systems. Week I

Mobile applications security Android OS (case study) Maciej Olewiński. Cryptographic Seminar r.

Xperia TM. Read about how Xperia TM devices can be administered in a corporate IT environment

Publishing to TIZEN Using the Automated Conversion/Repackaging of Existing Android Apps. Hyeokgon Ryu, Infraware Technology, Ltd.

Salesforce1 Mobile Security Guide

Navigating Endpoint Encryption Technologies

Security Guide. BlackBerry Enterprise Service 12. for BlackBerry. Version 12.0

Android Security for Enterprise App Developers Jon Preedy

Android Architecture. Alexandra Harrison & Jake Saxton

How To Develop Android On Your Computer Or Tablet Or Phone

Creating and Using Databases for Android Applications

Xperia TM. Read about how Xperia TM devices can be administered in a corporate IT environment

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

Android Development. Lecture AD 0 Android SDK & Development Environment. Università degli Studi di Parma. Mobile Application Development

Security Enhanced (SE) Android: Bringing Flexible MAC to Android

Good for Enterprise Good Dynamics

Mobile Devices - An Introduction to the Android Operating Environment. Design, Architecture, and Performance Implications

COMMONWEALTH OF PENNSYLVANIA DEPARTMENT S OF PUBLIC WELFARE, INSURANCE AND AGING

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

Overview. The Android operating system is like a cake consisting of various layers.

Android Architecture For Beginners

Android Security Joshua Hodosh and Tim Leek

BYOD Guidance: BlackBerry Secure Work Space

Firewall-based Solution for Preventing Privilege Escalation Attacks in Android

End User Devices Security Guidance: Apple OS X 10.10

M-Shield mobile security technology

Oracle Solaris Security: Mitigate Risk by Isolating Users, Applications, and Data

Release Notes. KNOX Premium SDK. Version 2.5

AllJoyn Android Environment Setup Guide

Mobile Device Management and Security Glossary

Adobe Flash Player and Adobe AIR security

BM482E Introduction to Computer Security

Xperia TM Security. Read about how Xperia TM devices manage security in a corporate IT environment

Guidance End User Devices Security Guidance: Apple OS X 10.9

Windows Phone 8 Security deep dive

Ensuring the security of your mobile business intelligence

Introduction to Android 5 Security

Android Fundamentals 1

BYOD: End-to-End Security

Security Solution for Android Application Assessment

Using Chroot to Bring Linux Applications to Android

Fourteenforty Research Institute, Inc.

CS 356 Lecture 25 and 26 Operating System Security. Spring 2013

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

NSA Security-Enhanced Linux (SELinux)

AirWatch Enterprise Mobility Management. AirWatch Enterprise Mobility Management

Android Operating System

Ensuring the security of your mobile business intelligence

Introduction to Android

BlackBerry 10.3 Work and Personal Corporate

Android Geek Night. Application framework

Introducing etoken. What is etoken?

Transcription:

Lecture 2 PLATFORM SECURITY IN ANDROID OS

You will be learning: Android as a software platform Internals and surrounding ecosystem Security techniques in Android: Application signing Application isolation Permission-based access control Hardware-based security features 2

Mobile Software platform security Mobile Device Third-party library Application Third-party service System service System library User Platform Security Architecture Reference Monitor IPC Software Isolation Developer Platform Provider Administrator System Updater Device Management Boot Verifier Secure Storage Provider Policy Database Application Database Legacy DAC Application Installer Application Loader Execution Protection HW Security API Centralized Marketplace Operator Auxiliary Marketplace Operator Boot Integrity Secure Storage Device Identification Isolated Execution Device Authentication Legend Role Platform Security Component Third-Party Software Component Hardware-Security Functionality 3

Mobile software platforms Which mobile platforms have you heard of? 4

Smartphone platforms (Image TODO) Android ios Windows Phone Other 81,2% 15,8% 2,2% 0,8% (IDC Dec 2015, market share forecast 2015) 5

Android in a nutshell Linux-based (ARM, x86, x86_64, MIPS) Widely used for phones and tablets Wearables, smart TVs, cameras, (handheld) gaming consoles, etc. Open-source software stack + closed source applications and services 6

Security goals Android Protect user data Protect system resources Provide application isolation 7

On terminology Linux = the kernel Desktop Linux GNU / Linux Linux DAC = (Unix) file permissions Linux MAC = SELinux Permissions = Android app perms. 8

Middleware Android Software Stack System Applications Manager IPC Proxies Third-party Applications Content Providers Applications Application Framework System Services & Managers System Server Media Services Media Server Java Core Library Core Libraries Native Daemons Native Libraries ART Android Runtime HAL Modules Hardware Abstraction Layer (HAL) Dalvik Drivers Binder SELinux Power Management Linux Kernel Android Open Source Project. Security. 2015 9

Reference monitors Android Software Stack System Applications Manager IPC Proxies Third-party Applications Content Providers Applications Application Framework System Services & Managers System Server Media Services Media Server Java Core Library Core Libraries Native Daemons Native Libraries ART Android Runtime HAL Modules Hardware Abstraction Layer (HAL) Dalvik Drivers Binder SELinux Power Management Linux Kernel Android Open Source Project. Security. 2015 10

Android Software Stack System Applications Third-party Applications Android OS Applications Trusted Execution Environment Manager IPC Proxies Content Providers Application Framework System Services & Managers System Server Media Services Media Server Java Core Library Core Libraries Native Daemons Native Libraries Native Code ART Android Runtime HAL Modules Hardware Abstraction Layer (HAL) Dalvik Trusted Applications Trusted OS Services Drivers Binder SELinux Power Management Linux Kernel Trusted OS Kernel Hardware Google. Android for Work Security white paper. 2015 11

Application components Manifest Activity Visible UI Intent Service Background job Signature Content Provider Database Broadcast Receiver Enck, Ongtang, McDaniel. Enck, Ongtang, McDaniel: Understanding Android Security. 2009 Android Open Source Project. Application Security. 2015 12

Software distribution Developer Apps from multiple sources Google Play Auxiliary marketplaces Sideloading Pre-installed software Marketplace services Discovery Purchase & Installation User-submitted ratings / flagging Malware scans (Google Bouncer) Remote application installation & removal App Installer Market 13

Application signing Goal: same-origin policy for apps MyApp Developer signs with private key Signature verified with developer s public key 14

Application signing (cont.) For application packages (APKs) Self-signed X.509 certificates (no PKI!) Individual signature for each file part of APK Package update requires same certificate For over-the-air updates (OTAs) Signature over entire file stored in ZIP comment Verified by OS and Recovery Mode System images must be signed (since 6.0) Elenkov. Android s Security Architecture. 2015. 15

Com.example.app.apk Android application packages MANIFEST.MF META_INF CERT.RSA AndroidManifest.XML classes.dex lib res assets CERT.SF native code non-compiled resources application assets 16

Com.example.app.apk Package Installation META_INF AndroidManifest.XML classes.dex lib res MANIFEST.MF CERT.RSA CERT.SF native code <arch>/libapp.so non-compiled resources Code and resources (common) /data/app/com.example.app/ lib/<arch>/libapp.so oat/<arch>/base.odex base.apk Data (per user) /data/user/0/com.example.app/ files/ databases/ shared_prefs/ /data/user/1/com.example.app/... assets application assets 17

Package management components Package Installer (system app) pm command Installer /dev/socket/installd installd daemon PackageManager MountService /dev/socket/vold vold daemon AppDirObserver MediaContainerService /system /data framework/ app/ priv-app/ vendor-app/ Elenkov. Android s Security Architecture. 2015. packages.xml packages.list app/ data/ media/ user/ 18

Application isolation Goal: Applications cannot interfere with one another 19

Application isolation Implementation on Android: Kernel: Process & memory protection Kernel: Linux DAC Kernel: Linux MAC (SELinux) Middleware: mediation of Binder IPC Applications run in separate Dalvik / ART virtual machine instances 20

Application Sandbox Each application assigned a Unix UID One UID per user per application (since 5.0) UID owns Filesystem resources in /data/user/<nr>/ Processes Permissions (!) Applications from same developer (= signed with same developer key) may share UID sandbox 21

Application isolation System Third-party applications Services Applications Linux DAC domain (UID) 22

Rooting Rooting applications exploit vulnerabilities in privileged system daemons to obtain shell Note: bootloader unlocking intentionally supported by many OEMs e.g. fastboot oem unlock 23

SE for Android Goal: System services and applications should not be able to deviate from their intended modus operandi 24

SE for Android (cont.) Implementation on Android: Kernel-level MAC (SELinux) Policies based on SELinux context Middleware MAC (MMAC) Policies based on package identity Smalley, Craig. Smalley, Craig: Security Enhanced (SE) Android. 2013 Android Open Source Project. Security-Enhanced Linux in Android. 2015 25

SE for Android (cont.) Enforces MAC even for processes running with root/superuser privileges (since 4.4) Blocks many root exploits and misconfigurations Cannot protect against kernel exploits Smalley, Craig. Smalley, Craig: Security Enhanced (SE) Android.2013 Android Open Source Project. Security-Enhanced Linux in Android. 2015 26

SE for Android Domain - Label for process(es) Type - Label for object(s) Class - Kind of object being accessed (e.g. file, socket) Permission - Operation being performed (e.g. read, write) 27

Application isolation (cont) System Third-party applications Services Applications Linux DAC domain (UID) Linux MAC domain (SELinux) 28

Protected APIs Goal: Protect system resources from unauthorized access 29

Protected APIs System Third-party applications Services Applications Linux DAC domain (UID) Linux MAC domain (SELinux) 30

Protected APIs (cont) Implementation in Android: Protected APIs for risky actions Permission-based (mandatory) access control 31

Protected APIs(cont) What kinds of system calls on a smartphone would warrant protecting and why? 32

Risky Examples of Protected APIs Changing device wallpaper, ringtone Making phone calls, sending SMS s Using camera, microphone, GPS Internet, wireless, Bluetooth access Reading/writing contacts, SMS log Rebooting device Factory reset See also: http://developer.android.com/reference/android/manifest.permission.html 33

Sensitive user data Subject to permissions checks: Personal information (e.g. contacts) Sensitive input devices (e.g.camera) Location tracking can be manually disabled Device metadata (e.g. logs,) 34

Access control & permissions Goal: Controls application access to protected APIs (and each other) User agency vs. protecting system resources Usability of security features 35

Android permissions 4 categories Normal Dangerous System Signature or System 36

Risky Examples of Protected APIs Changing device wallpaper, ringtone Making phone calls, sending SMS s Using camera, microphone, GPS Internet, wireless, Bluetooth access Reading/writing contacts, SMS log Rebooting device Factory reset Normal Dangerous System See also: http://developer.android.com/reference/android/manifest.permission.html 37

Permission assignment Application declare all permissions in AndroidManifest.xml Permissions assigned to application UID Some permissions not user-grantable Only available to pre-installed applications INTERNET; READ CONTACTS My Messenger 38

Permission assignment Normal permission granted automatically Signature permissions granted if app signature matches the declarer of the signature System permission only assignable by OEM 39

User approval (up to 5.1) Dangerous permissions require user approval at install time If not granted, application not installed at all! Granted for all users Stored in /data/system/packages.xml Image: http://source.android.com/devices/tech/security/ 40

User approval (since 6.0) Dangerous permissions require user approval at runtime If not granted, application continues to run with limited capabilities Permission managed per application, per user Stored in /data/system/users/<id>/ runtime-permissions.xml 41

Permission revocation May be revoked later from application settings 42

Alternatives to obtaining permissions Delegate task to other application using Intent, e.g. invoke Camera app using ACTION_IMAGE_CAPTURE Intent Caller does not need CAMERA permission Caller cannot control the user experience, but does not have to provide UI for task If no default app available, user is prompted to designate the handler Android Open Source Project. Permissions Best Practices. 43

Intents Messaging object used for Inter-Component Communication (ICC) Recall: activities, services, content providers, broadcast receivers Addressing Explicit fully qualified component name Implicit Intent filter declared in manifest Provides a mechanism for late binding Pending Intents Token-based access control delegation 44

Binder IPC system for object-orientated operating system services (comp. CORBA/COM) Most underlying IPC based on Binder Intents & content providers abstractions on top of Binder Cf. local UNIX-domain sockets, signals, filesystem Bionic libc doesn t support System V IPC Does not provide mediation by itself Access mediated by system services 45

binder_become_context_manager() do_add_service() do_find_service() Binder Service Discovery ServiceManager (servicemanager) Services List (*svclist) System Server (system_server) Package Manager Application(s) Application Components e.g. Activity, Service etc. 2 Activity Manager 3 1 Other System Services & Managers 4 Framework library ioctl(binder_set_context_mgr) Binder Driver (/dev/binder) Linux Kernel 46

Starting an Activity Application Component e.g. Activity, Service etc. System Server (system_server) Package Manager 1 Activity oncreate( ) 3 Manifest RPC Stub startactivity(intent) Application Framework Binder 4 transact( ) checkcallingpermission( ) Activity Manager ICC Reference Monitor 2 PERMISSION_GRANTED Other System Services & Managers Linux Kernel 47

Starting an Activity Application Component e.g. Activity, Service etc. System Server (system_server) Package Manager 1 3 Manifest RPC Stub SecurityException startactivity(intent) Application Framework Binder 4 transact( ) checkcallingpermission( ) Activity Manager ICC Reference Monitor 2 PERMISSION_DENIED Other System Services & Managers Linux Kernel 48

Authentication Keyguard Pattern PIN / Password Gatekeeper HAL (since 6.0) Allows Keyguard to make use of native security features TrustAgentAPI (since 5.0) Enables services that notify the system about whether they believe the environment of the device to be trusted Android Open Source Project. Gatekeeper. Elenkov. Password storage in Android M. 2015. Elenkov. Dissecting Lollipop s SmartLock. 2014. 49

Authentication (cont.) Smart Lock Trust Agent (since 5.0) Trusted Bluetooth device Trusted NFC Trusted place ( via geofencing ) Facial recognition On-body detection Fingerprint HAL (since 6.0) Access to vendor-specific fingerprint hardware Elenkov. Dissecting Lollipop s SmartLock. 2014. Nexus Help: Set up your device for automatic unlock. Android Developers. Creating and monitoring Geofences. 50

Hardware-based security features Goals: Platform integrity Secure storage 51

Hardware-based security features Implementation on Android: Verified boot Full-disk encryption Keychain / Keystore 52

Keychain System credential store for private keys and certificate chains (since 4.0) KeyChain API is used for Wi-Fi and Virtual Private Network (VPN) certificates Hardware-backed keystore binds keys to device to make them non-exportable KeyInfo.isInsideSecureHardware() (since 6.0) indicates if key is stored in hardware keystore Google. Android for Work Security white paper. 2015 53

Keystore Keystore For application-bound keys Access via Java CE API KeymasterHAL Access to hardware-backed keystore Assymmetric key generation, signing and verification (since 4.1) Binder IKeyStoreInterface (since 4.3) Symmetric key support, access control, public key import and private / symmetric key import (since 6.0) Android Open Source Project. Keymaster. Elenkov. Keystore redesign in Android M.2015. Elenkov. Credential storage enhancements in Android 4.3. 2013. 54

Proprietory (device specific) Keystore (cont.) Application Android OS Application Trusted Execution Environment (TEE) Java Cryptography Extensions (JCE) AndroidKeyStore Provider IKeyStoreService KeyStoreService Keymaster HAL libkeymaster.so QSEE Communication API libqseecomapi.so KeyStore Trusted App Qualcomm Secure Execution Environment (QSEE) Hardware ARM TrustZone Elenkov. Keystore redesign in Android M.2015. Elenkov. Credential storage enhancements in Android 4.3. 2013. 55

Full Disk Encryption Block-device encryption based on dm-crypt Encrypted on first boot (since 5.0) AES 128 CBC and ESSIV:SHA256 DEK encrypted with AES 128 KEK derived from user PIN / password / pattern + hardware-bound key stored in TEE (since 5.0) Crypto acceleration through hardware AES (e.g. dm-req-crypt) Android Open Source Project. Full Disk Encryption. Elenkov. Hardware-accelerated disk encryption in Android M. 2015. 56

Verified Boot Based on dm-verity kernel feature Calculates SHA256 hash over every 4K block of the system partition block device Hash values stored in hash tree Tree collapsed into a single root hash Signature of the root hash verified with public key included on the boot partition Must be verified externally by the OEM Android Open Source Project. Verified Boot. 57

Verified Boot Hash Tree Android Open Source Project. Verified Boot. 58

Mobile Software platform security Mobile Device Third-party library Application Third-party service System service System library User Platform Security Architecture Reference Monitor IPC Software Isolation Developer Platform Provider Administrator System Updater Device Management Boot Verifier Secure Storage Provider Policy Database Application Database Legacy DAC Application Installer Application Loader Execution Protection HW Security API Centralized Marketplace Operator Auxiliary Marketplace Operator Boot Integrity Secure Storage Device Identification Isolated Execution Device Authentication Legend Role Platform Security Component Third-Party Software Component Hardware-Security Functionality 59

Did you learn: Android as a software platform Internals and surrounding ecosystem Security techniques in Android: Application signing Application isolation Permission-based access control Hardware-based security features Contributors: Thomas Nyman, Sini Ruohomaa, N. Asokan 60

Plan for the course Lecture 1: Platform security basics Lecture 2: Case study Android Lecture 3: Mobile software platform security in general Lecture 4: Hardware security enablers Lecture 5: Usability of platform security Invited lecture: SE Android policies Lecture 6: Summary and outlook 61