Program Analysis for Security John Mitchell CS 155 Spring 2014.

Slides:



Advertisements
Similar presentations
Static Analysis for Security
Advertisements

Buffer Overflows Nick Feamster CS 6262 Spring 2009 (credit to Vitaly S. from UT for slides)
Context-Sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers Presentation by Patrick Kaleem Justin.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
SPLINT STATIC CHECKING TOOL Sripriya Subramanian 10/29/2002.
Lecture 16 Buffer Overflow modified from slides of Lawrie Brown.
Program Analysis for Security
Program Analysis for Security John Mitchell CS 155 Spring 2012.
Using Programmer-Written Compiler Extensions to Catch Security Holes Authors: Ken Ashcraft and Dawson Engler Presented by : Hong Chen CS590F 2/7/2007.
ReferencesReferences DiscussionDiscussion Vulnerability Example: SQL injection Auditing Tool for Eclipse LAPSE: a Security Auditing Tool for Eclipse IntroductionIntroductionResultsResults.
Program Analysis for Security Suhabe Bugrara Stanford University.
Verifying the Safety of User Pointer Dereferences Suhabe Bugrara Stanford University Joint work with Alex Aiken.
Mobile Malware John Mitchell CS 155 Spring Outline Mobile malware – Common cases involve command and control, information theft Identifying malware.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Buffer Overflow Attacks. Memory plays a key part in many computer system functions. It’s a critical component to many internal operations. From mother.
Java Security Updated May Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security.
Presentation By Deepak Katta
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
Chapter 6 Buffer Overflow. Buffer Overflow occurs when the program overwrites data outside the bounds of allocated memory It was one of the first exploited.
Natalia Yastrebova What is Coverity? Each developer should answer to some very simple, yet difficult to answer questions: How do I find new.
Computer Security and Penetration Testing
Effective Real-time Android Application Auditing
Computer Science Detecting Memory Access Errors via Illegal Write Monitoring Ongoing Research by Emre Can Sezer.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 12: Pointers continued, C strings.
Computer Science and Software Engineering University of Wisconsin - Platteville 2. Pointer Yan Shi CS/SE2630 Lecture Notes.
COMPUTER SECURITY MIDTERM REVIEW CS161 University of California BerkeleyApril 4, 2012.
Use of Coverity & Valgrind in Geant4 Gabriele Cosmo.
Jose Sanchez 1 o Tielei Wang†, TaoWei†, Zhiqiang Lin‡, Wei Zou†. o Purdue University & Peking University o Proceedings of NDSS'09: Network and Distributed.
Static Program Analysis of Embedded Software Ramakrishnan Venkitaraman Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
Static Program Analyses of DSP Software Systems Ramakrishnan Venkitaraman and Gopal Gupta.
Dynamic Memory Allocation. Domain A subset of the total domain name space. A domain represents a level of the hierarchy in the Domain Name Space, and.
Linux Security. Authors:- Advanced Linux Programming by Mark Mitchell, Jeffrey Oldham, and Alex Samuel, of CodeSourcery LLC published by New Riders Publishing.
Overflow Examples 01/13/2012. ACKNOWLEDGEMENTS These slides where compiled from the Malware and Software Vulnerabilities class taught by Dr Cliff Zou.
Static Program Analysis of Embedded Software Ramakrishnan Venkitaraman Graduate Student, Computer Science Advisor: Dr. Gopal Gupta
An Undergraduate Course on Software Bug Detection Tools and Techniques Eric Larson Seattle University March 3, 2006.
Computer Organization and Design Pointers, Arrays and Strings in C Montek Singh Sep 18, 2015 Lab 5 supplement.
Web Security Firewalls, Buffer overflows and proxy servers.
Introduction to Software Analysis CS Why Take This Course? Learn methods to improve software quality – reliability, security, performance, etc.
Slides by Kent Seamons and Tim van der Horst Last Updated: Nov 11, 2011.
Announcements You will receive your scores back for Assignment 2 this week. You will have an opportunity to correct your code and resubmit it for partial.
MOPS: an Infrastructure for Examining Security Properties of Software Authors Hao Chen and David Wagner Appears in ACM Conference on Computer and Communications.
Beyond Stack Smashing: Recent Advances In Exploiting Buffer Overruns Jonathan Pincus and Brandon Baker Microsoft Researchers IEEE Security and.
Software Security. Bugs Most software has bugs Some bugs cause security vulnerabilities Incorrect processing of security related data Incorrect processing.
C Tutorial - Pointers CS 537 – Introduction to Operating Systems.
THREATS, VULNERABILITIES IN ANDROID OS BY DNYANADA PRAMOD ARJUNWADKAR AJINKYA THORVE Guided by, Prof. Shambhu Upadhyay.
DYNAMIC MEMORY ALLOCATION. Disadvantages of ARRAYS MEMORY ALLOCATION OF ARRAY IS STATIC: Less resource utilization. For example: If the maximum elements.
Program Analysis for Security Original slides created by Prof. John Mitchell.
CS 155 Spring 2016 Mobile Malware John Mitchell.
Content Coverity Static Analysis Use cases of Coverity Examples
Sabrina Wilkes-Morris CSCE 548 Student Presentation
Program Analysis for Security
Introduction to Operating Systems
Seminar in automatic tools for analyzing programs with dynamic memory
Secure Software Development: Theory and Practice
Security mechanisms and vulnerabilities in .NET
Program Analysis for Security
High Coverage Detection of Input-Related Security Faults
Introduction to Operating Systems
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Verifying the Safety of User Pointer Dereferences
Automated Tools for System and Application Security
Processes in Unix, Linux, and Windows
Memory Allocation CS 217.
Introduction to Static Analyzer
CS5123 Software Validation and Quality Assurance
Foundations and Definitions
Presentation transcript:

