林良軒 2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : [email protected]

49
2014 Network and Distributed System Security Symposium AppSealer: Automatic Generation of Vulnerability- Specific Patches for Preventing Component Hijecking Attacks in Android Application Mu Zhang, Heng Yin Syracuse University 林林林 2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : [email protected]

description

2014 Network and Distributed System Security Symposium AppSealer : Automatic Generation of Vulnerability-Specific Patches for Preventing Component Hijecking Attacks in Android Application Mu Zhang, Heng Yin Syracuse University. 林良軒 2014/05/26 @ Advanced Defense Lab Seminar, NCU - PowerPoint PPT Presentation

Transcript of 林良軒 2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : [email protected]

Page 1: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

2014 Network and Distributed System Security Symposium

AppSealer: Automatic Generation of Vulnerability-

Specific Patches for Preventing Component Hijecking Attacks in Android Application

Mu Zhang, Heng Yin Syracuse University

林良軒 2014/05/26 @ Advanced Defense Lab Seminar, NCUEmail : [email protected]

Page 2: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

OutlineIntroduction

Component Hijacking Attack

Implementation

Evaluation

Conclusion

Reference

1

Page 3: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

IntroductionComponent Hijacking Attack : A class of attacks that seek to

gain unauthorized access (read/write or combined) to protected or private resources

through exported components in vulnerable apps.

Ref : CHEX: Statically Vetting Android Apps for Component Hijacking Vulnerabilities (CCS 2012)

3

Page 4: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

4Ref : CHEX: Statically Vetting Android Apps for Component Hijacking Vulnerabilities

Page 5: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

5

Component hijacking attacks

Ref : CHEX: Statically Vetting Android Apps for Component Hijacking Vulnerabilities

Contact Manager App

EnumeratorService

Enum

erator Service

Returns the address book upon request

Accepts unauthorized requests

READ

Contacts

Android Framework

Unauthorized access to protected resources

Page 6: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Component hijacking attacks

Ref : CHEX: Statically Vetting Android Apps for Component Hijacking Vulnerabilities

Setting U

pdate Receiver

Accepts external updates

App Internal DB is not permission protected

Write to critical area

Unauthorized access to private resources

Contact Manager App

Android Framework

Setting UpdateReceiver

PrivateStorage

Key ValueVoIP_Prefix “1234”

Is_App_Lisenced false

5

Page 7: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

AppSealer as a Security Service

7

1. No source code access2. Vulnerability-specific patching3. Minimal performance overhead4. Minimal impact on usability

Page 8: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

[ VulActivity ]

onCreate()

onStart()

– getLocation()

onDestroy()

– post(addr, location)

getLocation()

– getLastKnownLocation()

crypt()

post()

– HttpURLConnection

– outputStrem

8

Page 9: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

9

Page 10: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

10

Page 11: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

11

Page 12: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

12

Page 13: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Workflow

13

(1)IR Translation(2)Slice Computation(3)Patch Statement Placement(4)Patch Statement Optimization(5)Bytecode Generation

Page 14: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Taint Slice ComputationA. Forward Dataflow Analysis

1. Basic Algorithm : use Def-use chain

2. Special Considerationsa. Static field

b. Instance field

c. Intent

d. Class inheritance

e. Thread

B. Backward Dependency Analysis

14

Page 15: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

15

Slice 1 Slice 2

Page 16: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Slice 2

16

Page 17: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Slice 1

17

Page 18: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Slice 1

18

Page 19: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Slice 1

19

Page 20: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Slice 1

20

Page 21: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementA. Tainting Policy

1. Directly modifies the bytecode to keep track of selected tainted information

2. Each single local variable, field, etc. - Have a shadow variable

B. Creating Shadow Variables1. Local Variables

2. Static/Instance Fields

3. Parameters and Return Value

C. Instrumenting the Source

D. Instrumenting Taint Propagation

E. Cleaning the Taint

F. Instrumenting the Sink21

Page 22: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementB. Shadow Variables

1. Local Variables

22

Page 23: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementB. Shadow Variables

2. Static/Instance Fields

23

Page 24: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementB. Shadow Variables

3. Parameters and Return Value

24

Page 25: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementA. Tainting Policy

