Efficient Protection of Path-Sensitive Control Security Ren Ding , - - PowerPoint PPT Presentation

efficient protection of path sensitive control security
SMART_READER_LITE
LIVE PREVIEW

Efficient Protection of Path-Sensitive Control Security Ren Ding , - - PowerPoint PPT Presentation

Efficient Protection of Path-Sensitive Control Security Ren Ding , Chenxiong Qian, Chengyu Song*, Bill Harris, Taesoo Kim, Wenke Lee Georgia Tech, UC Riverside* What is Control Flow? The order of instruction execution Only limited sets of


slide-1
SLIDE 1

Efficient Protection of Path-Sensitive Control Security

Ren Ding, Chenxiong Qian, Chengyu Song*, Bill Harris, Taesoo Kim, Wenke Lee Georgia Tech, UC Riverside*

slide-2
SLIDE 2

What is Control Flow?

 The order of instruction execution  Only limited sets of valid transitions

2

slide-3
SLIDE 3

What is Control Hijacking?

3

slide-4
SLIDE 4

100 200 300 400 500 600 700 800 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013

Reported Software Flaws - Buffer Errors

Control Flow Attacks Still Exist...

4

ATTACK Year DEFENSE Stack smashing 1996 Ret2libc 1997 Format string Heap overflow Integer overflow 1998 Stack guard canaries 2000 Stack cookies W^X 2001 Shadow stack ASLR Info leak to bypass ASLR 2002 2003 ProPolice PointGuard 2005 CFI Softbound 2009 CETS 2010 Cfimon Control-flow locking 2011 Kbouncer 2013 Modular CFI ROPecker Hardware-assisted CFI CPI 2014 History-hiding ROP Opaque CFI Per-Input CFI Context-Sensitive CFI 2015 Control-flow bending Missing the pointer Control Jujutsu COOP Griffin FlowGuard 2017

slide-5
SLIDE 5

Control Flow Integrity (CFI)

 Lightweight  Runtime Enforcement  Pre-computed valid sets: points-to analysis  Limitations: over-approximation for soundness!

5

slide-6
SLIDE 6

Motivating Example

 Parse request  Assign “handler” fptr

  • If request from admin:

handler() = priv

  • else:

handler() = unpriv

 Strip request args  Handle request

6

