Top Banner
UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING FOR REAL CODE 24TH USENIX SECURITY SYMPOSIUM AUGUST 12, 2015 DAVID A. RAMOS AND DAWSON ENGLER STANFORD UNIVERSITY
46

UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

Apr 22, 2018

Download

Documents

vuongthuy
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

U N D E R - C O N S T R A I N E D S Y M B O L I C E X E C U T I O N : C O R R E C T N E S S C H E C K I N G F O R R E A L C O D E

2 4 T H U S E N I X S E C U R I T Y S Y M P O S I U M A U G U S T 1 2 , 2 0 1 5

D A V I D A . R A M O S A N D D A W S O N E N G L E R S TA N F O R D U N I V E R S I T Y

Page 2: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

C O N T R I B U T I O N S

• Technique + tool for finding deep bugs in real, open source C/C++ code

‣ No manual testcases

‣ No functional specification

• Bugs reported may have security implications; exploitability must be determined manually

‣ Memory access, heap management, assertion failures, division-by-zero

• Found 77 new bugs in BIND, OpenSSL, Linux kernel

‣ 2 OpenSSL DoS vulnerabilities: CVE-2014-0198, CVE-2015-0292

‣ 14 Linux kernel vulnerabilities (mostly minor DoS issues)

2

Page 3: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

M O T I VAT I O N : C U R R E N T P R A C T I C E

• Code reviews

• “Safer” languages

• Manual (regression) testing

• Static analysis (Coverity, clang static analyzer, etc.)

3

Bugs are everywhere!

Page 4: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

S Y M B O L I C E X E C U T I O N

• Provide symbolic rather than concrete inputs

• Conceptually: explore all paths through a program

• Accurately track all memory values (bit precision)

• Report paths/inputs that crash

‣ Generate concrete testcase

• KLEE tool (prior work: OSDI 2008)

4

Page 5: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 20155

int foo(int x) { if (x) return x/10; else return 10/x;}

x is symbolic input

E X A M P L E

Page 6: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 20155

int foo(int x) { if (x) return x/10; else return 10/x;}

symbolic branch

E X A M P L E

Page 7: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

E X A M P L E

7

if (x) return x/10;

else return 10/x;

x != 0 x == 0

State 1 State 2

Division: OK

Page 8: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

E X A M P L E

7

Division: ERROR

Page 9: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

P R O B L E M : S C A L A B I L I T Y

• Path explosion

‣ | paths | ~ 2 | if-statements |

• Path length and complexity

‣ Undecidable: infinite-length paths (halting problem)

• SMT query complexity (NP-complete)

8

Page 10: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

S O L U T I O N : U N D E R - C O N S T R A I N E D

• Directly execute individual functions within a program

‣ Less code = Fewer paths

‣ Function calls executed (inter-procedural)

‣ Able to test previously-unreachable code

• Challenges

‣ Complex inputs (e.g., pointer-rich data structures)

‣ Under-constrained: inputs have unknown preconditions

- False positives

9

Page 11: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

U C - K L E E T O O L

• Extends KLEE tool (OSDI 2008)

• Runs LLVM bitcode compiled from C/C++ source

• Automatically synthesizes complex inputs

‣ Based on lazy initialization (Java PathFinder)

‣ Supports pointer manipulation and casting in C/C++ (no type safety)

‣ User-specified input depth (k-bound) [Deng 2006]

10

Page 12: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

L A Z Y I N I T I A L I Z AT I O N

• Symbolic (input) pointers initially unbound

• On first dereference:

‣ New object allocated

‣ Symbolic pointer bound to new object’s address

‣ Assume no aliasing (i.e., no cyclical data structures)

• On subsequent dereferences:

‣ Pointer resolves to object allocated above

11

Page 13: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201512

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

E X A M P L E unbound symbolic input

Page 14: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201512

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

E X A M P L E

Page 15: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201512

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

E X A M P L E

Page 16: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201512

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULLn == 0E X A M P L E

n

n != 0

Page 17: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201512

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULLn == 0E X A M P L E

n

n != 0

Page 18: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201512

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULLn == 0E X A M P L E

n

n != 0

uc_node1

next

val

n == &uc_node1

Page 19: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201512

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULLn == 0E X A M P L E

n

n != 0

uc_node1

next

val

n == &uc_node1

Page 20: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201513

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULL

n

n == 0

n != 0

uc_node1

next

val

n == &uc_node1

E X A M P L E

Page 21: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201513

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULL

n

n == 0

n != 0

uc_node1

next

val

n == &uc_node1

n

n != 0uc_node1

next

val

n == &uc_node1

NULL

uc_node1.next == 0

E X A M P L E

