Specification In Inference Usin ing Context-Free Language - - PowerPoint PPT Presentation

specification in inference usin ing context free language
SMART_READER_LITE
LIVE PREVIEW

Specification In Inference Usin ing Context-Free Language - - PowerPoint PPT Presentation

Specification In Inference Usin ing Context-Free Language Reachability Osbert Bastani, Saswat Anand, and Alex Aiken Stanford University Specification In Inference Usin ing Context-Free Language Reachability Specification In Inference Usin


slide-1
SLIDE 1

Specification In Inference Usin ing Context-Free Language Reachability

Osbert Bastani, Saswat Anand, and Alex Aiken Stanford University

slide-2
SLIDE 2

Specification In Inference Usin ing Context-Free Language Reachability

slide-3
SLIDE 3

Specification In Inference Usin ing Context-Free Language Reachability

slide-4
SLIDE 4

Partial Programs

slide-5
SLIDE 5

Partial Programs

Program

slide-6
SLIDE 6

Partial Programs

Program

static analysis

slide-7
SLIDE 7

Partial Programs

Program

static analysis sound, precise results

slide-8
SLIDE 8

Partial Programs

Program

sound, precise results static analysis

slide-9
SLIDE 9

Partial Programs

Program

slide-10
SLIDE 10

Partial Programs

Program

slide-11
SLIDE 11

Partial Programs

Program

Approach 1: treat as no-ops

slide-12
SLIDE 12

Partial Programs

static analysis

Program

Approach 1: treat as no-ops

slide-13
SLIDE 13

Partial Programs

static analysis

Program

unsound results

Approach 1: treat as no-ops

slide-14
SLIDE 14

Partial Programs

static analysis

Program

unsound results

Approach 1: treat as no-ops

slide-15
SLIDE 15

Partial Programs

Program

Approach 1: treat as no-ops Approach 2: worst-case

slide-16
SLIDE 16

Partial Programs

Program

Approach 1: treat as no-ops Approach 2: worst-case

slide-17
SLIDE 17

Partial Programs

static analysis

Program

Approach 1: treat as no-ops Approach 2: worst-case

slide-18
SLIDE 18

Partial Programs

static analysis

Program

sound, imprecise results

Approach 1: treat as no-ops Approach 2: worst-case

slide-19
SLIDE 19

Partial Programs

static analysis

Program

sound, imprecise results

Approach 1: treat as no-ops Approach 2: worst-case

slide-20
SLIDE 20

Partial Programs

Program

Approach 1: treat as no-ops Approach 2: worst-case Approach 3: specifications

slide-21
SLIDE 21

Partial Programs

Program

Approach 1: treat as no-ops Approach 2: worst-case Approach 3: specifications

specifications

slide-22
SLIDE 22

Partial Programs

static analysis

Program

Approach 1: treat as no-ops Approach 2: worst-case Approach 3: specifications

specifications

slide-23
SLIDE 23

Partial Programs

static analysis

Program

sound, precise results

Approach 1: treat as no-ops Approach 2: worst-case Approach 3: specifications

specifications

slide-24
SLIDE 24

Partial Programs

static analysis

Program

sound, precise results

Approach 1: treat as no-ops Approach 2: worst-case Approach 3: specifications

specifications

slide-25
SLIDE 25

Partial Programs

static analysis

Program

unsound results

Approach 1: treat as no-ops Approach 2: worst-case Approach 3: specifications

specifications

slide-26
SLIDE 26

Specification Inference

Program

slide-27
SLIDE 27

Specification Inference

Program

Our approach:

slide-28
SLIDE 28

Specification Inference

Program

Our approach:

(builds on [Zhu, Dillig, Dillig 2013])

slide-29
SLIDE 29

Specification Inference

Program

Our approach:

slide-30
SLIDE 30

Specification Inference

Program

Our approach: 1) Worst-case analysis

slide-31
SLIDE 31

Specification Inference

Program

Our approach: 1) Worst-case analysis

slide-32
SLIDE 32

Specification Inference

Program

Our approach: 1) Worst-case analysis

static analysis

slide-33
SLIDE 33

Specification Inference

Program

Our approach: 1) Worst-case analysis

static analysis sound, imprecise results

slide-34
SLIDE 34

Specification Inference

Program

Our approach: 1) Worst-case analysis

static analysis sound, imprecise results

slide-35
SLIDE 35

Specification Inference

Program