1. Directly modifies the bytecode to keep track of selected tainted information

2. Each single local variable, field, etc. - Have a shadow variable

B. Creating Shadow Variables1. Local Variables

2. Static/Instance Fields

3. Parameters and Return Value

C. Instrumenting the Source

D. Instrumenting Taint Propagation

E. Cleaning the Taint

F. Instrumenting the Sink25

Page 26: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementA. Tainting Policy

1. Directly modifies the bytecode to keep track of selected tainted information

2. Each single local variable, field, etc. - Have a shadow variable

B. Creating Shadow Variables1. Local Variables

2. Static/Instance Fields

3. Parameters and Return Value

C. Instrumenting the Source

D. Instrumenting Taint Propagation

E. Cleaning the Taint

F. Instrumenting the Sink26

Page 27: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementD. Instrumenting Taint Propagation

1. Simple Assignments

27

Page 28: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementD. Instrumenting Taint Propagation

2. Function Calls

28

Page 29: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementD. Instrumenting Taint Propagation

3. API Calls

1. getString(), toString()

2. Android.widget.TextView,setText()

3. Vector.add(Object)

4. Android.content.ContentValues.put(String key, Byte value)

4. Tracking References

If one of the references is tainted, all other references should also be tainted.

29

Page 30: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementA. Tainting Policy

1. Directly modifies the bytecode to keep track of selected tainted information

2. Each single local variable, field, etc. - Have a shadow variable

B. Creating Shadow Variables1. Local Variables

2. Static/Instance Fields

3. Parameters and Return Value

C. Instrumenting the Source

D. Instrumenting Taint Propagation

E. Cleaning the Taint

F. Instrumenting the Sink30

Page 31: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementE. Cleaning the Taint

To properly clean the taint, for each variable appearing in the def-use chain inside the slice, we need to find all its definitions.

For the definitions outside the slice, we need to insert a statement after that definition to set its shadow variable to 0(non-tainted)

31

Page 32: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementA. Tainting Policy

1. Directly modifies the bytecode to keep track of selected tainted information

2. Each single local variable, field, etc. - Have a shadow variable

B. Creating Shadow Variables1. Local Variables

2. Static/Instance Fields

3. Parameters and Return Value

C. Instrumenting the Source

D. Instrumenting Taint Propagation

E. Cleaning the Taint

F. Instrumenting the Sink32

Page 33: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch Statement PlacementF. Instrumenting the Sink

If they are tainted by certain sources, we can raise a pop-up dialog to the user, asking for decision.- Restart- Continue

33

Page 34: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch OptimizationIn order to reduce the amount of patch statements

O1. Removing Redundant BoolWrappers Copy propagation and dead assignment elimination

O2. Removing Redundant Function Parameters

O3. Inlining Instrumentation Code

O4. Soot’s Build-in Optimizations

34

Page 35: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch OptimizationIn order to reduce the amount of patch statements

O1. Removing Redundant BoolWrappers

O2. Removing Redundant Function Parameters

35

Page 36: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch OptimizationIn order to reduce the amount of patch statements

O1. Removing Redundant BoolWrappers

O2. Removing Redundant Function Parameters

O3. Inlining Instrumentation Code Inlining the body of small function into its callers, the function call overhead can be avoided.

36

Page 37: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Patch OptimizationIn order to reduce the amount of patch statements

O1. Removing Redundant BoolWrappers

O2. Removing Redundant Function Parameters

O3. Inlining Instrumentation Code

O4. Soot’s Build-in Optimizations

37

Page 38: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Workflow

38

(1)IR Translation(2)Slice Computation(3)Patch Statement Placement(4)Patch Statement Optimization(5)Bytecode Generation

Page 39: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

39

Page 40: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

40

Page 41: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

41

Page 42: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

42

Page 43: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

43

Page 44: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

44

Page 45: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Evaluation

45

Page 46: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Evaluation

46

Page 47: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Evaluation

47

Page 48: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

Evaluation

48

Page 49: 林良軒  2014/05/26 @ Advanced Defense Lab Seminar, NCU Email : linliang258369@gmail.com

ConclutionA. Automatically generate patch

B. Shadow mechanism

C. Optimization

49