Program Analysis for Security John Mitchell CS 155 Spring 2014

Software bugs are serious problems Thanks: Isil and Thomas Dillig

App stores

How can you tell whether software you – Buy – Develop – Install is safe to run?

Cost of Fixing a Defect Credit: Andy Chou, Coverity

Several approaches Instrument code for testing – Heap memory: Purify – Perl tainting (information flow) – Java race condition checking Black-box testing – Fuzzing and penetration testing – Black-box web application security analysis Static code analysis – FindBugs, Fortify, Coverity, MS tools, … 7

Outline General discussion of static analysis tools – Goals and limitations – Approach based on abstract states More about one specific approach – Property checkers from Engler et al., Coverity – Sample security-related results Static analysis for of Android apps Slides from: S. Bugrahe, A. Chou, I&T Dillig, D. Engler, J. Franklin, A. Aiken, …

Entry Software Exit Behaviors Entry Exit Manual testing only examines small subset of behaviors 9

Program Analyzers Code ReportTypeLine 1mem leak324 2buffer oflow4,353,245 3sql injection23,212 4stack oflow86,923 5dang ptr8,491 ……… 10,502info leak10,921 Program Analyzer Spec potentially reports many warnings may emit false alarms analyze large code bases false alarm

Example Coverity demo video: Observations – Code analysis integrated into development workflow – Program context important: analysis involves sequence of function calls, surrounding statements – This is a sales video: no discussion of false alarms

Static analysis goals Bug finding – Identify code that the programmer wishes to modify or improve Correctness – Verify the absence of certain classes of errors

Soundness, Completeness PropertyDefinition SoundnessIf the program contains an error, the analysis will report a warning. “Sound for reporting correctness” CompletenessIf the analysis reports an error, the program will contain an error. “Complete for reporting correctness”

CompleteIncomplete Sound Unsound Reports all errors Reports no false alarms Reports all errors May report false alarms UndecidableDecidable May not report all errors May report false alarms Decidable May not report all errors Reports no false alarms

Software... Behaviors Sound Over-approximation of Behaviors False Alarm Reported Error approximation is too coarse… …yields too many false alarms Modules

Outline General discussion of tools – Goals and limitations – Approach based on abstract states More about one specific approach – Property checkers from Engler et al., Coverity – Sample security-related results Static analysis for Android malware – … Slides from: S. Bugrahe, A. Chou, I&T Dillig, D. Engler, J. Franklin, A. Aiken, …

entry X  0 Is Y = 0 ? X  X + 1X  X - 1 Is Y = 0 ? Is X < 0 ?exit crash yes no yes no yesno Does this program ever crash?

entry X  0 Is Y = 0 ? X  X + 1 X  X - 1 Is Y = 0 ? Is X < 0 ? exit crash yes no yes no yesno infeasible path! … program will never crash Does this program ever crash?