Page 22: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201513

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULL

n

n == 0

n != 0

uc_node1

next

val

n == &uc_node1

n

n != 0uc_node1

next

val

n == &uc_node1

NULL

uc_node1.next == 0

E X A M P L E

Page 23: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201513

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULL

n

n == 0

n != 0

uc_node1

next

val

n == &uc_node1

n

n != 0uc_node1

next

val

n == &uc_node1

NULL

uc_node2

next

val

uc_node1.next == &uc_node2

uc_node1.next == 0

E X A M P L E

Page 24: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201513

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULL

n

n == 0

n != 0

uc_node1

next

val

n == &uc_node1

n

n != 0uc_node1

next

val

n == &uc_node1

NULL

uc_node2

next

val

uc_node1.next == &uc_node2

uc_node1.next == 0

E X A M P L E

Page 25: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201513

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULL

n

n == 0

n != 0

uc_node1

next

val

n == &uc_node1

n

n != 0uc_node1

next

val

n == &uc_node1

NULL

uc_node2

next

val

uc_node1.next == &uc_node2

uc_node1.next == 0

E X A M P L E

Page 26: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201513

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULL

n

n == 0

n != 0

uc_node1

next

val

n == &uc_node1

n

n != 0uc_node1

next

val

n == &uc_node1

NULL

uc_node2

next

val

NULL

uc_node1.next == &uc_node2 uc_node2.next == 0

uc_node1.next == 0

E X A M P L E

Page 27: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201513

int listSum(node *n) { int sum = 0; while (n) { sum += n->val; n = n->next; } return sum;}

n NULL

n

n == 0

n != 0

uc_node1

next

val

n == &uc_node1

n

n != 0uc_node1

next

val

n == &uc_node1

NULL

uc_node2

next

val

NULL

uc_node1.next == &uc_node2 uc_node2.next == 0

uc_node1.next == 0

E X A M P L E

Page 28: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

U S E C A S E S

• Equivalence checking: patches

‣ Yesterday’s code vs. today’s code (i.e., fewer bugs today)

‣ Goal: detect (and prevent!) new crashes introduced by patches

‣ Other uses discussed in CAV 2011 paper

14

Page 29: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201515

PAT C H E S

Source: https://twitter.com/phabricator

Page 30: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

U S E C A S E S

• Equivalence checking: patches

‣ Yesterday’s code vs. today’s code (i.e., fewer bugs today)

‣ Goal: detect (and prevent!) new crashes introduced by patches

‣ Other uses discussed in CAV 2011 paper

• General bug-finding: rule-based checkers ‣ Single version of a function; under-constrained + additional checker rules

‣ Memory leaks, uninitialized data, unsafe user input

‣ Simple interface for adding new checkers

16

Page 31: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

E Q U I VA L E N C E C H E C K I N G

17

retA = fooA(x);retB = fooB(x);

assert(retA == retB);

identical input (symbolic)

assert equivalence

Page 32: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

E Q U I VA L E N C E C H E C K I N G

• Value equivalence

‣ Return value

‣ Arguments passed by reference

‣ Global/static variables

‣ System call effects (modeled)

• Error (crash) equivalence

‣ Both versions typically have the same same (unknown) preconditions!

‣ Neither version crashes on an input

‣ Both versions crash on an input

18

USE CASE: whether patches introduce

crashes

Page 33: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

E Q U I VA L E N C E C H E C K I N G

• Check per path equivalence of two functions

• If all paths exhausted, equivalence verified (up to input bound)

19

Page 34: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

E VA L U AT I O N

• BIND, OpenSSL

‣ Mature, security-critical codebases (~400 KLOC each)

• Patches

‣ BIND: 487 patches to 9.9 stable (14 months)

‣ OpenSSL: 324 patches to 1.0.1 stable (27 months)

• Ran UC-KLEE for 1 hour on each patched function

20

Page 35: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

E VA L U AT I O N : PAT C H E S

• Discovered 10 new bugs (4 in BIND, 6 in OpenSSL)

‣ 2 OpenSSL DoS vulnerabilities:

- CVE-2014-0198: NULL pointer dereference

- CVE-2015-0292: Out-of-bounds memcpy read

• Verified (w/ caveats) that patches do not introduce crashes

‣ 67 (13.8%) for BIND, 48 (14.8%) for OpenSSL

‣ Caveat: max. input size (25KB), tool limitations/bugs

21

Page 36: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

O P E N S S L C V E - 2 0 1 4 - 0 1 9 8

22