Our approach: 1) Worst-case analysis 2) Specification inference

static analysis sound, imprecise results

slide-36
SLIDE 36

Specification Inference

Program

Our approach: 1) Worst-case analysis 2) Specification inference

static analysis sound, imprecise results

proposed specifications

slide-37
SLIDE 37

Specification Inference

Program

static analysis sound, imprecise results

proposed specifications specifications correct ⇒ precise results

Our approach: 1) Worst-case analysis 2) Specification inference

slide-38
SLIDE 38

Specification Inference

static analysis sound, imprecise results

proposed specifications correct specifications

Program

specifications correct ⇒ precise results

Our approach: 1) Worst-case analysis 2) Specification inference

slide-39
SLIDE 39

Specification Inference

static analysis sound, imprecise results

proposed specifications correct specifications

Program

specifications correct ⇒ precise results

Our approach: 1) Worst-case analysis 2) Specification inference

slide-40
SLIDE 40

Specification Inference

Program

static analysis sound, precise results

proposed specifications correct specifications specifications correct ⇒ precise results

Our approach: 1) Worst-case analysis 2) Specification inference

slide-41
SLIDE 41

Specification Inference

  • Sound & Precise
  • Using interaction
  • Finds the same results as if all specifications are written
slide-42
SLIDE 42

Information Flow for Android

  • Finding Android malware using source to sink flows

Tracking: location leaks to Internet Premium SMS: phone # used in SMS send Ransomware: network packets encrypt files

slide-43
SLIDE 43

Information Flow for Android

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
slide-44
SLIDE 44

Information Flow for Android

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);

Android Framework Android App

slide-45
SLIDE 45

Android Framework

Information Flow for Android

Android App

getLatitude()

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
slide-46
SLIDE 46

Android Framework

Information Flow for Android

Android App

