23
DroidCap: OS Support for Capability-based Permissions in Android Abdallah Dawoud and Sven Bugiel

DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

DroidCap: OS Support for Capability-based Permissions in Android

Abdallah Dawoud and Sven Bugiel

Page 2: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

2

Android App Components

Broadcast Receiver

Content Provider

ActivityService

Application (UID=A)

Page 3: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

3

Problem: App UID as Ambient Authority

Application (UID=A)

Broadcast Receiver

Content Provider

ActivityService

Device Location

Internet

Icons made by Smashicons, mavadee, Chanut, Dave Gandy from www.flaticon.com is licensed by CC 3.0 BY

Another app, the Internet, etc.

Location Internet

Broadcast Receiver

Content Provider

Activity (ad library)

Service (vulnerable

code)

Page 4: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

Application (UID=A)

Broadcast Receiver

Content Provider

Activity (ad library)

Service (vulnerable

code)

Location Internet

4

App Compartmentalization & Privilege Separation

▪ Inlined reference monitor

▪ But: protected by weak security boundary

Internet

Page 5: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

5

App Compartmentalization & Privilege Separation

▪ Inlined reference monitor

▪ But: protected by weak security boundary

▪ Separate app with distinct UID

▪ But: multiple apps installed

▪ (…)

Application (UID=B)

Application (UID=A)

Broadcast Receiver

Content Provider

Activity (ad library)

Service (vulnerable

code)

Location Internet

Internet

Page 6: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

6

Application (UID=A)

Broadcast Receiver

Content Provider

Activity (ad library)

Service (vulnerable

code)Our idea: Represent permissions as

object capabilities

PID:2

PID:1

Location

Internet

Page 7: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

7

Object Capabilities

- Per-Process

- Communicable

Access Rights

Object Reference

- Unforgeable

- Tamper-proof

File Descriptor (read only)

Example file access:

Page 8: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

8

How to represent Android permissions as object capabilities?

Page 9: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

Location

9

Calling Services and Permission Enforcement

process 1

Application (UID=A)SystemServer (UID=B)

...

Virtual File System

Binder IPCGPS

PackageService

LocationService

Permission Enforcement

UID=A

xUID: A <Location>

kern

elus

ersp

ace

Application process needs a reference to the SystemService process to call via Binder IPC!

Page 10: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

10

Binder Services: Registration, Discovery, and Invocation

Binder Driver

service_manager system_server

binder_proc(service_manager) binder_proc(system_server)

binder object

Service<h1, “location”>

user

spac

eke

rnel

register(“location”, obj)register(“location”, h1)

h1binder_node

binder_ref*binder_object

binder_node

Page 11: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

12

Binder Services: Registration, Discovery, and Invocation

Binder Driver

service_manager system_serverClientbinder object

binder_proc(service_manager) binder_proc(system_server)binder_proc(client)

h1binder_node

*binder_object

proxy object

user

spac

eke

rnel

binder_node

find(“location”) find(“location”) dup(h1)

h1binder_node

binder_ref

h1”binder_node

h1”h1”

<h1, “location”>Serviceh1”

Page 12: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

12

Binder Services: Registration, Discovery, and Invocation

Binder Driver

service_manager system_serverClientbinder object

binder_proc(service_manager) binder_proc(system_server)binder_proc(client)

h1binder_node

*binder_object

proxy object

user

spac

eke

rnel

binder_node

find(“location”) find(“location”) dup(h1)

h1binder_node

binder_ref

h1”binder_node

h1”h1”

<h1, “location”>Serviceh1”

Access Rights

Object Reference

- Unforgeable

- Tamper-proof

- Per-Process

- Communicable

Page 13: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

13Binder Driver

system_serverClientbinder objectproxy object

binder_proc(system_server)binder_proc(client)

Service

*binder_object

h1”Target=h1” method=… params=…

user

spac

eke

rnel

binder_node

h1”binder_node

binder_ref

proxy.transact(*data)

Binder Services: Registration, Discovery, and Invocation

Page 14: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

13Binder Driver

system_serverClientbinder objectproxy object

