DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps...

Post on 05-Oct-2020

1 views 0 download

Transcript of DefDroid: Towards a More Defensive Mobile OS Against ...huang/talk/defdroid_talk.pdf · Mobile apps...

DefDroid: Towards a More Defensive Mobile OS Against Disruptive App Behavior

Peng (Ryan) Huang, Tianyin Xu, Xinxin Jin, Yuanyuan Zhou

UC San Diego

http://defdroid.org

Growing number of (novice) app developers

2

Mobile apps often less mature

3

Platform Avg.age %ofappsbyindividualdevelopers

AppStore 2.5years >12%

GooglePlay 1.5years >5%

Application History

MySQL 19years

Firefox 12years

Chrome 7years

Top 1,000 mobile apps Popular desktop applications

Rise of disruptive app behavior (DAB)App acts in a way that hurts the

ecosystem and other apps

4

Rise of disruptive app behavior (DAB)App acts in a way that hurts the

ecosystem and other apps

4

Battery drain

Rise of disruptive app behavior (DAB)App acts in a way that hurts the

ecosystem and other apps

4

Excessive storageBattery drain

Rise of disruptive app behavior (DAB)App acts in a way that hurts the

ecosystem and other apps

4

Excessive storage

Data hog

Battery drain

Rise of disruptive app behavior (DAB)App acts in a way that hurts the

ecosystem and other apps

4

Excessive storage

Data hogNoisy notifications

Battery drain

Our main contributions» A characteristics study on disruptive app behavior problem

» An OS-level solution to curb disruptive apps at runtime

5

Talk outline» Background

» Understand disruptive app behavior

» DefDroid: curb disruptive app behavior at runtime

6

Data collection

7

open-source project issue trackers

user forums

9,000+ initial cases

app issue complaints

crash, ANR,feature bug 287 DAB cases

182 unique apps

8

Example of disruptive app behavior

App Version Disruptivebehavior

ownCloud 1.5.4 Syncwithservertoooftenandrequestalotofinfo,batterydrain,datahog

WHERE 3.2.1 ContinuouslyuseGPSonstandby,drainingbattery

F-Droid 0.72 Create“infinite”copiesofXMLfilesduetoabug,eatingupstorage

DAVDroid 0.6 Synclotsofhighresolutioncontactpictures,datahog

Facebook 40.0 CPUspininnetworkhandling,leakingaudiosession,drainingbattery

Chrome 28.0 OveruseGyroscopesensorinbackground,drainingbattery

8

Example of disruptive app behavior

App Version Disruptivebehavior

ownCloud 1.5.4 Syncwithservertoooftenandrequestalotofinfo,batterydrain,datahog

WHERE 3.2.1 ContinuouslyuseGPSonstandby,drainingbattery

F-Droid 0.72 Create“infinite”copiesofXMLfilesduetoabug,eatingupstorage

DAVDroid 0.6 Synclotsofhighresolutioncontactpictures,datahog

Facebook 40.0 CPUspininnetworkhandling,leakingaudiosession,drainingbattery

Chrome 28.0 OveruseGyroscopesensorinbackground,drainingbattery

Even expert developers can make mistakes

9

Users often still need to use the apps

This issue makes this program less acceptable to me than Sipdroid. Otherwise, I am happy with the UI and satisfied with stability

-- user comment on a severe battery drain issue in CSipSimple

4.1 out of 5 rating for apps with disruptive behavior in our study

10

Root causes of DAB are diverse

Refresh widget every 2.5 seconds. Severe battery drain!

10

Root causes of DAB are diverse

Refresh widget every 2.5 seconds. Severe battery drain!

When users are in environment with poor GPS-signal, it will keep searching for GPS signal!

BetterWeather

Other findings» Common patterns» Triggering conditions» Fix strategy and time

11

How to deal with disruptive app behavior?

User» difficult to diagnose» difficult to fix

Developer» difficult to ship always-friendly code

OS

12

?

Ordinary

Inexperienced

Talk outline» Background

» Understand disruptive app behavior

» DefDroid: curb disruptive app behavior at runtime

13

DefDroidGoal» making OS defensive to react to common disruptive app behavior» protect end users from bad experiences

Main challenges» handle a diverse set of disruptive behavior» preserve app main functionality» control overhead

14

Key idea of DefDroid» Monitor important app interactions with OS

15

Resource usage

App internal

OS

API request

Key idea of DefDroid» Monitor important app interactions with OS» Define disruptive behavior using profiling + user complaints

15

CD

F

0

0.25

0.5

0.75

1

Wakelock session duration (ms)1 100 10000 1000000

99th percentile: 12.2s Max: 15.8min

Key idea of DefDroid» Monitor important app interactions with OS» Define disruptive behavior using profiling + user complaints» Apply defensive actions at request granularity

15

Key idea of DefDroid» Monitor important app interactions with OS» Define disruptive behavior using profiling + user complaints» Apply defensive actions at request granularity! enforce exponential back-off! release long-held resource! reduce aggressive update frequency! decrease scheduling priority

15

Extensible defense modules

16

LocationService

NetworkSubsystem

App

Extensible defense modules

16

Micro Monitor Micro Monitor

LocationService

NetworkSubsystem

Defense Module Defense Module

App

…DefDroid

Extensible defense modules

16

Micro Monitor Micro Monitor

LocationService

NetworkSubsystem

Macro Monitor