entry X  0 Is Y = 0 ? X  X + 1X  X - 1 Is Y = 0 ? Is X < 0 ?exit crash yes no yes no yesno X = 0 X = 1 X = 2 X = 3 non-termination! … therefore, need to approximate Try analyzing without approximating…

X  X + 1 f d in d out d out = f(d in ) X = 0 X = 1 dataflow elements transfer function dataflow equation

X  X + 1 f1 d in1 d out1 = f 1 (d in1 ) Is Y = 0 ? f2 d out2 d out1 d in2 d out1 = d in2 d out2 = f 2 (d in2 ) X = 0 X = 1

d out1 = f 1 (d in1 ) d join = d out1 ⊔ d out2 d out2 = f 2 (d in2 ) f1f1 f2f2 f3f3 d out1 d in1 d in2 d out2 d join d in3 d out3 d join = d in3 d out3 = f 3 (d in3 ) least upper bound operator Example: union of possible values What is the space of dataflow elements,  ? What is the least upper bound operator, ⊔ ?

entry X  0 Is Y = 0 ? X  X + 1X  X - 1 Is Y = 0 ? Is X < 0 ?exit crash yes no yes no yesno X = 0 X = posX = T X = negX = 0X = T Try analyzing with “signs” approximation… terminates... … but reports false alarm … therefore, need more precision lost precision X = T

X = posX = 0X = neg X =  X  negX  pos true Y = 0 Y  0 false X = T X = posX = 0X = neg X =  signs lattice Boolean formula lattice refined signs lattice

entry X  0 Is Y = 0 ? X  X + 1X  X - 1 Is Y = 0 ? Is X < 0 ?exit crash yes no yes no yesno X = 0trueX = 0Y=0X = posY=0X = neg Y0Y0 X = posY=0 X = neg Y0Y0 X = posY=0 X = posY=0X = neg Y0Y0 X = 0 Y0Y0 Try analyzing with “path-sensitive signs” approximation… terminates... … no false alarm … soundly proved never crashes no precision loss refinement

Outline General discussion of tools – Goals and limitations – Approach based on abstract states More about one specific approach – Property checkers from Engler et al., Coverity – Sample security-related results Static analysis for Android malware – … Slides from: S. Bugrahe, A. Chou, I&T Dillig, D. Engler, J. Franklin, A. Aiken, …

Bugs to Detect Some examples Crash Causing Defects Null pointer dereference Use after free Double free Array indexing errors Mismatched array new/delete Potential stack overrun Potential heap overrun Return pointers to local variables Logically inconsistent code Uninitialized variables Invalid use of negative values Passing large parameters by value Underallocations of dynamic data Memory leaks File handle leaks Network resource leaks Unused values Unhandled return codes Use of invalid iterators Slide credit: Andy Chou 28

Example: Check for missing optional args Prototype for open() syscall: Typical mistake: Result: file has random permissions Check: Look for oflags == O_CREAT without mode argument int open(const char *path, int oflag, /* mode_t mode */...); fd = open(“file”, O_CREAT); 29

Example: Chroot protocol checker Goal: confine process to a “jail” on the filesystem −chroot() changes filesystem root for a process Problem −chroot() itself does not change current working directory chroot() chdir(“/”) open(“../file”,…) 30 Error if open before chdir

TOCTOU Race condition between time of check and use Not applicable to all programs check(“foo”) use(“foo”) 31

Tainting checkers 32

Example code with function def, calls #include void say_hello(char * name, int size) { printf("Enter your name: "); fgets(name, size, stdin); printf("Hello %s.\n", name); } int main(int argc, char *argv[]) { if (argc != 2) { printf("Error, must provide an input buffer size.\n"); exit(-1); } int size = atoi(argv[1]); char * name = (char*)malloc(size); if (name) { say_hello(name, size); free(name); } else { printf("Failed to allocate %d bytes.\n", size); } 33

atoi main exitfreemalloc printffgets say_hello Callgraph 34

atoi main exitfreemalloc printffgets say_hello Reverse Topological Sort Idea: analyze function before you analyze caller 35

atoi main exitfreemalloc printffgets say_hello Apply Library Models Tool has built-in summaries of library function behavior 36

atoi main exitfreemalloc printffgets say_hello Bottom Up Analysis Analyze function using known properties of functions it calls 37

atoi main exitfreemalloc printffgets say_hello Bottom Up Analysis Analyze function using known properties of functions it calls 38