binder_proc(system_server)binder_proc(client)

Service

*binder_object

h1”

user

spac

eke

rnel

binder_node

h1”binder_node

binder_ref

proxy.transact(*data) stub.onTransact(*data)

getCallingUID()

Binder Services: Registration, Discovery, and Invocation

Target=h1” method=… params=…

callingUid=…

Page 15: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

14Binder Driver

system_serverClientbinder objectproxy object

binder_proc(system_server)binder_proc(client)

Service

*binder_object

h1”

user

spac

eke

rnel

binder_node

h1”binder_node

binder_ref

proxy.transact(*data) stub.onTransact(*data)

getCallingUID()

Binder Services: Registration, Discovery, and Invocation

Target=h1” method=… params=…

callingUid=…Access Rights

Object Reference

- Unforgeable

- Tamper-proof

- Per-Process

- Communicable

Page 16: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

15

Binder Capability

▪ Binder capability: combination of Binder reference and capability fields

▪ Access rights define the permissions of the capability holder towards the referenced Binder object in binder_node

▪ Flags and attributes to govern re-delegation and revocation of Binder capabilities

access_rights (int)

handle_value

access_rights

binder_node

Page 17: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

16Binder Driver

service_manager system_serverClientbinder object

binder_proc(service_manager) binder_proc(system_server)binder_proc(client)

h1binder_node

*binder_object

user

spac

eke

rnel binder_ref

Permissions

dup(h1, access_rights=R)

h1binder_node

binder_ref

<h1, “location”>

DroidCap: Discovery and Invocation

Service

h1

binder_node…

access_rights=<?>

binder_ref

h1

binder_node…

access_rights=<?>

binder_ref

proxy object

h1”

h1”

binder_node…

access_rights=R

binder_ref

Page 18: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

17Binder Driver

system_serverClientbinder object

binder_proc(system_server)binder_proc(client)

*binder_object

user

spac

eke

rnel

DroidCap: Discovery and Invocation

Service

proxy object

h1”h1”

binder_node…

access_rights=R

binder_ref

h1”

proxy.transact(*payload) stub.onTransact(*payload)

getCallingRights()

Target=h1” method=… payload=…

access_rights=R

Page 19: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

18Binder Driver

system_serverClientbinder object

binder_proc(system_server)binder_proc(client)

*binder_object

user

spac

eke

rnel

DroidCap: Discovery and Invocation

Service

proxy object

h1”h1”

binder_node…

access_rights=R

binder_ref

h1”

proxy.transact(*payload) stub.onTransact(*payload)

getCallingRights()

Target=h1” method=… payload=…

Target=h1” method=… payload=…

access_rights=R

- Per-Process

- Communicable

Access Rights

Object Reference

- Unforgeable

- Tamper-proof

Binder Capability ≈ Object Capability

- Per-Process

- Communicable

Page 20: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

19

How efficient are Binder capabilities?

Page 21: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

20

Performance

▪ Android 9, 8, 7.1, and 7.2 ; Kernel 3.4, 3.9, and 4.1

▪ HiKey960 device: octa-core 1.8 GHz Cortex-A53 CPU and 3 GB RAM

▪ Microbenchmarks:

Stock Android DroidCap

Binder transaction 34,679 cycles36,231 cycles

(3.41% weighted overhead)

Permission Check 226.40µs (via IPC) 77.02µs (local)

10.99µs (x7–20 faster)

Page 22: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

21

Compartmentalizing an App

▪ Retrofitted open-source Kontalk app to use Binder Capabilities

- 37 components and 30+ third-party libraries

- 24 permissions (11 dangerous permissions + Internet)

▪ Results:

‣ 17 Components need no permission

‣ 20 components need 1-8 permissions, each.

‣ Restricted third-party libraries(e.g., TrueTime has no permissions, BarcodeScanner limited to Camera and Internet)

Page 23: DroidCap: OS Support for Capability-based Permissions in ......in Android Abdallah Dawoud and Sven Bugiel. 2 Android App Components Broadcast Receiver Content Provider Service Activity

22

Summary

Thank you! Questio

ns?