1 void dispatch() { 2 void (*handler)(struct request *) = 0; 3 struct request req; 4 5 while(1) { 6 parse_request(&req); 7 8 if (req.auth_user == ADMIN) { 9 handler = priv; 10 } else { 11 handler = unpriv; 12 // NOTE. buffer overflow 13 strip_args(req.args); 14 } 15 16 handler(&req); 17 } 18 }

slide-7
SLIDE 7

Motivating Example

7

req handler ret addr … … high low strip_args () dispatch () Shellcode libc.so priv() unpriv()

1 void dispatch() { 2 void (*handler)(struct request *) = 0; 3 struct request req; 4 5 while(1) { 6 parse_request(&req); 7 8 if (req.auth_user == ADMIN) { 9 handler = priv; 10 } else { 11 handler = unpriv; 12 // NOTE. buffer overflow 13 strip_args(req.args); 14 } 15 16 handler(&req); 17 } 18 }

slide-8
SLIDE 8

Limitation of Traditional CFI

  • Computes valid transfer sets at

each location (lack dynamic info)

8

parse_request() if admin: priv() else: unpriv() handler() priv() & unpriv()

1 void dispatch() { 2 void (*handler)(struct request *) = 0; 3 struct request req; 4 5 while(1) { 6 parse_request(&req); 7 8 if (req.auth_user == ADMIN) { 9 handler = priv; 10 } else { 11 handler = unpriv; 12 // NOTE. buffer overflow 13 strip_args(req.args); 14 } 15 16 handler(&req); 17 } 18 }

slide-9
SLIDE 9

Per-Input CFI: Most Precise Known CFI

  • Relies on static analysis for soundness
  • Instrumentation required
  • Enable valid target based on execution history for addresses

that are taken

9

slide-10
SLIDE 10

Limitation of Per-Input CFI

  • Once transfer targets enabled,

cannot be eliminated

10

1 void dispatch() { 2 void (*handler)(struct request *) = 0; 3 struct request req; 4 5 while(1) { 6 parse_request(&req); 7 8 if (req.auth_user == ADMIN) { 9 handler = priv; 10 } else { 11 handler = unpriv; 12 // NOTE. buffer overflow 13 strip_args(req.args); 14 } 15 16 handler(&req); 17 } 18 }

parse_request() if admin: priv() handler() priv() & unpriv() priv() else: unpriv()

slide-11
SLIDE 11

PITTYPAT: Path-Sensitive CFI

  • At each control transfer, verify

based on points-to analysis of whole execution path

11

1 void dispatch() { 2 void (*handler)(struct request *) = 0; 3 struct request req; 4 5 while(1) { 6 parse_request(&req); 7 8 if (req.auth_user == ADMIN) { 9 handler = priv; 10 } else { 11 handler = unpriv; 12 // NOTE. buffer overflow 13 strip_args(req.args); 14 } 15 16 handler(&req); 17 } 18 }

parse_request() if admin: priv() else: unpriv() handler() unpriv() priv()

slide-12
SLIDE 12

Assumptions

 Current approach only examines control security  Non-control data is out of scope  Not a memory safety solution

12

slide-13
SLIDE 13

Challenges

 Collecting executed path information and share for analysis

efficiently

 Trace information cannot be tampered  Compute points-to relations online both efficiently and

precisely

13

slide-14
SLIDE 14

Our Solution Per Challenge

 Intel Processor Trace (PT)  Incremental Online Points-to Analysis

14

slide-15
SLIDE 15

Intel Processor Trace

 Low-overhead commodity hardware  Compressed packets to save bandwidth  CR3 filtering  Trace information shared & protected efficiently

15

slide-16
SLIDE 16

Incremental Points-to Analysis

 Input:

  • LLVM IR of target program
  • Metadata of mapping between IR and binary
  • Runtime execution trace

 Output: points-to relations on a single execution path

16

slide-17
SLIDE 17

Things Differentiate Our Analysis

 Traditional static points-to analysis reasons about all paths for

soundness

 Instead, we only reasons about points-to relation on one

single path

 Maintain shadow callstack of instructions executed  Most precise enforcement based on control data only

17

slide-18
SLIDE 18

System Overview

 Monitor Module:

  • Kernel-space driver for PT
  • Shares taken branch information

 Analyzer Module:

  • User-space
  • Updates points-to relation based on trace

18

slide-19
SLIDE 19

Challenging Language Features

  • Signal handling
  • Setjmp/Longjmp
  • Exception Handling

19

slide-20
SLIDE 20

Signal Handling

20

; Function Attrs: nounwind uwtable define void @SIGKILL_handler(i32 %signo) #0 { entry: ... if.then: ; preds = %entry ... if.else: ; preds = %entry ... if.end: ; preds = %if.else, %if.then ret void } ; Function Attrs: nounwind uwtable define i32 @main() #0 { entry: %call1 = call void (i32)* @signal(i32 9, void (i32)* @SIGKILL_handler) #3 ret i32 0 }

slide-21
SLIDE 21

Setjmp/Longjmp

21

; Function Attrs: nounwind uwtable define void @hello() #0 { entry: ... call void @longjmp(%struct.__jmp_buf_tag* getelementptr inbounds ([1 x %struct.__jmp_buf_tag], [1 x %struct.__jmp_buf_tag]* @resume_here, i32 0, i32 0), i32 1) #4 ... } ; Function Attrs: nounwind uwtable define i32 @main() #0 { entry: ... %call1 = call i32 @_setjmp(%struct.__jmp_buf_tag* getelementptr inbounds ([1 x %struct.__jmp_buf_tag], [1 x %struct.__jmp_buf_tag]* @resume_here, i32 0, i32 0)) #5 ...

slide-22
SLIDE 22

; Function Attrs: norecurse uwtable define i32 @main() #4 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { entry: ... %call = invoke i32 @_Z3foov() to label %invoke.cont unwind label %lpad invoke.cont: ; preds = %entry br label %try.cont lpad: ; preds = %entry %0 = landingpad { i8*, i32 } catch i8* bitcast (i8** @_ZTIi to i8*) catch i8* bitcast (i8** @_ZTIc to i8*) catch i8* null ...

Exception Handling

22

slide-23
SLIDE 23

Optimizations on Analysis

 Only analyzing about calling context  Maintains current executing IR block along with execution

  • To avoid decoding of PT traces and translation from binary address

to IR

 Only analyze control-relevant functions and instructions

23

slide-24
SLIDE 24

Evaluation

 Are benign applications satisfying path-sensitive CFI less

susceptible to control hijacking attacks?

 Do malicious applications that satisfy weaker CFI mechanisms

fail to satisfy current solution?

 Can we achieve path-sensitive CFI efficiently?

24

slide-25
SLIDE 25

Forward Edge Points-to Set Size

25

slide-26
SLIDE 26

RIPE

 Contains various vulnerabilities that can be exploited to hijack

control flow

 Passed all 264 benchmark suites that compiled in the testing

environment

26

slide-27
SLIDE 27

Performance Overhead

27 3.3% 12.73%

0% 10% 20% 30% 40% 50% pi-CFI PittyPat

slide-28
SLIDE 28

Limitations

 Non-control data corruption can not be detected  Not reasoning about field sensitiveness for points-to analysis  Performance might not be ideal as a CFI solution

28

slide-29
SLIDE 29

Conclusion

 Define path-sensitive CFI  Deploy practical mechanism for enforcement  Strictly stronger security guarantees  Acceptable runtime overhead in security critical settings

29