do_ssl3_write():1 if (wb->buf == NULL)2 if (!ssl3_setup_write_buffer(s))3 return -1;4 ...5 /* If we have an alert to send, lets send it */6 if (s->s3->alert_dispatch) {7 i=s->method->ssl_dispatch_alert(s);8 if (i <= 0)9 return(i);10 /* if it went, fall through and send more stuff */11 }12 ...13 unsigned char *p = wb->buf;14 *(p++)=type&0xff;

NULL pointer check

call sets wb->buf to NULL

NULL pointer dereference

Page 37: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

O P E N S S L C V E - 2 0 1 4 - 0 1 9 8

• Uncommon code path

‣ SSL_MODE_RELEASE_BUFFERS runtime option (used by Apache mod_ssl)

‣ SSL alert pending (could be triggered by attacker)

‣ Difficult to consider this case with traditional testing

23

Page 38: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

FA L S E P O S I T I V E S

• Function’s inputs have unknown preconditions

• Partial solutions

‣ Automated heuristics

‣ Manual annotations (lazily, as needed)

- Written in C/C++, separate from codebase

- Simple annotation can silence many errors

24

Page 39: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

FA L S E P O S I T I V E S : E X A M P L E ( B I N D )

25

1 int isc_region_compare(isc_region_t *r1, isc_region_t *r2) {2 unsigned int l;3 int result;4 5 REQUIRE(r1 != NULL);6 REQUIRE(r2 != NULL);78 l = (r1->length < r2->length) ? r1->length : r2->length;910 if ((result = memcmp(r1->base, r2->base, l)) != 0)11 return ((result < 0) ? -1 : 1);12 else13 return ((r1->length == r2->length) ? 0 :14 (r1->length < r2->length) ? -1 : 1);15 }

INVARIANT(r->length <= OBJECT_SIZE(r->base));

623 errors silenced (7.5% of all errors reported for BIND)

Page 40: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

M A N U A L A N N O TAT I O N S

• BIND: 400 lines of annotation code (~0.1%)

• OpenSSL: 60 lines of annotation code (~0.02%)

• Reasonable effort relative to code size (~400 KLOC) and importance

26

Page 41: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

G E N E R A L B U G - F I N D I N G

• Run single version of a function (w/ lazy initialization)

• Individual checkers look for specific types of bugs:

‣ Leak checker

‣ Uninitialized data checker

‣ User input checker

• Like Valgrind but applied to all execution paths

27

Page 42: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

E VA L U AT I O N

• 20,000+ functions: BIND, OpenSSL, Linux kernel (~12 MLOC)

• Found 67 new bugs

‣ 37 memory leaks

- Linux kernel: exploitable AUTH_GSS leak in NFS SunRPC layer

‣ 19 uses of uninitialized data

- BIND: DNS UDP port PRNG selected by uninitialized value

- Linux kernel: leak of private kernel stack data via firewire ioctl

‣ 11 unsafe user input (Linux kernel only)

- VMware VMCI driver: unchecked memcpy length (~Heartbleed)

- CEPH distributed file system: division-by-zero (kernel FPE)

28

Page 43: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

U S E R I N P U T C H E C K E R

• User input is fully-constrained (an attacker may supply any value); no unknown input preconditions

• Checker tracks whether each symbolic byte is UC/FC

• Checker emits UNSAFE_INPUT flag if error is caused by FC input

• Suppresses flag for inputs possibly sanitized (false pos. trade-off)

• C annotations: specify functions returning user input

‣ Linux: get_user, copy_from_user, syscall args

‣ BIND: isc_buffer_getuint8

‣ OpenSSL: byte-swaps (n2s, n2l, etc.) [Chou]

29

Page 44: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

K E R N E L V M C I V U L N E R A B I L I T Y

30

1 static int dg_dispatch_as_host(...,2 struct vmci_datagram *dg) {3 dg_size = VMCI_DG_SIZE(dg);4 ...5 dg_info = kmalloc(sizeof(*dg_info) +6 (size_t) dg->payload_size, GFP_ATOMIC);7 ...8 memcpy(&dg_info->msg, dg, dg_size);9 ...10 }

copy_from_user()Fully constrained

Unchecked memcpy length

Send up to 69,632 bytes from host private kernel memory to guest OS

Similar to Heartbleed! (much lower impact)

Page 45: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 2015

C O N C L U S I O N

• Under-constrained symbolic execution

• Equivalence checking: patches

• General bug-finding: rule-based checkers

• Experimental results: BIND, OpenSSL, Linux kernel

31

Page 46: UNDER-CONSTRAINED SYMBOLIC EXECUTION: CORRECTNESS CHECKING ... · under-constrained symbolic execution: correctness checking for real code 24th usenix security symposium august 12,

David A. Ramos & Dawson Engler USENIX Security 201532

@ramosbugs

Q U E S T I O N S ?