atoi main exitfreemalloc printffgets say_hello Bottom Up Analysis Finish analysis by analyzing all functions in the program 39

Finding Local Bugs #define SIZE 8 void set_a_b(char * a, char * b) { char * buf[SIZE]; if (a) { b = new char[5]; } else { if (a && b) { buf[SIZE] = a; return; } else { delete [] b; } *b = ‘x’; } *a = *b; } 40

char * buf[8]; if (a) b = new char [5];if (a && b) buf[8] = a;delete [] b; *b = ‘x’; END *a = *b; a!a a && b !(a && b) Control Flow Graph Represent logical structure of code in graph form 41

char * buf[8]; if (a) b = new char [5];if (a && b) buf[8] = a;delete [] b; *b = ‘x’; END *a = *b; a!a a && b !(a && b) Path Traversal Conceptually: Analyze each path through control graph separately Actually Perform some checking computation once per node; combine paths at merge nodes Conceptually Actually 42

char * buf[8]; if (a) if (a && b) delete [] b; *b = ‘x’; END *a = *b; !a !(a && b) Apply Checking Null pointersUse after freeArray overrun See how three checkers are run for this path Defined by a state diagram, with state transitions and error states Checker Assign initial state to each program var State at program point depends on state at previous point, program actions Emit error if error state reached Run Checker 43

char * buf[8]; if (a) if (a && b) delete [] b; *b = ‘x’; END *a = *b; !a !(a && b) Apply Checking Null pointersUse after freeArray overrun “buf is 8 bytes” 44

char * buf[8]; if (a) if (a && b) delete [] b; *b = ‘x’; END *a = *b; !a !(a && b) Apply Checking Null pointersUse after freeArray overrun “buf is 8 bytes” “a is null” 45

char * buf[8]; if (a) if (a && b) delete [] b; *b = ‘x’; END *a = *b; !a !(a && b) Apply Checking Null pointersUse after freeArray overrun “buf is 8 bytes” “a is null” Already knew a was null 46

char * buf[8]; if (a) if (a && b) delete [] b; *b = ‘x’; END *a = *b; !a !(a && b) Apply Checking Null pointersUse after freeArray overrun “buf is 8 bytes” “a is null” “b is deleted” 47

char * buf[8]; if (a) if (a && b) delete [] b; *b = ‘x’; END *a = *b; !a !(a && b) Apply Checking Null pointersUse after freeArray overrun “buf is 8 bytes” “a is null” “b is deleted” “b dereferenced!” 48

char * buf[8]; if (a) if (a && b) delete [] b; *b = ‘x’; END *a = *b; !a !(a && b) Apply Checking Null pointersUse after freeArray overrun “buf is 8 bytes” “a is null” “b is deleted” “b dereferenced!” No more errors reported for b 49

False Positives What is a bug? Something the user will fix. Many sources of false positives −False paths −Idioms −Execution environment assumptions −Killpaths −Conditional compilation −“third party code” −Analysis imprecision −… 50

char * buf[8]; if (a) b = new char [5];if (a && b) buf[8] = a;delete [] b; *b = ‘x’; END *a = *b; a!a a && b !(a && b) A False Path 51

char * buf[8]; if (a) if (a && b) buf[8] = a; END !a a && b False Path Pruning Integer Range Disequality Branch 52

char * buf[8]; if (a) if (a && b) buf[8] = a; END !a a && b False Path Pruning “a in [0,0]” “a == 0 is true” Integer Range Disequality Branch 53

char * buf[8]; if (a) if (a && b) buf[8] = a; END !a a && b False Path Pruning “a in [0,0]” “a == 0 is true” “a != 0” Integer Range Disequality Branch 54

char * buf[8]; if (a) if (a && b) buf[8] = a; END !a a && b False Path Pruning “a in [0,0]” “a == 0 is true” “a != 0” Impossible Integer Range Disequality Branch 55

Environment Assumptions Should the return value of malloc() be checked? int *p = malloc(sizeof(int)); *p = 42; OS Kernel: Crash machine. File server: Pause filesystem. Spreadsheet: Lose unsaved changes. Game: Annoy user. Library: ? Medical device: malloc?! Web application: 200ms downtime IP Phone: Annoy user. 56

