Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over...

47
Contextual Policy Enforcement in Android Applications with Permission Event Graphs Kevin Chen, Noah Johnson, Vijay D’Silva, Shuaifu Dai, Kyle MacNamara, Tom Magrino, Edward Wu, Martin Rinard*, and Dawn Song University of California, Berkeley *Massachusetts Institute of Technology

Transcript of Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over...

Page 1: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Contextual Policy Enforcement in Android Applications with Permission Event GraphsKevin Chen, Noah Johnson, Vijay D’Silva, Shuaifu Dai, Kyle MacNamara, Tom Magrino, Edward Wu, Martin Rinard*, and Dawn Song

University of California, Berkeley*Massachusetts Institute of Technology

Page 2: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Android

Figure: Google Play App Market Growth

Page 3: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Android Malware

● "2577% growth over 2012" -Cisco Security Report 2013

● "Android malware cases to hit 1 million in 2013"

-Trend Micro Annual Threat ReportFigure: Google Play App Market Growth

Page 4: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Android Malware Detection

...

......

...

...

...

...

APP

Permission

PkgAuthor

Our approach

Page 5: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Undetected Malware Example

Page 6: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

User Intended Policy

"The recording can only be started by clicking the REC button, and it will be stopped when the user clicks the STOP button."

Page 7: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Intuition

A representation that summarizes the event dependencies and their API/permission level behaviors (The Permission Event Graph), and a policy language based on that.

Page 8: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Permission Event Graph (PEG)0

1

2

initializationsub-graph

finalizationsub-graph

REC.onClickStart-Recording

STOP.onClickStop-Recording

onCreate

onResumestartService

"The recording can only be started by clicking the REC button, and it will be stopped when the user clicks the STOP button."

Page 9: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

PEG: States0

1

2

initializationsub-graph

finalizationsub-graph

Page 10: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

PEG: States0

1

2

initializationsub-graph

finalizationsub-graph

State s: {true, false} ^ ModeVar

Predicate abstraction of event states.

e.g. ● Button.registered,● Activity.foreground,● API.called

Page 11: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

PEG: Transitions0

1

2

initializationsub-graph

finalizationsub-graph

REC.onClickSTOP.onClick

onCreate

onResume

Page 12: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

PEG: Labels0

1

2

initializationsub-graph

finalizationsub-graph

REC.onClickStart-Recording

STOP.onClickStop-Recording

onCreate

onResumestartService

Page 13: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Sound Recorder: The Good Part0

1

2

initializationsub-graph

finalizationsub-graph

REC.onClickStart-Recording

STOP.onClickStop-Recording

onCreate

onResumestartService

Page 14: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

The Complete PEG0

65

4

1

2

3

initialization

Recorder Activity

finalization finalization

Recorder Service

REC.onClickStart-Recording

STOP.onClickStop-Recording

onCreate

onStart

onCreate

Timer.runStop-Recording

Timer.runStart-Recording

onResumestartService

Page 15: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

PEG: Context of the Benign Use0

65

4

1

2

3

initialization

Recorder Activity

finalization finalization

Recorder Service

REC.onClickStart-Recording

Page 16: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

PEG: Context of the Malicious Use0

65

4

1

2

3

initialization

Recorder Activity

finalization finalization

Recorder Service

Timer.runStart-Recording

onResumestartService

Page 17: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Formal Specification

"The recording can only be started by clicking the REC button, and it will be stopped when the user clicks the STOP button."

0

1

2

...

...

Page 18: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

AbstractionPhase

VerificationPhase

Apps

Permission Event Graph

Conformance or counter- examples

Policies

Approach Overview

Page 19: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Case Study: Geotag

"Mark location of your photos"

Page 20: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Case Study: Geotag

"Mark location of your photos"

Page 21: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Case Study: Geotag

"Mark location of your photos"

Page 22: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Case Study: SMS Replicator Secret

A spyware that secretly forwards every SMS to another number.