getLatitude() add(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
slide-47
SLIDE 47

Android Framework

Information Flow for Android

Android App

getLatitude() add(…) get(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
slide-48
SLIDE 48

Android Framework

Information Flow for Android

Android App

getLatitude() toString() add(…) get(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
slide-49
SLIDE 49

Android Framework

Information Flow for Android

Android App

getLatitude() sendSMS(…) toString() add(…) get(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
slide-50
SLIDE 50

Android Framework

Information Flow for Android

Android App

getLatitude() sendSMS(…) toString() add(…) get(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() { … }
slide-51
SLIDE 51

Android Framework

Information Flow for Android

Android App

getLatitude() sendSMS(…) toString() add(…) get(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() { … }

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) { … }
slide-52
SLIDE 52

Android Framework

Framework Specifications

Android App

sendSMS(…) toString() add(…) get(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() { … }

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) { … }
  • Native code
  • Dynamically loaded code
  • Java reflection

getLatitude()

slide-53
SLIDE 53

Framework Specifications

Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-54
SLIDE 54

Android Framework Specification

Framework Specifications

Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-55
SLIDE 55

Android Framework Specification

Framework Specifications

Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-56
SLIDE 56

Android Framework Specification

Framework Specifications

Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-57
SLIDE 57

Framework Specifications

  • Specification: over-approximates behavior of

framework methods

  • Provided by the user
  • More precise than automated approaches
slide-58
SLIDE 58

Framework Specifications

  • Alias Specifications: describes aliasing
  • @Alias(x, y) means “x aliases y”
  • class List:

@Alias(arg, this.val) void add(Object arg) {} @Alias(this.val, return) Object get(Integer index) {}

slide-59
SLIDE 59

Framework Specifications

  • Flow Specifications: describe information flows
  • @Flow(x, y) means “x tainted ⇒ y tainted”
  • class Double:

@Flow(this, return) String toString() {}

slide-60
SLIDE 60

Framework Specifications

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-61
SLIDE 61

Missing Specifications

  • Specifications typically written as needed
  • ≈ 4,000 framework classes
  • A given app may use hundreds of classes
  • For a given app, only a few classes are relevant for

finding information flows

  • Our experience: specifications for ≈ 175 classes over

course of a year

slide-62
SLIDE 62

Missing Specifications

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-63
SLIDE 63

Missing Specifications

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-64
SLIDE 64

Step 1: Worst-case Analysis

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-65
SLIDE 65

Step 1: Worst-case Analysis

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-66
SLIDE 66

Step 2: Specification Inference

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-67
SLIDE 67

Step 2: Specification Inference

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-68
SLIDE 68

Step 2: Specification Inference

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}

minimal = easier to verify + more likely to be correct

slide-69
SLIDE 69

Step 2: Specification Inference

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-70
SLIDE 70

Interactive Refinement

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-71
SLIDE 71

Interactive Refinement

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-72
SLIDE 72

Interactive Refinement

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-73
SLIDE 73

Interactive Refinement

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-74
SLIDE 74

Interactive Refinement

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-75
SLIDE 75

Interactive Refinement

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-76
SLIDE 76

Interactive Refinement

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-77
SLIDE 77

Interactive Refinement

Android Framework Specification Android App

toString() add(…) get(…) getLatitude() sendSMS(…)

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-78
SLIDE 78

Interactive Refinement

  • Two problems to solve
  • Step 1: Worst-case analysis
  • Step 2: Specification inference
slide-79
SLIDE 79

CFL Reachability

slide-80
SLIDE 80

CFL Reachability

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
slide-81
SLIDE 81

CFL Reachability: Stage 1

retgetLatitude

  • lat

thistoString textsendSMS

Assign

lat latAlias argadd retget

New

list thisadd thisget latString

Assign

  • list

rettoString

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
slide-82
SLIDE 82

CFL Reachability: Stage 1

retgetLatitude

  • lat

thistoString textsendSMS

Assign

lat latAlias argadd retget

New

list thisadd thisget latString

Assign

  • list

rettoString

Put[val] Get[val]

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
slide-83
SLIDE 83

CFL Reachability: Stage 1

retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat latAlias argadd

Put[val]

retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

RefRef

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
slide-84
SLIDE 84

CFL Reachability: Stage 1

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

RefRef

SMS latAlias argadd

Put[val]

retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

SrcRef RefSink

slide-85
SLIDE 85

CFL Reachability: Stage 2

SrcRef

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

RefRef

SMS

RefSink

latAlias argadd

Put[val]

retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

slide-86
SLIDE 86

CFL Reachability: Stage 2

SrcRef

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

RefRef

SMS

RefSink

latAlias argadd

Put[val]

retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

slide-87
SLIDE 87

CFL Reachability: Stage 2

SrcRef

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

RefRef

SMS

RefSink

latAlias argadd

Put[val]

retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

slide-88
SLIDE 88

CFL Reachability: Stage 2

SrcRef

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

RefRef

SMS

RefSink

latAlias argadd

Put[val]

retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

∈ 𝑀( )

SrcRef New New Assign Assign Put val Assign New New Assign Get Val Assign Assign RefRef New New Assign Assign RefSink

slide-89
SLIDE 89

Missing Specifications

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd

Put[val]

retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-90
SLIDE 90

Missing Specifications

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

  • 1. Double lat = getLatitude();
  • 2. List list = new List();
  • 3. list.add(lat);
  • 4. Double latAlias = list.get(0);
  • 5. String latStr = latAlias.toString();
  • 6. sendSMS(latStr);
  • 1. class List:
  • 2. @Alias(arg, this.val)
  • 3. void add(Object arg) {}
  • 4. @Alias(this.val, return)
  • 5. Object get(Integer index) {}
  • 6. class Double:
  • 7. @Flow(this, return)
  • 8. String toString() {}
  • 9. class LocationManager:
  • 10. @Flow(LOC, return)
  • 11. static String getLatitude() {}

12.class SMS:

  • 13. @Flow(text, SMS)
  • 14. static void sendSMS(String text) {}
slide-91
SLIDE 91

Missing Specifications

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

slide-92
SLIDE 92

Missing Specifications

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

slide-93
SLIDE 93

Missing Specifications

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

slide-94
SLIDE 94

Step 1: Worst-Case Analysis

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

slide-95
SLIDE 95

Step 1: Worst-Case Analysis

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

Σ∗

slide-96
SLIDE 96

Step 1: Worst-Case Analysis

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

Σ∗

SrcRef New New Assign Assign Σ∗ = Put val Assign New New Assign Get Val Assign Assign RefRef New New Assign Assign RefSink∈ 𝑀(

)

slide-97
SLIDE 97

Step 1: Worst-Case Analysis

  • Use “do anything” subgraph:
  • Finite state automata that accepts Σ∗

𝜗 𝜗

𝑢

Σ

=

Σ∗

slide-98
SLIDE 98

Step 1: Worst-Case Analysis

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

slide-99
SLIDE 99

Step 1: Worst-Case Analysis

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

𝑢

Σ 𝜗 𝜗

slide-100
SLIDE 100

Step 1: Worst-Case Analysis

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

𝑢

Σ 𝜗 𝜗

SrcRef New New Assign Assign 𝜗 Put val 𝜗 Assign New New Assign Get Val Assign Assign RefRef New New Assign Assign RefSink

∈ 𝑀( )

slide-101
SLIDE 101

Step 2: Specification Inference

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

𝑢

Σ 𝜗 𝜗

slide-102
SLIDE 102

Step 2: Specification Inference

𝑢

Σ 𝜗 𝜗

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

slide-103
SLIDE 103

Step 2: Specification Inference

𝑢

Σ 𝜗 𝜗

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

How do we ensure there are no paths passing through fewer missing specifications?

slide-104
SLIDE 104

Step 2: Specification Inference

  • Idea: use shortest path CFL reachability
  • Other edges have weight 0

𝜗: 1/2 𝜗: 1/2

𝑢

Σ: 0

slide-105
SLIDE 105

Step 2: Specification Inference

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

𝑢

Σ 𝜗: 𝟐/𝟑 𝜗: 𝟐/𝟑

slide-106
SLIDE 106

Step 2: Specification Inference

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

𝑢

Σ 𝜗: 𝟐/𝟑 𝜗: 𝟐/𝟑

slide-107
SLIDE 107

Step 2: Specification Inference

LOC retgetLatitude

  • lat

thistoString textsendSMS

  • rettoString

Assign

lat

SrcRef RefRef

SMS

RefSink

latAlias argadd retget

Get[val] New

list thisadd thisget latString

Assign

  • list

rettoString

𝑢

Σ 𝜗: 𝟐/𝟑 𝜗: 𝟐/𝟑

slide-108
SLIDE 108

Experiments

  • 179 apps from Symantec, Google Play, and Darpa
  • Flow specifications
  • Ran on all 179 apps
  • Alias specifications
  • Type filters (points-to edges satisfy type constraints)
  • Ran on 156 apps
slide-109
SLIDE 109

Flow Specifications Inferred

10 20 30 40 50 60 <5 kLOC (47 apps) 5-50 kLOC (81 apps) >50 kLOC (51 apps) All (179 apps) Average # Specifications # Specifications # Correct Specifications # Correct & Relevant Specifications

slide-110
SLIDE 110

Flow Specifications Inferred

10 20 30 40 50 60 <5 kLOC (47 apps) 5-50 kLOC (81 apps) >50 kLOC (51 apps) All (179 apps) Average # Specifications # Specifications # Correct Specifications # Correct & Relevant Specifications

slide-111
SLIDE 111

Flow Specifications Inferred

10 20 30 40 50 60 <5 kLOC (47 apps) 5-50 kLOC (81 apps) >50 kLOC (51 apps) All (179 apps) Average # Specifications # Specifications # Correct Specifications # Correct & Relevant Specifications

slide-112
SLIDE 112

Flow Specifications Inferred

10 20 30 40 50 60 <5 kLOC (47 apps) 5-50 kLOC (81 apps) >50 kLOC (51 apps) All (179 apps) Average # Specifications # Specifications # Correct Specifications # Correct & Relevant Specifications

slide-113
SLIDE 113

Flow Specifications Inferred

10 20 30 40 50 60 <5 kLOC (47 apps) 5-50 kLOC (81 apps) >50 kLOC (51 apps) All (179 apps) Average # Specifications # Specifications # Correct Specifications # Correct & Relevant Specifications

≈ 4 ×

slide-114
SLIDE 114

Alias Specifications Inferred

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 <5 kLOC (47 apps) 5-50 kLOC (81 apps) >50 kLOC (28 apps) All (156 apps) Average # Specifications # Specifications # Correct Specifications # Correct & Relevant Specifications

slide-115
SLIDE 115

Alias Specifications Inferred

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 <5 kLOC (47 apps) 5-50 kLOC (81 apps) >50 kLOC (28 apps) All (156 apps) Average # Specifications # Specifications # Correct Specifications # Correct & Relevant Specifications

≈ 3 ×

slide-116
SLIDE 116

Benefits of Aggregation

  • Hypothesis: Specifications frequently reused
  • Idea: Aggregate specifications across apps
slide-117
SLIDE 117

Benefits of Aggregation

slide-118
SLIDE 118

Benefits of Aggregation

App D

slide-119
SLIDE 119

Benefits of Aggregation

App A App C App B App D

slide-120
SLIDE 120

Benefits of Aggregation

Vanilla approach: App A App C App B App D

slide-121
SLIDE 121

Benefits of Aggregation

Vanilla approach: App A App C App B App D

slide-122
SLIDE 122

Benefits of Aggregation

Vanilla approach: App A App C App B App D

slide-123
SLIDE 123

Benefits of Aggregation

Vanilla approach: App A App C App B App D

slide-124
SLIDE 124

Benefits of Aggregation

Vanilla approach: App A App C App B App D

slide-125
SLIDE 125

Benefits of Aggregation

Vanilla approach: duplicates App A App C App B App D

slide-126
SLIDE 126

Benefits of Aggregation

Vanilla approach: duplicates App A App C App B App D

slide-127
SLIDE 127

Benefits of Aggregation

Vanilla approach: duplicates App A App C App B App D

slide-128
SLIDE 128

Benefits of Aggregation

With aggregation: Vanilla approach: App A App C App B App D

slide-129
SLIDE 129

Benefits of Aggregation

With aggregation: Vanilla approach: App A App C App B App D

slide-130
SLIDE 130

Benefits of Aggregation

With aggregation: Vanilla approach: App A App C App B App D

slide-131
SLIDE 131

Benefits of Aggregation

With aggregation: Vanilla approach: duplicates App A App C App B App D

slide-132
SLIDE 132

Benefits of Aggregation

With aggregation: Vanilla approach: duplicates App A App C App B App D

slide-133
SLIDE 133

Benefits of Aggregation

With aggregation: Vanilla approach: duplicates App A App C App B App D

slide-134
SLIDE 134

Benefits of Aggregation

With aggregation: Vanilla approach: duplicates App A App C App B App D

slide-135
SLIDE 135

Benefits of Aggregation

With aggregation: Vanilla approach: App A App C App B App D

slide-136
SLIDE 136

Benefits of Aggregation

With aggregation: Vanilla approach:

Aggregation # specs Vanilla approach # specs:

App A App C App B App D

slide-137
SLIDE 137

Benefits of Aggregation

With aggregation: Vanilla approach:

Aggregation # specs Vanilla approach # specs:

100% App A App C App B App D

slide-138
SLIDE 138

Benefits of Aggregation

With aggregation: Vanilla approach:

Aggregation # specs Vanilla approach # specs:

100% 100% App A App C App B App D

slide-139
SLIDE 139

Benefits of Aggregation

With aggregation: Vanilla approach:

Aggregation # specs Vanilla approach # specs:

33% 100% 100% App A App C App B App D

slide-140
SLIDE 140

Benefits of Aggregation

With aggregation: Vanilla approach: (67% reduction in work)

Aggregation # specs Vanilla approach # specs:

33% 100% 100% App A App C App B App D

slide-141
SLIDE 141

Benefits of Aggregation

With aggregation: Vanilla approach:

Aggregation # specs Vanilla approach # specs:

50% 33% 100% 100% (67% reduction in work) App A App C App B App D

slide-142
SLIDE 142

Benefits of Aggregation

With aggregation: Vanilla approach: (67% reduction in work)

Aggregation # specs Vanilla approach # specs:

50% 33% 100% 100% (50% reduction in work) App A App C App B App D

slide-143
SLIDE 143

Benefits of Aggregation

0% 25% 50% 75% 100% 20 40 60 80 100 120 140 160 180 Aggregation # Specs. / Vanilla # Specs. # Apps Analyzed

slide-144
SLIDE 144

Benefits of Aggregation

0% 25% 50% 75% 100% 20 40 60 80 100 120 140 160 180 Aggregation # Specs. / Vanilla # Specs. # Apps Analyzed

slide-145
SLIDE 145

Benefits of Aggregation

0% 25% 50% 75% 100% 20 40 60 80 100 120 140 160 180 Aggregation # Specs. / Vanilla # Specs. # Apps Analyzed

slide-146
SLIDE 146

Benefits of Aggregation

0% 25% 50% 75% 100% 20 40 60 80 100 120 140 160 180 Aggregation # Specs. / Vanilla # Specs. # Apps Analyzed

slide-147
SLIDE 147

Benefits of Aggregation

0% 25% 50% 75% 100% 20 40 60 80 100 120 140 160 180 Aggregation # Specs. / Vanilla # Specs. # Apps Analyzed

slide-148
SLIDE 148

Benefits of Aggregation

0% 25% 50% 75% 100% 20 40 60 80 100 120 140 160 180 Aggregation # Specs. / Vanilla # Specs. # Apps Analyzed

slide-149
SLIDE 149

Benefits of Aggregation

0% 25% 50% 75% 100% 20 40 60 80 100 120 140 160 180 Aggregation # Specs. / Vanilla # Specs. # Apps Analyzed

slide-150
SLIDE 150

Benefits of Aggregation

0% 25% 50% 75% 100% 20 40 60 80 100 120 140 160 180 Aggregation # Specs. / Vanilla # Specs. # Apps Analyzed

slide-151
SLIDE 151

Benefits of Aggregation

0% 25% 50% 75% 100% 20 40 60 80 100 120 140 160 180 Aggregation # Specs. / Vanilla # Specs. # Apps Analyzed

100 orders

slide-152
SLIDE 152

Benefits of Aggregation

0% 25% 50% 75% 100% 20 40 60 80 100 120 140 160 180 Aggregation # Specs. / Vanilla # Specs. # Apps Analyzed

100 orders

82% reduction in work

slide-153
SLIDE 153

Conclusions

  • Approach for analyzing partial programs
  • Step 1: Worst-case analysis (soundness)
  • Step 2: Specification inference
  • Interactive refinement (precision)
  • Inferred Android framework specifications
  • ≈ 4 × workload compared to oracle
  • Further 82% reduction with aggregation
slide-154
SLIDE 154

References

  • H. Zhu, T. Dillig, I. Dillig. Automated inference of library specifications for source-sink property
  • verification. In APLAS, 2013.
  • G. Ammons, R. Bodík, J. Larus. Mining specifications. In POPL, 2002.
  • J. W. Nimmer, M. D. Ernst. Automatic generation of program specifications. In ISSTA, 2002.
  • T. Kremenek, P. Twohey, G. Back, A. Ng, D. Engler. From uncertainty to belief: inferring the specification
  • within. In OSDI, 2006.
  • N. Beckman, A. Nori. Probabilistic, modular and scalable inference of typestate specifications. In PLDI,

2011.

  • B. Livshits, A. V. Nori, S. K. Rajamani, A. Banerjee. Merlin: specification inference for explicit information

flow problems. In PLDI, 2009.

  • S. Arzt, S. Rasthofer, C. Fritz, E. Bodden, A. Bartel, J. Klein, Y. L. Traon, D. Octeau, P. McDaniel. FlowDroid:

precise context, flow, field, object-sensitive and lifecycle-aware taint analysis for Android apps. In PLDI, 2014.

  • D. Knuth. A generalization of Dijkstra’s algorithm. In Information Processing Letters, 6(1):1-5, 1977.
  • T. Reps. Program analysis via graph reachability. In ILPS, 1997.
  • M. Sridharan, D. Gopan, L. Shan, R. Bodik. Demand-driven points-to analysis for Java. In OOPSLA, 2005.
slide-155
SLIDE 155

Questions?

slide-156
SLIDE 156

Specification Inference

Program

[Zhu 2013] approach: 1) Over-approximate 2) Specification inference

slide-157
SLIDE 157

Specification Inference

Program

[Zhu 2013] approach: 1) Over-approximate 2) Specification inference

static analysis

slide-158
SLIDE 158

Specification Inference

Program

[Zhu 2013] approach: 1) Over-approximate 2) Specification inference

static analysis unsound, precise results

slide-159
SLIDE 159

Specification Inference

Program

[Zhu 2013] approach: 1) Over-approximate 2) Specification inference

static analysis unsound, precise results

proposed specifications

slide-160
SLIDE 160

Specification Inference

Program

[Zhu 2013] approach: 1) Over-approximate 2) Specification inference

static analysis unsound, precise results

proposed specifications specifications incorrect ⇒ sound results

slide-161
SLIDE 161

Specification Inference

Program

[Zhu 2013] approach: 1) Over-approximate 2) Specification inference

static analysis unsound, precise results

proposed specifications correct specifications specifications incorrect ⇒ sound results

slide-162
SLIDE 162

Specification Inference

Program

[Zhu 2013] approach: 1) Over-approximate 2) Specification inference

static analysis sound, precise results

proposed specifications correct specifications specifications incorrect ⇒ sound results