Statistical Analysis Assume the code is usually right int *p = malloc(sizeof(int)); *p = 42; int *p = malloc(sizeof(int)); if(p) *p = 42; int *p = malloc(sizeof(int)); *p = 42; int *p = malloc(sizeof(int)); *p = 42; int *p = malloc(sizeof(int)); if(p) *p = 42; int *p = malloc(sizeof(int)); *p = 42; int *p = malloc(sizeof(int)); if(p) *p = 42; int *p = malloc(sizeof(int)); if(p) *p = 42; 3/4 deref 1/4 deref 57

Application to Security Bugs Stanford research project −Ken Ashcraft and Dawson Engler, Using Programmer-Written Compiler Extensions to Catch Security Holes, IEEE Security and Privacy 2002 −Used modified compiler to find over 100 security holes in Linux and BSD − Benefit −Capture recommended practices, known to experts, in tool available to all 58

Sanitize integers before use Linux: 125 errors, 24 false; BSD: 12 errors, 4 false array[v] while(i < v) … v.clean Use(v) v.tainted Syscall param Network packet copyin(&v, p, len) any<= v <= any memcpy(p, q, v) copyin(p,q,v) copyout(p,q,v) ERROR Warn when unchecked integers from untrusted sources reach trusting sinks

Example security holes /* 2.4.9/drivers/isdn/act2000/capi.c:actcapi_dispatch */ isdn_ctrl cmd;... while ((skb = skb_dequeue(&card->rcvq))) { msg = skb->data;... memcpy(cmd.parm.setup.phone, msg->msg.connect_ind.addr.num, msg->msg.connect_ind.addr.len - 1); Remote exploit, no checks 60

Example security holes /* 2.4.5/drivers/char/drm/i810_dma.c */ if(copy_from_user(&d, arg, sizeof(arg))) return –EFAULT; if(d.idx > dma->buf_count) return –EINVAL; buf = dma->buflist[d.idx]; Copy_from_user(buf_priv->virtual, d.address, d.used); Missed lower-bound check: 61

User-pointer inference Problem: which are the user pointers? −Hard to determine by dataflow analysis −Easy to tell if kernel believes pointer is from user! Belief inference −“*p” implies safe kernel pointer −“copyin(p)/copyout(p)” implies dangerous user ptr −Error: pointer p has both beliefs. Implementation: 2 pass checker inter-procedural: compute all tainted pointers local pass to check that they are not dereferenced 62

Results for BSD and Linux All bugs released to implementers; most serious fixed Gain control of system Corrupt memory Read arbitrary memory Denial of service Minor Total Linux BSD Violation Bug Fixed Bug Fixed 63

Outline General discussion of tools – Goals and limitations – Approach based on abstract states More about one specific approach – Property checkers from Engler et al., Coverity – Sample security-related results Static analysis for Android malware – … Slides from: S. Bugrahe, A. Chou, I&T Dillig, D. Engler, J. Franklin, A. Aiken, …

STAMP Admission System Static Dynamic STAMP Static Analysis More behaviors, fewer details Dynamic Analysis Fewer behaviors, more details Alex Aiken, John Mitchell, Saswat Anand, Jason Franklin Osbert Bastani, Lazaro Clapp, Patrick Mutchler, Manolis Papadakis

Analysis Convert bytecode to intermediate format (called Quads) Step 1 Compute call graph using Class Hierarchy Analysis Step 2 Build an edge-labeled graph G by processing Quads of each class Step 3 Add new edges to G as per a set of rules until no rules apply Step 4

Data Flow Analysis getLoc() sendSMS() sendInet() Source: Location Sink: SMS Sink: Internet LocationSMSLocation Internet Source-to-sink flows o Sources: Location, Calendar, Contacts, Device ID etc. o Sinks: Internet, SMS, Disk, etc.

Data Flow Analysis in Action Vulnerability Discovery Privacy Policy This app collects your: Contacts Phone Number Address FB API Send Internet Source: FB_Data Sink: Internet Web Source: Untrusted_Data SQL Stmt Sink: SQL Malware/Greyware Analysis o Data flow summaries enable enterprise-specific policies API Misuse and Data Theft Detection Automatic Generation of App Privacy Policies o Avoid liability, protect consumer privacy

Challenges Android is 3.4M+ lines of complex code o Uses reflection, callbacks, native code Scalability: Whole system analysis impractical Soundness: Avoid missing flows Precision: Minimize false positives

STAMP Approach Model Android/Java o Sources and sinks o Data structures o Callbacks o 500+ models Whole-program analysis o Context sensitive STAMP Android Models App Too expensive! OS HW

Building Models 30k+ methods in Java/Android API o 5 mins x 30k = 2500 hours Follow the permissions o 20 permissions for sensitive sources  ACCESS_FINE_LOCATION (8 methods with source annotations)  READ_PHONE_STATE - (9 methods) o 4 permissions for sensitive sinks  INTERNET, SEND_SMS, etc.

Identifying Sensitive Data Returns device IMEI in String Requires permission SRC ="$GET_PHONE_STATE.deviceid", SINK ) android.Telephony.TelephonyManager: String getDeviceId()

