Mobile Systems and Smartphone Security�(MOBISEC 2020)
Prof: Yanick Fratantonio�EURECOM
1
Advanced Topics on Android System & Security
Today
2
Android Framework Architecture (reloaded)
3
Image from https://source.android.com/security
Android Framework Architecture (reloaded)
4
Image from https://source.android.com/security
App B
App A
Apps are sandboxed
Communication happens via well-defined interfaces exposed by the OS
Security checks
Security checks
Android Framework Architecture (reloaded)
5
Image from https://source.android.com/security
App B
App A
Instrumentation & analysis at these abstraction levels can be bypassed!
Pros: Syscall analysis CANNOT be bypassed
Cons: bridging the semantics gap is complicated [1]
Building blocks for security
6
Google Security Services
7
Google Security Services
8
Google Security Services
9
Google Security Services
10
Project Treble
11
Project Treble
12
Project Treble
13
Google Security Services
14
Google Security Services
15
Google Security Services
16
Kernel Security & SELinux
17
Linux Security
18
Linux's guarantees
19
The Application Sandbox
20
Defense in Depth
21
DAC vs MAC
22
SELinux
23
SELinux
24
SELinux in Android 5.0
25
SELinux in Android 6.0
26
SELinux in Android 7.0
27
SELinux in Android 8.0
28
SELinux in Android 9.0
29
SELinux in Android X.Y?
30
Boot and Verified Boot
31
The boot process and Verified Boot
32
Boot ROM
Secondary Boot Loader (SBL)
Android Boot Loader
(aboot)
ROM: Read-Only Memory
Linux Kernel
Initramfs,�Android framework
Can be upgraded
It cryptographically verifies aboot via key stored in ROM
Root of the chain of trust!
It can be unlocked!
It cryptographically verifies SBL via key stored in ROM
Root of the chain of trust!
The boot process and Verified Boot
33
fastboot
34
Example: How to unlock Pixel 3's bootloader
35
Additional security mechanisms
36
Additional security mechanisms
37
Device State
38
dm-verity (doc)
39
Image from here
Rollback Protection
40
Flash new image
41
flash-all.sh
$ cat flash-all.sh
fastboot flash bootloader bootloader-bullhead-bhz10m.img
fastboot reboot-bootloader
sleep 5
fastboot flash radio radio-bullhead-m8994f-2.6.31.1.09.img
fastboot reboot-bootloader
sleep 5
fastboot -w update image-bullhead-mhc19q.zip
42
image-bullhead-mhc19q.zip
$ unzip -l image-bullhead-mhc19q.zip
Length Date Time Name
--------- ---------- ----- ----
101 2009-01-01 00:00 android-info.txt
2005102896 2009-01-01 00:00 system.img
11793638 2009-01-01 00:00 boot.img
195274360 2009-01-01 00:00 vendor.img
12870890 2009-01-01 00:00 recovery.img
5824660 2009-01-01 00:00 cache.img
139966976 2009-01-01 00:00 userdata.img
--------- -------
2370833521 7 files
43
Many partitions
44
Recovery mode
45
TWRP
46
Protection of System Partition
47
Safe Mode
48
What if there are bugs?
49
Boot ROM
Secondary Boot Loader (SBL)
Android Boot Loader
(aboot)
ROM: Read-Only Memory
Linux Kernel
Initramfs,�Android framework
Can be upgraded
It cryptographically verifies aboot via key stored in ROM
Root of the chain of trust!
It can be unlocked!
It cryptographically verifies SBL via key stored in ROM
Root of the chain of trust!
unpatchable checkm8 exploit for iOS bootrom!
Data Encryption
50
Data encryption (doc)
51
Data encryption (doc)
52
Metadata Encryption
53
Direct Boot (doc)
54
Device Admin and Work Profiles
55
Device Admin Apps
56
Work profile
57
TrustZone
58
ARM TrustZone
59
ARM TrustZone
60
Image from ARM
ARM TrustZone
61
User space
Kernel space
Non-Secure World
Secure World
Untrusted Apps (UA)
(System apps, 3rd-party apps)
Untrusted OS�(Linux, Android OS)
Trusted OS
Trusted Apps (TA)
Secure even if the Linux/Android OS is compromised!!!
Library API
Driver Interface (ioctl)
TEE Interface
Unlocking phones with your nose
62
BSides DC 2018 - Nick `mike_pizza` Stevens - Bypassing Huawei's Fingerprint Authentication by Exploiting the TrustZone (Nose Injection Exploit @ 46.44)
Verified Boot (reloaded)
63
Image from BootStomp, USENIX Security 2017 (link)