happy may the 4 !!!!1! - university of...

36
Happy May the 4 th !!!!1!

Upload: vodiep

Post on 30-May-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

HappyMaythe4th!!!!1!

Page 2: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

AndroidSecurity

CS642

DrewDavidson

SomeSlidestakenfromJohnMitchell

Page 3: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

LectureRoadmap

• WhatisAndroid?– History

– Design

• Exploits– SystemDefenses

• OtherAttacks– Threats

– Defenses

Page 4: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

WhatisAndroid?

• Alotofthingstodifferentpeople– ThefabledgPhone

• InvitescomparisontotheiPhone

– Aninternetofthings(IoT)platform– Anoperatingsystemforyourcar?

• Toobigtoexplaininthislecture– We’llintroducesomesecurityfeaturesasneeded

– Moretolearn

Page 5: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

(Ancient)HistoryofAndroid

• 2003:AndyRubincofoundsAndroidInctobuildaweb-connectedsmartphone

• 2005:GoogleacquiresAndroidInc

• 2007:iPhoneGenIreleased

• 2008:HTCDream(G1)released

Page 6: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

AndroidDesign

• MorethananOperatingSystem– AspecializedLinuxdistro,atthelowestlevel

– AframeworkforrunningAndroid“apps”

– Anentireecosystemforsmartphoneusers

} AndroidOpenSourceProject

} AppsAppStore(GooglePlay)DevelopmenttoolsClosed-SourceComponents

Page 7: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

FromGoogletoYou

Google OEM

ServiceProvider

Users

Page 8: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

AndroidExploits

Page 9: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

WhatisanAndroidExploit?

• Workingdefinition:AnactionthatoccursincontraventionofthesecuritymodelofanArchitecture

• Examples:– PrivilegeEscalation:Usercoderunsasroot

– DataExfiltration:Appstealsanother’sdata

– DOS:Apprendersdeviceunusable

Page 10: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

Multi-LayeredArchitecture

Page 11: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

ApplicationDesign

• EachapprunswithinanindependentinstanceoftheDalvikVirtualMachine(DVM)– Appslargelyrunbytecode

– Eachapprunsasitsownuser,i.e.thereisaseparateUIDforeachapp

Page 12: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

AppDeployment

Page 13: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

Intra-ApplicationSecurity

• Signedcode– Preventsout-of-bandrewrites

• Java-styleSandboxprotections– Bytecodeverifierpreventsill-formedprograms– Runtimechecksagainstbufferoverflows,etc.– Couldusethesecuritymanagerforpolicies

• AndroidLifecycle,AppKiller– Systemmaypauseanapp– Systemmaykillanappwithtoomanyresources

Page 14: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

Inter-ApplicationSecurity

• OSlevelprotections– SeparateUIDsgiveappsdistinctprivileges

– Minimizesprivilegeescalation

• BinderIPC– Kernelmediatescommunicationbetweenapps

– Receivingappmustregisterforincomingmessages

Page 15: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

OSProtection

• ASLR– Makesitstatisticallyimpossible/improbabletoknowifyou’resmashingthestackeffectively

• Dlmalloc– Makesitmuchhardertospraytheheap

Page 16: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

GooglePlay(Store)

• Largestdistributionchannelforapps– Killswitch

– GoogleBouncer

– “Wisdom”ofthecrowds

Page 17: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

ExploitsStillHappen

• Confuseddeputy– Stagefright

• Dataexfiltration– Sensorside-channels

• Microphone,Gyroscope

– Appmisconfiguration• FacebookDebuglog

• DenialofService– Exceptionloops– Batterydrain

Page 18: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

OtherThreats

Page 19: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

ShadyCode

• Thepreviousdefinitionofexploitwassomewhatweak– Whathappenswhenthesecuritymodelisinsufficient?

• Enable“PIIattacks”– Broadly,attacksthatleverageyourpersonallyidentifiableinformation

Page 20: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

ShadyCodeDefenses

• AndroidPermissions– Install-timepermissions

Page 21: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

ShadyCodeDefenses

• AndroidPermissions– Runtime

– Update-Time

Page 22: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

Category Permission Description

YourAccounts AUTHENTICATE_ACCOUNTS Actasanaccountauthenticator

MANAGE_ACCOUNTS Manageaccountslist