Data We Track (Sources) Account data Audio Calendar Call log Camera Contacts Device Id Location Photos (Geotags) SD card data SMS 30+ types of sensitive data

Data Destinations (Sinks) Internet (socket) SMS System Logs Webview/Browser File System Broadcast Message 10+ types of exit points

Currently Detectable Flow Types Unique Flow Types = Sources x Sink 396 Flow Types

Example Analysis Contact Sync for Facebook (unofficial) Description: This application allows you to synchronize your Facebook contacts on Android. IMPORTANT: * "Facebook does not allow [sic] to export phone numbers or s. Only names, pictures and statuses are synced." * "Facebook users have the option to block one or all apps. If they opt for that, they will be EXCLUDED from your friends list." Privacy Policy: (page not found)

Contact Sync Permissions CategoryPermissionDescription Your AccountsAUTHENTICATE_ACCOUNTSAct as an account authenticator MANAGE_ACCOUNTSManage accounts list USE_CREDENTIALSUse authentication credentials Network CommunicationINTERNETFull Internet access ACCESS_NETWORK_STATEView network state Your Personal InformationREAD_CONTACTSRead contact data WRITE_CONTACTSWrite contact data System ToolsWRITE_SETTINGSModify global system settings WRITE_SYNC_SETTINGSWrite sync settings (e.g. Contact sync) READ_SYNC_SETTINGSRead whether sync is enabled READ_SYNC_STATSRead history of syncs Your AccountsGET_ACCOUNTSDiscover known accounts Extra/CustomWRITE_SECURE_SETTINGSModify secure system settings

Possible Flows from Permissions Sources Sinks INTERNET READ_CONTACTS WRITE_SETTINGS READ_SYNC_SETTINGS WRITE_CONTACTS READ_SYNC_STATS GET_ACCOUNTS WRITE_SECURE_SETTINGS WRITE_SETTINGS INTERNET

Expected Flows Sources Sinks INTERNET READ_CONTACTS WRITE_SETTINGS READ_SYNC_SETTINGS WRITE_CONTACTS READ_SYNC_STATS GET_ACCOUNTS WRITE_SECURE_SETTINGS WRITE_SETTINGS INTERNET

Observed Flows FB API Write Contacts Send Internet Source: FB_Data Sink: Contact_Book Sink: Internet Read Contacts Source: Contacts

Example Study: Mobile Web Apps Goal Identify security concerns and vulnerabilities specific to mobile apps that access the web using an embedded browser Technical summary WebView object renders web content methods loadUrl, loadData, loadDataWithBaseUrl, postUrl addJavascriptInterface(obj, name) allows JavaScript code in the web content to call Java object method name.foo()

Summary Analyze a dataset of 737,828 Android apps Found large number of apps contain severe vulnerabilities 37,418 apps are vulnerable to a remote code execution exploit when run on any Android device, because of security oversight in older versions and slow adoption of safe versions 45,689 apps are vulnerable to a remote code execution exploit when run on 73% of the in-use Android devices. Offer recommendations for developers who wish to avoid these vulnerabilities.

Severity of exploits in apps that include Bridge Objects and can navigate to content belonging to untrusted origins. Origin Severity

Severity of Bridge Object exploits in apps that load content over HTTP. HTTP Severity

Prevalence of apps that can or must ignore SSL errors based on implementations of onReceivedSslError SSL Error Prevalence

Severity of Bridge Object exploits in apps that must ignore SSL certificate errors. SSL Error Severity

Lecture Summary General discussion of tools −Fundamental limitations −Basic method based on abstract states More details on one specific method −Property checkers from Engler et al., Coverity −Sample security-related results Static analysis for Android malware −… Slides from: S. Bugrahe, A. Chou, I&T Dillig, D. Engler, J. Franklin, A. Aiken, …