SlideShare a Scribd company logo
1 of 36
Download to read offline
1
Android Security,
From the Ground Up
ELCE 2014
Karim Yaghmour
@karimyaghmour
2
These slides are made available to you under a Creative Commons
Share-Alike 3.0 license. The full terms of this license are here:
https://creativecommons.org/licenses/by-sa/3.0/
Attribution requirements and misc., PLEASE READ:
● This slide must remain as-is in this specific location (slide #2),
everything else you are free to change; including the logo :-)
●
Use of figures in other documents must feature the below
“Originals at” URL immediately under that figure and the below
copyright notice where appropriate.
●
You are free to fill in the “Delivered and/or customized by” space
on the right as you see fit.
● You are FORBIDEN from using the default “About” slide as-is or
any of its contents.
(C) Copyright 2010-2014, Opersys inc.
These slides created by: Karim Yaghmour
Originals at: www.opersys.com/community/docs
Delivered and/or customized by
3
About
● Author of:
● Introduced Linux Trace Toolkit in 1999
● Originated Adeos and relayfs (kernel/relay.c)
● Training, Custom Dev, Consulting, ...
4
Android Security, From the
Ground Up
1. Goals and Features
2. Layers involved
3. CPU
4. Bootloader
5. Kernel
6. Native user-space
7. Framework
8. Updates
9. AppOpps
10.. Bottom line
5
1. Goals and Features
● Goals:
● Protect user data
● Protect system resources (including the network)
● Provide application isolation
● Key Features:
● Robust security at the OS level through the Linux kernel
● Mandatory application sandbox for all applications
● Secure interprocess communication
● Application signing
● Application-defined and user-granted permissions
6
2. Layers involved
7
8
9
10
11
3. CPU
● Paging
● Memory segmentation
● Privileged instructions
● Security:
● Secure boot
● Crypto acceleration (ARM v8)
● TrustZone
12
4. Bootloader
● Locked vs. unlocked
● Signed vs. unsigned images
● Very bootloader dependent
13
5. Kernel
● Process isolation
● UID/GID
● Capabilities
● SELinux
● Misc. additions and features
14
5.1. Process isolation
● Each process gets its own address space
● Processes can't see each others' memory
● Processes can't access the kernel's memory
● MUST use system calls to talk to kernel
15
5.2. UID/GID
● Each process has a UID / GID
● Privileges granted to processes sharing UIDs
and GIDs
● Filesystem access
● Signals
● Tracing
● etc.
16
5.3. Capabilities
● Root has a lot of power
● Sometimes only part of root privileged needed
● Use “man capabilities” to find out more
● Used by installd to drop out of root and keep
privileges.
17
5.4. SELinux
● Linux has Discretionary Access Controls (DAC) by default.
● SELinux adds Mandatory Access Controls (MAC).
● Requires all process operations to be explicitly mapped
out.
● Unlisted operations are forbidden, even if you're root.
● Provides safe firewalling in case of privilege escalation.
18
5.5. Misc. additions and features
● Paranoid networking
● CONFIG_STRICT_MEMORY_RWX
● ...
19
6. Native user-space
● Filesystem partitions
● init.rc permission settings
● /dev/*
● /dev/socket/*
● Native daemons
● installd
20
6.1. Filesystem partitions
● Each partition has different mount options
● RAM disk => Read-Only
● System image => Read-Only (unless update)
● Data image => Read-Write (specific user permissions needed)
● Cache => Read-Write
● Recovery => Not mounted by default
● Virtual filesystems (proc, sysfs, etc.)
● “sdcard” => Read-Write (world readable/writable)
● Directories and files have specific rights, see
system/core/include/private/android_filesystem_config.h
21
6.2. init.rc permission settings
● mount
● mkdir
● chown
● chmod
22
6.3. /dev/*
● All devices accessed through device nodes
● Devices nodes have regular file permissions
● Entries created by ueventd
● App do NOT have access to most entries
23
6.4. /dev/socket/*
● Unix domain sockets used native daemons and services:
srw­rw­­­­ system   system            2014­07­24 18:45 adbd
srw­rw­­­­ root     inet              2014­07­24 18:45 dnsproxyd
srw­­­­­­­ system   system            2014­07­24 18:45 installd
srw­rw­­­­ root     system            2014­07­24 18:45 mdns
srw­rw­­­­ root     system            2014­07­24 18:45 netd
srw­rw­rw­ root     root              2014­07­24 18:45 property_service
srw­rw­rw­ root     root              2014­07­24 18:45 qemud
srw­rw­­­­ root     radio             2014­07­24 18:45 rild
srw­rw­­­­ radio    system            2014­07­24 18:45 rild­debug
srw­rw­­­­ root     mount             2014­07­24 18:45 vold
srw­rw­­­­ root     system            2014­07­24 18:45 zygote
24
6.5. Native daemons
● Some native daemons authenticate the requests they
get:
● sevicemanager
● init property service
● Some daemons shadow key system services:
● vold
● netd
● rild
● keystore
25
6.6. installd
● Package Manager's “shadow”
● Starts as root
● Notifies kernel that it will drop out of root but wants to keep
capabilities.
● Changes UID to “install” user
● Sets caps kept as:
● DAC_OVERRIDE
● CHOWN
● SETUID
● SETGID
26
7. Framework
● Framework permissions
● App signatures
● Multi-human support
● Device administration
● SEAndroid
27
7.1. Framework permissions
● Since apps can't access /dev/* entries, they
must talk to system services through Binder.
● Binder doesn't enforce security
● System services check for permissions on a
call-by-call basis.
● Package Manager is solicited to check
permissions.
● Ex: checkCallingOrSelfPermission()
28
7.2. App signatures
● Apps must be signed by publisher
● Publishers are NOT authenticated
● There is NO certificate authority in this model
● Based on Java “keytool”
29
7.3. Multi-human support
● Each user gets a region of UIDs
● Each gets entries in:
● /data/user
– Per-app data directories
● /data/system/users
– Per-user accounts DB
30
7.4. Device administration
● API for BYOD
● Very limited
● Only good for password-strength enforcement
● Does not provide:
● Provisioning of apps
● Bulk configuration
31
7.5. SEAndroid
● Mandatory access controls for Android
● Enforcing/non-enforcing: setenforce
● Not merged:
● Middle-ware MAC
32
8. Updates
● OTA certs:
● platform: Phone, SystemUI, framework, etc.
● shared: Launcher2, Contacts, LatinIME, etc.
● media: Gallery, MediaProvider, etc.
● testkey: default key
● Default keys in: build/target/product/security
● Use of development/tools/make_key to
generate new keys.
33
9. AppOps
● AppOps system service
● Introduced and the removed
● frameworks/base/core/java/com/android/interna
l/app/IAppOppsService.aidl
● packages/apps/Settings/AndroidManifest.xml
34
10. Bottom line
● Strong built-in mechanisms
● but ...
● Dude, where's my “sudo apt-get update” / “sudo
apt-get upgrade”?
● No updates = No security
35
References and Pointers
● http://source.android.com/devices/tech/security/
index.html
● http://seandroid.bitbucket.org
36
Thank you ...
karim.yaghmour@opersys.com

More Related Content

What's hot

Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in AndroidOpersys inc.
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security InternalsOpersys inc.
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UIOpersys inc.
 
Is Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VIIs Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VIOpersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VILeveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VIOpersys inc.
 
Android's Multimedia Framework
Android's Multimedia FrameworkAndroid's Multimedia Framework
Android's Multimedia FrameworkOpersys inc.
 
Workshop su Android Kernel Hacking
Workshop su Android Kernel HackingWorkshop su Android Kernel Hacking
Workshop su Android Kernel HackingDeveler S.r.l.
 
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)Matthias Brugger
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowOpersys inc.
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UIOpersys inc.
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3Opersys inc.
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in AndroidOpersys inc.
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debuggingAshish Agrawal
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in AndroidOpersys inc.
 
Android On Development Boards at AnDevCon3
Android On Development Boards at AnDevCon3Android On Development Boards at AnDevCon3
Android On Development Boards at AnDevCon3Opersys inc.
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
 
Android Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IOpersys inc.
 

What's hot (20)

Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in Android
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security Internals
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UI
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Is Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VIIs Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VI
 
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VILeveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VI
 
Android's Multimedia Framework
Android's Multimedia FrameworkAndroid's Multimedia Framework
Android's Multimedia Framework
 
Workshop su Android Kernel Hacking
Workshop su Android Kernel HackingWorkshop su Android Kernel Hacking
Workshop su Android Kernel Hacking
 
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UI
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in Android
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in Android
 
Android On Development Boards at AnDevCon3
Android On Development Boards at AnDevCon3Android On Development Boards at AnDevCon3
Android On Development Boards at AnDevCon3
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
 
Android Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part I
 

Viewers also liked

Embedded Android Workshop at AnDevCon IV
Embedded Android Workshop at AnDevCon IVEmbedded Android Workshop at AnDevCon IV
Embedded Android Workshop at AnDevCon IVOpersys inc.
 
Android N Security Overview - Mobile Security Saturday at Ciklum
Android N Security Overview - Mobile Security Saturday at CiklumAndroid N Security Overview - Mobile Security Saturday at Ciklum
Android N Security Overview - Mobile Security Saturday at CiklumConstantine Mars
 
How to not disable SELinux
How to not disable SELinuxHow to not disable SELinux
How to not disable SELinuxRémy Gottschalk
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 

Viewers also liked (6)

Embedded Android Workshop at AnDevCon IV
Embedded Android Workshop at AnDevCon IVEmbedded Android Workshop at AnDevCon IV
Embedded Android Workshop at AnDevCon IV
 
Android N Security Overview - Mobile Security Saturday at Ciklum
Android N Security Overview - Mobile Security Saturday at CiklumAndroid N Security Overview - Mobile Security Saturday at Ciklum
Android N Security Overview - Mobile Security Saturday at Ciklum
 
How to not disable SELinux
How to not disable SELinuxHow to not disable SELinux
How to not disable SELinux
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Brief Tour about Android Security
Brief Tour about Android SecurityBrief Tour about Android Security
Brief Tour about Android Security
 
AndroidとSELinux
AndroidとSELinuxAndroidとSELinux
AndroidとSELinux
 

Similar to Android Security from the Ground Up: CPU, Bootloader, Kernel, Frameworks and Updates

Security Issues in Android Custom ROM
Security Issues in Android Custom ROMSecurity Issues in Android Custom ROM
Security Issues in Android Custom ROMAnant Shrivastava
 
Inside Android's UI at AnDevCon IV
Inside Android's UI at AnDevCon IVInside Android's UI at AnDevCon IV
Inside Android's UI at AnDevCon IVOpersys inc.
 
Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Opersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Inside Android's UI at AnDevCon V
Inside Android's UI at AnDevCon VInside Android's UI at AnDevCon V
Inside Android's UI at AnDevCon VOpersys inc.
 
Singularity: The Inner Workings of Securely Running User Containers on HPC Sy...
Singularity: The Inner Workings of Securely Running User Containers on HPC Sy...Singularity: The Inner Workings of Securely Running User Containers on HPC Sy...
Singularity: The Inner Workings of Securely Running User Containers on HPC Sy...inside-BigData.com
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux DevelopersOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
The Ultimate Android Security Checklist (Mdevcon 2014)
The Ultimate Android Security Checklist (Mdevcon 2014)The Ultimate Android Security Checklist (Mdevcon 2014)
The Ultimate Android Security Checklist (Mdevcon 2014)Ron Munitz
 
The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)Ron Munitz
 
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)Ron Munitz
 
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015Codemotion
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentKarim Yaghmour
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Automotive Grade Linux and systemd
Automotive Grade Linux and systemdAutomotive Grade Linux and systemd
Automotive Grade Linux and systemdAlison Chaiken
 

Similar to Android Security from the Ground Up: CPU, Bootloader, Kernel, Frameworks and Updates (20)

Android Attacks
Android AttacksAndroid Attacks
Android Attacks
 
Security Issues in Android Custom ROM
Security Issues in Android Custom ROMSecurity Issues in Android Custom ROM
Security Issues in Android Custom ROM
 
Security Issues in Android Custom Rom
Security Issues in Android Custom RomSecurity Issues in Android Custom Rom
Security Issues in Android Custom Rom
 
Android Platform Debugging & Development
Android Platform Debugging & Development Android Platform Debugging & Development
Android Platform Debugging & Development
 
Inside Android's UI at AnDevCon IV
Inside Android's UI at AnDevCon IVInside Android's UI at AnDevCon IV
Inside Android's UI at AnDevCon IV
 
Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Inside Android's UI at AnDevCon V
Inside Android's UI at AnDevCon VInside Android's UI at AnDevCon V
Inside Android's UI at AnDevCon V
 
Singularity: The Inner Workings of Securely Running User Containers on HPC Sy...
Singularity: The Inner Workings of Securely Running User Containers on HPC Sy...Singularity: The Inner Workings of Securely Running User Containers on HPC Sy...
Singularity: The Inner Workings of Securely Running User Containers on HPC Sy...
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
The Ultimate Android Security Checklist (Mdevcon 2014)
The Ultimate Android Security Checklist (Mdevcon 2014)The Ultimate Android Security Checklist (Mdevcon 2014)
The Ultimate Android Security Checklist (Mdevcon 2014)
 
The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)
 
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
 
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Automotive Grade Linux and systemd
Automotive Grade Linux and systemdAutomotive Grade Linux and systemd
Automotive Grade Linux and systemd
 

More from Opersys inc.

Android Automotive
Android AutomotiveAndroid Automotive
Android AutomotiveOpersys inc.
 
Android 10 Internals Update
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals UpdateOpersys inc.
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with PieOpersys inc.
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Opersys inc.
 
Embedded Android Workshop with Oreo
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with OreoOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Android Things: Android for IoT
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoTOpersys inc.
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things InternalsOpersys inc.
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave InternalsOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave InternalsOpersys inc.
 
Brillo/Weave Internals
Brillo/Weave InternalsBrillo/Weave Internals
Brillo/Weave InternalsOpersys inc.
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowOpersys inc.
 

More from Opersys inc. (18)

Android Automotive
Android AutomotiveAndroid Automotive
Android Automotive
 
Android 10 Internals Update
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals Update
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?
 
Embedded Android Workshop with Oreo
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with Oreo
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Android Things: Android for IoT
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoT
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things Internals
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
 
Project Ara
Project AraProject Ara
Project Ara
 
Brillo/Weave Internals
Brillo/Weave InternalsBrillo/Weave Internals
Brillo/Weave Internals
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 
Project Ara
Project AraProject Ara
Project Ara
 

Recently uploaded

Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 

Recently uploaded (20)

Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 

Android Security from the Ground Up: CPU, Bootloader, Kernel, Frameworks and Updates

  • 1. 1 Android Security, From the Ground Up ELCE 2014 Karim Yaghmour @karimyaghmour
  • 2. 2 These slides are made available to you under a Creative Commons Share-Alike 3.0 license. The full terms of this license are here: https://creativecommons.org/licenses/by-sa/3.0/ Attribution requirements and misc., PLEASE READ: ● This slide must remain as-is in this specific location (slide #2), everything else you are free to change; including the logo :-) ● Use of figures in other documents must feature the below “Originals at” URL immediately under that figure and the below copyright notice where appropriate. ● You are free to fill in the “Delivered and/or customized by” space on the right as you see fit. ● You are FORBIDEN from using the default “About” slide as-is or any of its contents. (C) Copyright 2010-2014, Opersys inc. These slides created by: Karim Yaghmour Originals at: www.opersys.com/community/docs Delivered and/or customized by
  • 3. 3 About ● Author of: ● Introduced Linux Trace Toolkit in 1999 ● Originated Adeos and relayfs (kernel/relay.c) ● Training, Custom Dev, Consulting, ...
  • 4. 4 Android Security, From the Ground Up 1. Goals and Features 2. Layers involved 3. CPU 4. Bootloader 5. Kernel 6. Native user-space 7. Framework 8. Updates 9. AppOpps 10.. Bottom line
  • 5. 5 1. Goals and Features ● Goals: ● Protect user data ● Protect system resources (including the network) ● Provide application isolation ● Key Features: ● Robust security at the OS level through the Linux kernel ● Mandatory application sandbox for all applications ● Secure interprocess communication ● Application signing ● Application-defined and user-granted permissions
  • 7. 7
  • 8. 8
  • 9. 9
  • 10. 10
  • 11. 11 3. CPU ● Paging ● Memory segmentation ● Privileged instructions ● Security: ● Secure boot ● Crypto acceleration (ARM v8) ● TrustZone
  • 12. 12 4. Bootloader ● Locked vs. unlocked ● Signed vs. unsigned images ● Very bootloader dependent
  • 13. 13 5. Kernel ● Process isolation ● UID/GID ● Capabilities ● SELinux ● Misc. additions and features
  • 14. 14 5.1. Process isolation ● Each process gets its own address space ● Processes can't see each others' memory ● Processes can't access the kernel's memory ● MUST use system calls to talk to kernel
  • 15. 15 5.2. UID/GID ● Each process has a UID / GID ● Privileges granted to processes sharing UIDs and GIDs ● Filesystem access ● Signals ● Tracing ● etc.
  • 16. 16 5.3. Capabilities ● Root has a lot of power ● Sometimes only part of root privileged needed ● Use “man capabilities” to find out more ● Used by installd to drop out of root and keep privileges.
  • 17. 17 5.4. SELinux ● Linux has Discretionary Access Controls (DAC) by default. ● SELinux adds Mandatory Access Controls (MAC). ● Requires all process operations to be explicitly mapped out. ● Unlisted operations are forbidden, even if you're root. ● Provides safe firewalling in case of privilege escalation.
  • 18. 18 5.5. Misc. additions and features ● Paranoid networking ● CONFIG_STRICT_MEMORY_RWX ● ...
  • 19. 19 6. Native user-space ● Filesystem partitions ● init.rc permission settings ● /dev/* ● /dev/socket/* ● Native daemons ● installd
  • 20. 20 6.1. Filesystem partitions ● Each partition has different mount options ● RAM disk => Read-Only ● System image => Read-Only (unless update) ● Data image => Read-Write (specific user permissions needed) ● Cache => Read-Write ● Recovery => Not mounted by default ● Virtual filesystems (proc, sysfs, etc.) ● “sdcard” => Read-Write (world readable/writable) ● Directories and files have specific rights, see system/core/include/private/android_filesystem_config.h
  • 21. 21 6.2. init.rc permission settings ● mount ● mkdir ● chown ● chmod
  • 22. 22 6.3. /dev/* ● All devices accessed through device nodes ● Devices nodes have regular file permissions ● Entries created by ueventd ● App do NOT have access to most entries
  • 23. 23 6.4. /dev/socket/* ● Unix domain sockets used native daemons and services: srw­rw­­­­ system   system            2014­07­24 18:45 adbd srw­rw­­­­ root     inet              2014­07­24 18:45 dnsproxyd srw­­­­­­­ system   system            2014­07­24 18:45 installd srw­rw­­­­ root     system            2014­07­24 18:45 mdns srw­rw­­­­ root     system            2014­07­24 18:45 netd srw­rw­rw­ root     root              2014­07­24 18:45 property_service srw­rw­rw­ root     root              2014­07­24 18:45 qemud srw­rw­­­­ root     radio             2014­07­24 18:45 rild srw­rw­­­­ radio    system            2014­07­24 18:45 rild­debug srw­rw­­­­ root     mount             2014­07­24 18:45 vold srw­rw­­­­ root     system            2014­07­24 18:45 zygote
  • 24. 24 6.5. Native daemons ● Some native daemons authenticate the requests they get: ● sevicemanager ● init property service ● Some daemons shadow key system services: ● vold ● netd ● rild ● keystore
  • 25. 25 6.6. installd ● Package Manager's “shadow” ● Starts as root ● Notifies kernel that it will drop out of root but wants to keep capabilities. ● Changes UID to “install” user ● Sets caps kept as: ● DAC_OVERRIDE ● CHOWN ● SETUID ● SETGID
  • 26. 26 7. Framework ● Framework permissions ● App signatures ● Multi-human support ● Device administration ● SEAndroid
  • 27. 27 7.1. Framework permissions ● Since apps can't access /dev/* entries, they must talk to system services through Binder. ● Binder doesn't enforce security ● System services check for permissions on a call-by-call basis. ● Package Manager is solicited to check permissions. ● Ex: checkCallingOrSelfPermission()
  • 28. 28 7.2. App signatures ● Apps must be signed by publisher ● Publishers are NOT authenticated ● There is NO certificate authority in this model ● Based on Java “keytool”
  • 29. 29 7.3. Multi-human support ● Each user gets a region of UIDs ● Each gets entries in: ● /data/user – Per-app data directories ● /data/system/users – Per-user accounts DB
  • 30. 30 7.4. Device administration ● API for BYOD ● Very limited ● Only good for password-strength enforcement ● Does not provide: ● Provisioning of apps ● Bulk configuration
  • 31. 31 7.5. SEAndroid ● Mandatory access controls for Android ● Enforcing/non-enforcing: setenforce ● Not merged: ● Middle-ware MAC
  • 32. 32 8. Updates ● OTA certs: ● platform: Phone, SystemUI, framework, etc. ● shared: Launcher2, Contacts, LatinIME, etc. ● media: Gallery, MediaProvider, etc. ● testkey: default key ● Default keys in: build/target/product/security ● Use of development/tools/make_key to generate new keys.
  • 33. 33 9. AppOps ● AppOps system service ● Introduced and the removed ● frameworks/base/core/java/com/android/interna l/app/IAppOppsService.aidl ● packages/apps/Settings/AndroidManifest.xml
  • 34. 34 10. Bottom line ● Strong built-in mechanisms ● but ... ● Dude, where's my “sudo apt-get update” / “sudo apt-get upgrade”? ● No updates = No security
  • 35. 35 References and Pointers ● http://source.android.com/devices/tech/security/ index.html ● http://seandroid.bitbucket.org