Page 23: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Case Study: SMS Replicator Secret

A spyware that secretly forwards every SMS to another number.

Page 24: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

LIFE PEG

AbstractionPhase

VerificationPhase

Apps

Permission Event Graph

Conformance or counter- examples

Policies

OF

Page 25: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

AbstractionPhase

Apps

Permission Event Graph

Abstraction

Page 26: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Abstraction: The Android Trinity

Event System Sys. Libraries

Application

Application Code

System Code

Page 27: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Abstraction: The Android Trinity

Event System Sys. Libraries

Application

States

Call event handlerApplication Code

System Code

Page 28: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Abstraction: The Android Trinity

Event System Sys. Libraries

Application

States

Call event handler

Call APIApplication Code

System Code

Page 29: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Abstraction: The Android Trinity

Event System Sys. Libraries

Application

States

Call event handler

Call API

Register handler

Application Code

System Code

Page 30: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Abstraction: The Algorithm

Summary-based

Abstract Interpretation on (P(aState) x P(API) x P(aState)).Interprocedural CFG with a partially context sensitive points-to analysis

Summary-based1200+ APIs

63 Kinds of Events

Event Semantics Engine

API Semantics Engine

Application Analyzer

SrcStates(SrcStates,

DstStates) Pairs

Event Handler

PEG

* Partial Valuation of the vars in ModeVar

* Partial Valuation of the vars in ModeVar

Page 31: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

VerificationPhase

Permission Event Graph

Conformance or counter- examples

Policies

Verification: BFS for Conformance

Page 32: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Evaluation: PEG size (# states, CDF)

* 269 applications. Binary code sizes vary from 4KB to 6MB

LOG scale

CDF

# of States

Page 33: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Evaluation: Abstraction Time (CDF)

Sec

CDF

Page 34: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Evaluation: Verification Time (CDF)

* Always terminate within 3.6 hours

LOG scale

Sec

CDF

Page 35: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Conclusion

● Permission event graph: event-dependencies and their API/permission-level behaviors

● Contextual policies based on event sequences enable the detection and analysis of complex malicious behaviors (user-oriented security)

● Enriches the set of detection techniques used by security analysts

Page 36: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Questions ?Kevin Chen <[email protected]>

Page 37: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Backup Slides

Page 38: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Backup Slides

A

Page 39: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Native Code

● Known○ The API Semantics Engine

● Unknown○ Do NOT support

Page 40: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Rewriting

● Barriers for static analysis:

● Solutions:○ Insert runtime checks○ More in the paper

Unresolved ReflectionUnresolved Dynamic dispatching

Page 41: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

API Frequency in 95,000 Apps

Page 42: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Specification Constructs

Information Type Example

System status variables (Mode variables)

STOPButton.registered, MyActivity.inBackground

System APIs and their arguments

android.location.Location: double getLatitude(), "content://com.android.contacts/contacts"

Permissions "android.permission.INTERNET"

Page 43: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Specification Checker Interface

Bounded BFS for conformance analysisWrite the specification FSM using the following interfaces:

public int getStateId();public void restoreFromStateId(int id);public ListenerResult stateListener(ModelState state);public ListenerResult actionListener(EventModality action);public ListenerResult methodListener(PathItemMethod method);

Page 44: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend
Page 45: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Evaluation

Page 46: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

Applications

● Usage scenarios: ○ Extra semantics-based filter for malware screening○ Diagnostic tool for security analysts○ Fine-grained information about permission use for

the user

Page 47: Permission Event Graphs Android Applications with ...€¦ · Android Malware "2577% growth over 2012" -Cisco Security Report 2013 "Android malware cases to hit 1 million in 2013"-Trend

FP/FN

● emphasis: a new representation to detect a specific category of malicious behaviors. ...in addition to the traditional Android malware detection techniques.

● 2/18 for the specific set of behaviors● no longer binary,

○ should be a continues answer. ○ Geotag