Controller

Defense Module Defense Module

App

…DefDroid

Avoid being over-defensive

17

Foreground app user currently

interacting with

Immune

Avoid being over-defensive

17

Foreground app user currently

interacting with

Immune

Criteria of disruptive behavior

Conservative

Avoid being over-defensive

17

Foreground app user currently

interacting with

Immune

Criteria of disruptive behavior

Conservative

Length of DefDroid actions

Temporary

Avoid being over-defensive

17

Foreground app user currently

interacting with

Immune

Criteria of disruptive behavior

Conservative

Length of DefDroid actions

Temporary

User interfaces

Informative

DefDroid implementationBuilt on Android 4.4» ported to 5.1» support both AOSP and CM releases

Implemented 11 defense modules» location, wakelock, sensor, alarm, network, etc.

18

Evaluation» How effective is DefDroid in handling real-world DAB?» What is the impact to app usability?» How DefDroid performs in the field?» What is the overhead of DefDroid?

19

Experimental setupDevices» Motorola G, Google Nexus 4

Dataset» 96 real-world DAB cases reproduced from our study» 32 new real-world DAB cases we later collected

20

21

Overall result

Total Reacted96 94

Total Reacted32 31

Studied DAB cases New DAB cases

Reacted means DefDroid took some actions that lead to positive effect (e.g., reduction in power consumption)

22

Resource consumption reduction

ResourceReduction

Min Median Max

Energy 130J,6% 340J,21% 866J,87%Cellulardata 17MB,15% 54MB,34% 183MB,86%Storage 30MB,25% 48MB,37% 145MB,90%

30 Minute Experiment Session

Large-scale deployment to PhoneLab» 185 users using Google Nexus 5 running DefDroid» 43 days from 2015/09/21 to 2015/11/3» Took actions on 81 apps in 105 of participants» Reproduced 57 cases» No user complaints about DefDroid breaking app usability

23

http://phone-lab.org

Disruptive behavior found in the field

App Disruptivebehavior

cClock ConstantGPSsearchTheEconomist KeepdisplayonafteruseTWCWiFiFinder Keep(dis)connectingNYTimes ExcessivesensorrequestsSinaNews Long-heldGPSXiami ExcessivewakelockrequestsKik Frequentwake-upphoneZillow Excessivetoasts(notifications)

24

Disruptive behavior found in the field

App Disruptivebehavior

cClock ConstantGPSsearchTheEconomist KeepdisplayonafteruseTWCWiFiFinder Keep(dis)connectingNYTimes ExcessivesensorrequestsSinaNews Long-heldGPSXiami ExcessivewakelockrequestsKik Frequentwake-upphoneZillow Excessivetoasts(notifications)

24

“Biggest issue is the battery drain. This app keeps checking for (hardly) available TWC hotspots, even though I'm already connected to a strong (home/work) wifi. The battery drained from 100% to 15% in 1 to 2 hours.”

Overhead

25

CPUload Memory PowerAndroid 37.5% 1721.9MB 1688.4mWDefDroid 39.2% 1749.8MB 1719.8mW

Overhead 1.7±0.3% 27.9±0.9MB 31.4±7.4mW

Conclusion

26

Disruptive app behavior widely exists in the field, frustrating users

» Problem

» Study Characteristics of 287 real-world issues of disruptive apps

» Solution DefDroid: system-level approach to curb disruptive apps at runtime

» Evaluation real-world cases, deployed to 185 users, found new issues

http://defdroid.org

Limitations» Different DefDroid modules are implemented separately» May overrule user configurations for an app» Policies of defense mechanisms are static» New unknown DAB patterns

27

Mobile apps often less mature

28

Platform Avg.age %ofappsbyindividualdevelopers

AppStore 2.5years >12%

GooglePlay 1.5years >5%

Application History

MySQL 19years

Firefox 12years

Chrome 7years

Top 1,000 mobile apps Popular desktop applications

MonitorsSystem-level conditions» battery, storage usage, network condition, etc.

App-level activities» important API calls, stats, tokens, etc.

29

caller stats token params

uid/package APIcalltime,frequency

PendingIntent,IBinder,.. flags,tags

To identify potential misbehavior For use by defensive actions

30

Defensive actions

Actiontype Example

Release releaselong-heldwakelock,GPS

Slowdown enlargealarminterval,reducesensorfrequency

Delay delayexcessivecellularnetworkrequests

Approximate usecoarse-grainedlocation

Downgrade switchtopassiveGPSprovider

Deprioritize decreaseschedulingpriority

Block rejectfrequentalarmrequestsforawhile

Warn warnaboutlargedataconsumption

Kill killnaughtyappprocessesorservices

Example run of a disruptive app

32

Common patterns of disruptive app behaviorPattern Cases

Wakelockleakoroveruse 25

GPSleakoroveruse 19

Sensorleakoroveruse 12

Otherresourceleakoroveruse 15

Frequentwake-upalarms 12

Frequentbroadcasts,receivers 6

Aggressivesensor/GPSupdates 15

Frequentconnection,aggressiveretry 44

Excessivecellulardatatransfer 42

Excessivestorageuse 33

HighCPUusage 31

Excessiveorstucknotifications 33

33

Time to fix for closed DAB issues

34

Impact to app execution

Impact cases

Noimpact 40Deferredexecution 49Failedrequests 31Checkedexceptions 5Termination 0