USE_CREDENTIALS Useauthenticationcredentials

NetworkCommunication INTERNET FullInternetaccess

ACCESS_NETWORK_STATE Viewnetworkstate

YourPersonalInformation READ_CONTACTS Readcontactdata

WRITE_CONTACTS Writecontactdata

SystemTools WRITE_SETTINGS Modifyglobalsystemsettings

WRITE_SYNC_SETTINGS Writesyncsettings(e.g.Contactsync)

READ_SYNC_SETTINGS Readwhethersyncisenabled

READ_SYNC_STATS Readhistoryofsyncs

YourAccounts GET_ACCOUNTS Discoverknownaccounts

Extra/Custom WRITE_SECURE_SETTINGS Modifysecuresystemsettings

Page 23: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

What’stheProblemwithPermissions?

• Admittedly,astepupovertheDesktop– Arguably,tablestakesforsuchapersonaldevice

• “Permissionentanglement”– Youmaycontrolwhenapermissionisused,butnothow

• Permissionsareper-appthussharedwithlibraries

• Asinglepermissionmaybeusedinvariousways

• Compositeeffectofpermissionsexceedsum

Page 24: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

FixingShadyCode

• Fewereasyanswers– Oneperson’sprivacyviolationisanother’sfeature

• Location-awareadvertising?

Page 25: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

NowEnteringtheRealmofResearch

• Whatfollowsisadiscussionofresearchprototypes– Unlikeabove,thereareoccasionallyobviousreasonsNOTtodothesethings

Page 26: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

Dataflowanalysis

• Labeltheusesofpermissionsintheprogram– Sources:producesensitiveinformation

– Sinks:interactwithuntrustedentities

• We’dliketoknowhowtheseendpointsinteract

• Tools– FlowDroid

– Stamp

Page 27: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

ExampleEndpointpermissions

SinksSources• Accountdata• Audio• Calendar• Calllog• Camera• Contacts• DeviceId• Location• Photos(Geotags)• SDcarddata• SMS

• Internet(socket)

• SMS

• Email

• SystemLogs

• Webview/Browser

• FileSystem

• BroadcastMessage

Page 28: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

PossibleFlows

Sources Sinks

INTERNETREAD_CONTACTS

WRITE_SETTINGSREAD_SYNC_SETTINGS

WRITE_CONTACTSREAD_SYNC_STATS

GET_ACCOUNTS WRITE_SECURE_SETTINGS

WRITE_SETTINGSINTERNET

Page 29: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

ImplementingDataflowAnalysis

• Identifywhatmethodsusewhichpermissions– Nocanonicalmap!

• Identifywhatpermissionsactuallydo– Isitasource?Sink?BOTH?

• ViewtheprogramasaProgramDependenceGraph– Edgesrepresentflowsofcontrolordata

– Nodesrepresentabstractregionsofcode

– Requiresaprogramsemantics/abstraction

Page 30: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

DataflowAnalysisExample

FB API

Write Conta

cts

Send Internet

Source: FB_Data

Sink: Contact_Book

Sink: InternetRead Conta

ctsSource: Contacts

Page 31: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

LimitationsofDataflowAnalysis

• Technical– Over-approximate

– Requiresdeepknowledgeofthesystem• Impracticalwithoutsomemanualmodelling,atleastonAndroid

• Practical …ideas?

Page 32: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

(Dynamic)TaintTracking

• Notthemostmedia-savvyname

• Extendthesystemtorecordtheprovenanceofdata– Isittaintedbyaninputsource?

• Tools– TaintDroid

Page 33: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

LimitationsofDynamicTaintTracking

• Technicallimitations– Missescontroldependencies

• Practicallimitations– Slowsexecution

• Coulduseitsolelyasanofflineanalysis

Page 34: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

AppRewriting

• Changethebehavioroftheapp– Reverseengineerit

– Makesomechanges

– Recompileit

Page 35: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

DroidWeave

• Totheboard!

Page 36: Happy May the 4 !!!!1! - University of Wisconsin–Madisonpages.cs.wisc.edu/~ace/media/lectures/android.pdf · Lecture Roadmap • What is Android? – History – Design • Exploits

Conclusion

• GoodluckonFinals!

• Ifyou’regraduating,goodluckinlife!