Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Android Security Features
Search
Dave Smith
November 09, 2016
Programming
4
620
Android Security Features
Overview of the core platform elements that make up the Android security model for applications.
Dave Smith
November 09, 2016
Tweet
Share
More Decks by Dave Smith
See All by Dave Smith
ConstraintLayout, Inside and Out
devunwired
21
1.6k
Digging Into Android System Services
devunwired
8
1.4k
Flattening Layouts with Constraints
devunwired
3
260
Hello, Brillo: ELC Edition
devunwired
0
240
Mastering CoordinatorLayout Behaviors
devunwired
16
1.3k
Hello, Brillo
devunwired
1
2k
Google Proximity Beacons Overview
devunwired
4
220
Proximity Beacons and the Nearby API
devunwired
1
1.8k
Getting Your Act Together with CoordinatorLayout
devunwired
7
460
Other Decks in Programming
See All in Programming
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
23
11k
のびしろを広げる巻き込まれ力:偶然を活かすキャリアの作り方/oso2024
takahashiikki
1
410
カラム追加で増えるActiveRecordのメモリサイズ イメージできますか?
asayamakk
4
1.5k
Googleのテストサイズを活用したテスト環境の構築
toms74209200
0
270
/←このスケジュール表に立ち向かう フロントエンド開発戦略 / A front-end development strategy to tackle a single-slash schedule.
nrslib
1
590
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
240
Java ジェネリクス入門 2024
nagise
0
600
Golang と Erlang
taiyow
8
1.9k
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1k
Nuxtベースの「WXT」でChrome拡張を作成する | Vue Fes 2024 ランチセッション
moshi1121
1
510
Pinia Colada が実現するスマートな非同期処理
naokihaba
2
160
go.mod、DockerfileやCI設定に分散しがちなGoのバージョンをまとめて管理する / Go Connect #3
arthur1
10
2.4k
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Faster Mobile Websites
deanohume
304
30k
Docker and Python
trallard
40
3.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
41
2.1k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
4 Signs Your Business is Dying
shpigford
180
21k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Designing for Performance
lara
604
68k
Music & Morning Musume
bryan
46
6.1k
Transcript
Android Security Features Dave Smith, PE @devunwired
App Code Sandbox Encryption Permissions
App Code
App Manifest Compiled Code Resources Signature Info Application Package (APK)
App Manifest Compiled Code Resources Signature Info Application Package (APK)
Authenticate Developer Identity Prevent APK Tampering
JAR Signer Hash Files Hash Hashes Sign w/ Private Key
APK Signature
JAR Signer APK Signature Hash Files Hash Hashes Sign w/
Private Key Hash 1MB Chunks Sign w/ Private Key Hash Hashes
Sandbox
Application Sandbox Process Isolation Unique App UID SELinux Domains
# ps USER PID PPID ... NAME ... system 1723
1240 ... com.android.settings u0_a10 1803 1240 ... android.ext.services u0_a32 1824 1240 ... com.android.deskclock u0_a1 1896 1240 ... android.process.acore u0_a55 1914 1240 ... com.android.printspooler u0_a13 1942 1240 ... com.android.launcher3 system 1974 1240 ... com.android.keychain u0_a8 2000 1240 ... android.process.media u0_a26 2064 1240 ... com.android.calendar u0_a66 2096 1240 ... com.android.quicksearchbox u0_a67 2123 1240 ... com.android.messaging u0_a6 2189 1240 ... com.android.dialer u0_a35 2209 1240 ... com.android.email u0_a65 2229 1240 ... com.android.gallery3d
# ps USER PID PPID ... NAME ... system 1723
1240 ... com.android.settings u0_a10 1803 1240 ... android.ext.services u0_a32 1824 1240 ... com.android.deskclock u0_a1 1896 1240 ... android.process.acore u0_a55 1914 1240 ... com.android.printspooler u0_a13 1942 1240 ... com.android.launcher3 system 1974 1240 ... com.android.keychain u0_a8 2000 1240 ... android.process.media u0_a26 2064 1240 ... com.android.calendar u0_a66 2096 1240 ... com.android.quicksearchbox u0_a67 2123 1240 ... com.android.messaging u0_a6 2189 1240 ... com.android.dialer u0_a35 2209 1240 ... com.android.email u0_a65 2229 1240 ... com.android.gallery3d
# cd /data/data/com.android.launcher3 # ls -l total 24 drwxrwx--x 2
u0_a13 u0_a13 4096 2016-09-15 22:23 cache drwxrwx--x 2 u0_a13 u0_a13 4096 2016-09-15 22:23 databases drwxrwx--x 2 u0_a13 u0_a13 4096 2016-11-01 22:13 shared_prefs # cd /data/data/ # ls -l ... drwxr-x--x 6 u0_a6 u0_a6 4096 2016-09-15 22:23 com.android.dialer drwxr-x--x 6 u0_a35 u0_a35 4096 2016-09-15 22:23 com.android.email drwxr-x--x 5 u0_a13 u0_a13 4096 2016-09-15 22:23 com.android.launcher3
$ ps -Z LABEL USER ... NAME ... u:r:system_app:s0 system
... com.android.settings u:r:platform_app:s0:c512,c768 u0_a10 ... android.ext.services u:r:untrusted_app:s0:c512,c768 u0_a32 ... com.android.deskclock u:r:priv_app:s0:c512,c768 u0_a1 ... android.process.acore u:r:untrusted_app:s0:c512,c768 u0_a55 ... com.android.printspooler u:r:priv_app:s0:c512,c768 u0_a13 ... com.android.launcher3 u:r:system_app:s0 system ... com.android.keychain u:r:priv_app:s0:c512,c768 u0_a8 ... android.process.media u:r:untrusted_app:s0:c512,c768 u0_a26 ... com.android.calendar u:r:untrusted_app:s0:c512,c768 u0_a66 ... com.android.quicksearchbox u:r:platform_app:s0:c512,c768 u0_a67 ... com.android.messaging u:r:priv_app:s0:c512,c768 u0_a6 ... com.android.dialer u:r:untrusted_app:s0:c512,c768 u0_a35 ... com.android.email u:r:untrusted_app:s0:c512,c768 u0_a65 ... com.android.gallery3d
Data Encryption + Verified Boot
Disk Encryption Encrypts All Writable Data No Passcode Required /data
dm-crypt Android
Verified Boot Halt Boot on Error Protect Runtime Reads /system
dm-verity Android Hash System Blocks
Permissions
<manifest package="com.android.browser"> … <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> …
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> ... <permission android:name="android.permission.INTERNET" android:description="@string/permdesc_createNetworkSockets" android:label="@string/permlab_createNetworkSockets" android:protectionLevel="normal"
/> ... <permission android:name="android.permission.ACCESS_FINE_LOCATION" android:permissionGroup="android.permission-group.LOCATION" android:label="@string/permlab_accessFineLocation" android:description="@string/permdesc_accessFineLocation" android:protectionLevel="dangerous" /> ... </manifest> frameworks/base/core/res/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"> ... <permission android:name="android.permission.INTERNET" android:description="@string/permdesc_createNetworkSockets" android:label="@string/permlab_createNetworkSockets" android:protectionLevel="normal"
/> ... <permission android:name="android.permission.ACCESS_FINE_LOCATION" android:permissionGroup="android.permission-group.LOCATION" android:label="@string/permlab_accessFineLocation" android:description="@string/permdesc_accessFineLocation" android:protectionLevel="dangerous" /> ... </manifest> frameworks/base/core/res/AndroidManifest.xml
Permissions Enforcement Kernel Groups Binder IPC
<permissions> … <permission name="android.permission.INTERNET" > <group gid="inet" /> </permission> …
</permissions> … #define AID_INET 3003 /* can create AF_INET and AF_INET6 sockets */ … static const struct android_id_info android_ids[] = { … { "inet", AID_INET, }, … }; … frameworks/base/data/etc/platform.xml system/core/include/private/android_filesystem_config.h
# ps | grep browser u0_a17 2276 1212 ... com.android.browser
# cat /proc/2276/status Name: android.browser State: S (sleeping) Tgid: 2276 Pid: 2276 PPid: 1212 TracerPid: 0 Uid: 10017 10017 10017 10017 Gid: 10017 10017 10017 10017 FDSize: 256 Groups: 3003 9997 50017 ...
Application System Server Manager Service Binder IPC
Application System Server Manager Service Binder IPC Binder.getCallingUid() Binder.getCallingPid()
Vibrator vib = (Vibrator) getSystemService(VIBRATOR_SERVICE); vib.vibrate(500); public class VibratorService extends
IVibratorService.Stub { … public void vibrate(int uid, String packageName, long milliseconds, IBinder token) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.VIBRATE) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Requires VIBRATE permission"); } … } … }
public class VibratorService extends IVibratorService.Stub { … public void vibrate(int
uid, String packageName, long milliseconds, IBinder token) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.VIBRATE) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Requires VIBRATE permission"); } … } … } Vibrator vib = (Vibrator) getSystemService(VIBRATOR_SERVICE); vib.vibrate(500);
Protect code integrity Prohibit unauthorized access Preserve data integrity Provide
user control
@devunwired +DaveSmithDev milehighandroid.com wiresareobsolete.com