Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max addend list heap next prop next prop 27
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max addend list heap next prop next prop 28
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max addend list heap next prop next prop 29
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max addend list heap next prop next prop 30
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max cur_ total typ max addend list heap next prop next prop 31
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max addend list heap next prop next prop 32
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max addend list cur_ total typ max heap next prop next prop 33
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max addend list cur_ total typ max heap next prop next prop 34
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max addend list heap next prop next prop 35
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max STREAM addend list heap next prop next prop 36
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max STREAM addend list heap next prop next prop 37
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max STREAM addend list heap next prop next prop 38
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max STREAM addend list cur_ cur_ total typ max max heap next prop next prop 39
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { ? 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max STREAM addend list heap next prop next prop 40
Motivating Example (cont.) 6 while (quota--) { 4 for (; list != NULL; list = list->next) 7 readData(sockfd, buf); 5 list->prop += addend; 8 if(*type == NONE ) break; malicious computation 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { 12 srv->typ = *type; simulate 13 srv->total += *size; 14 } vulnerable program 15 } Memory space stack buf[] type size quota srv cur_ total typ max STREAM addend list heap next prop next prop 41
Data-Oriented Programming A Generic Technique 42
Data-Oriented Programming (DOP) • General construction – w/o dependency on specific data / functions 43
Data-Oriented Programming (DOP) • General construction – w/o dependency on specific data / functions • Expressive attacks – towards Turing-complete computation 44
Data-Oriented Programming (DOP) • General construction – w/o dependency on specific data / functions • Expressive attacks – towards Turing-complete computation • Elements – data-oriented gadgets – gadget dispatchers 45
Data-Oriented Gadgets • x86 instruction sequence CFG 6 – show in normal execution (CFI) 14 7 13 10 8 12 9 46
Data-Oriented Gadgets • x86 instruction sequence CFG 6 – show in normal execution (CFI) 14 7 13 10 8 12 9 Addition : srv->total += *size; 1 mov (%esi), %ebx //load micro-op 2 mov (%edi), %eax //load micro-op 3 add %ebx, %eax //addition 4 mov %eax, (%edi) //store micro-op 47
Data-Oriented Gadgets • x86 instruction sequence CFG 6 – show in normal execution (CFI) 14 7 13 – save results in memory 10 8 12 – load micro-op --> semantics micro-op --> store micro-op 9 Addition : srv->total += *size; 1 mov (%esi), %ebx //load micro-op 2 mov (%edi), %eax //load micro-op 3 add %ebx, %eax //addition 4 mov %eax, (%edi) //store micro-op 48
Data-Oriented Gadgets • x86 instruction sequence CFG 6 – show in normal execution (CFI) 14 7 13 – save results in memory 10 8 12 – load micro-op --> semantics micro-op --> store micro-op 9 Addition : srv->total += *size; Memory space 1 mov (%esi), %ebx //load micro-op 2 mov (%edi), %eax //load micro-op 3 add %ebx, %eax //addition 4 mov %eax, (%edi) //store micro-op 49
Data-Oriented Gadgets • x86 instruction sequence CFG 6 – show in normal execution (CFI) 14 7 13 – save results in memory 10 8 12 – load micro-op --> semantics micro-op --> store micro-op 9 Addition : srv->total += *size; Memory space 1 mov (%esi), %ebx //load micro-op 2 mov (%edi), %eax //load micro-op 3 add %ebx, %eax //addition 4 mov %eax, (%edi) //store micro-op Load: *size = *(srv ->cur_max); 1 mov (%esi), %ebx //load micro-op 2 mov (%edi), %eax //load micro-op 3 mov 0xb(%ebx), %eax //load 4 mov %eax, (%edx) //store micro-op 50
Data-Oriented Gadgets • x86 instruction sequence CFG 6 – show in normal execution (CFI) 14 7 13 – save results in memory 10 8 12 – load micro-op --> semantics micro-op --> store micro-op 9 Addition : srv->total += *size; Memory space 1 mov (%esi), %ebx //load micro-op 2 mov (%edi), %eax //load micro-op 3 add %ebx, %eax //addition 4 mov %eax, (%edi) //store micro-op Load: *size = *(srv ->cur_max); 1 mov (%esi), %ebx //load micro-op 2 mov (%edi), %eax //load micro-op 3 mov 0xb(%ebx), %eax //load 4 mov %eax, (%edx) //store micro-op 51
Gadget Dispatcher round1 corruptible by mem-err round2 loop selector round3 …… roundN 52
Gadget Dispatcher round1 corruptible by mem-err round2 loop selector round3 …… roundN • Chain data-oriented gadgets “ legitimately” – loop ---> repeatedly invoke gadgets – selector ---> selectively activate gadgets 53
Gadget Dispatcher round1 1 2 3 4 corruptible by mem-err round2 loop selector round3 …… roundN • Chain data-oriented gadgets “ legitimately” – loop ---> repeatedly invoke gadgets – selector ---> selectively activate gadgets 54
Gadget Dispatcher round1 1 2 3 4 corruptible by mem-err round2 5 6 7 loop selector round3 …… roundN • Chain data-oriented gadgets “ legitimately” – loop ---> repeatedly invoke gadgets – selector ---> selectively activate gadgets 55
Gadget Dispatcher round1 1 2 3 4 corruptible by mem-err round2 5 6 7 loop selector 1 2 3 4 round3 …… roundN • Chain data-oriented gadgets “ legitimately” – loop ---> repeatedly invoke gadgets – selector ---> selectively activate gadgets 56
Gadget Dispatcher round1 1 2 3 4 corruptible by mem-err round2 5 6 7 loop selector 1 2 3 4 round3 …… roundN • Chain data-oriented gadgets “ legitimately” – loop ---> repeatedly invoke gadgets – selector ---> selectively activate gadgets 57
Gadget Dispatcher round1 1 2 3 4 corruptible by mem-err round2 5 6 7 loop selector 1 2 3 4 round3 …… roundN • Chain data-oriented gadgets “ legitimately” – loop ---> repeatedly invoke gadgets – selector ---> selectively activate gadgets 6 while (quota--) { // loop 7 readData(sockfd, buf); // selector 8 if(*type == NONE ) break; 9 if(*type == STREAM) *size = *(srv->cur_max); 10 else{ srv->typ = *type; srv->total += *size; } 14 } 58
Turing-completeness • DOP emulates a minimal language MINDOP – MINDOP is Turing-complete Statements Data-Oriented Semantics In C Gadgets in DOP arithmetic / logical a op b *p op *q assignment a = b *p = *q load a = *b *p = **q store *a = b **p = *q jump goto L vpc = &input conditional jump if (a) goto L vpc = &input if *p p – &a; q – &b; op – any arithmetic / logical operation 59
Attack Construction 6 while (quota--) { 7 readData(sockfd, buf); 8 if(*type == NONE ) break; 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { 12 srv->typ = *type; 13 srv->total += *size; 14 } //...(code skipped)... 15 } 60
Attack Construction 6 while (quota--) { 7 readData(sockfd, buf); 8 if(*type == NONE ) break; 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { 12 srv->typ = *type; 13 srv->total += *size; 14 } //...(code skipped)... 15 } • Gadget identification – statically identify load-semantics-store chain from LLVM IR 61
Attack Construction 6 while (quota--) { 7 readData(sockfd, buf); 8 if(*type == NONE ) break; 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { 12 srv->typ = *type; 13 srv->total += *size; 14 } //...(code skipped)... 15 } • Gadget identification – statically identify load-semantics-store chain from LLVM IR • Dispatcher identification – static identify loops with gadgets from LLVM IR 62
Attack Construction 6 while (quota--) { 7 readData(sockfd, buf); 8 if(*type == NONE ) break; 9 if(*type == STREAM) 10 *size = *(srv->cur_max); 11 else { 12 srv->typ = *type; 13 srv->total += *size; 14 } //...(code skipped)... 15 } • Gadget identification – statically identify load-semantics-store chain from LLVM IR • Dispatcher identification – static identify loops with gadgets from LLVM IR • Gadget stitching – select gadgets and dispatchers (manual) – check stitchability (manual) 63
Evaluation 64
Evaluation – Feasibility 9 x86 programs with 9 vulnerabilities – Nginx, ProFTPD, Wu-FTPD, sshd, Bitcoind, – Wireshark, sudo, musl libc, mcrypt 65
Evaluation – Feasibility 9 x86 programs with 9 vulnerabilities – Nginx, ProFTPD, Wu-FTPD, sshd, Bitcoind, – Wireshark, sudo, musl libc, mcrypt • x86 Gadgets – 7518 in total, 1273 reachable via selected CVEs – 8 programs can simulate all MINDOP operations • x86 Dispatchers – 1443 in total, 110 reachable from selected CVEs 66
Evaluation – Feasibility 9 x86 programs with 9 vulnerabilities – Nginx, ProFTPD, Wu-FTPD, sshd, Bitcoind, – Wireshark, sudo, musl libc, mcrypt • x86 Gadgets – 7518 in total, 1273 reachable via selected CVEs – 8 programs can simulate all MINDOP operations • x86 Dispatchers – 1443 in total, 110 reachable from selected CVEs • 2 programs can build Turing-complete attack • 3 end-to-end attacks 67
Case Study: Bypassing Randomization • Previous methods – information leakage to network • Defeat ASLR w/o address leakage to network? 68
Case Study: Bypassing Randomization • Previous methods – information leakage to network • Defeat ASLR w/o address leakage to network? • Vulnerable ProFTPD – use OpenSSL for authentication – a dereference chain to the private key 69
Case Study: Bypassing Randomization • Previous methods – information leakage to network • Defeat ASLR w/o address leakage to network? • Vulnerable ProFTPD – use OpenSSL for authentication – a dereference chain to the private key @ 0x080dbc28 SSL_CTX * ssl_ctx BN_ULONG * d2 BIGNUM * d1 Private Key struct cert_st * cert struct rsa_st * rsa CERT_PKEY * key EVP_PKEY*privatekey 70
Case Study: Bypassing Randomization • Gadgets MOV * p = * q ADD *X = *X + offset LOAD *Z = **Y @ 0x080dbc28 SSL_CTX * ssl_ctx BN_ULONG * d2 BIGNUM * d1 Private Key struct cert_st * cert struct rsa_st * rsa CERT_PKEY * key EVP_PKEY*privatekey 71
Case Study: Bypassing Randomization • Gadgets MOV * p = * q ADD *X = *X + offset LOAD *Z = **Y • Dispatcher while (1) { user_request = get_user_request(); func1() { memory_error; MOV;} dispatch(user_request); func2() { ADD; } } func3() { LOAD; } @ 0x080dbc28 SSL_CTX * ssl_ctx BN_ULONG * d2 BIGNUM * d1 Private Key struct cert_st * cert struct rsa_st * rsa CERT_PKEY * key EVP_PKEY*privatekey 72
Case Study: Bypassing Randomization MOV *X = *0x080dbc28 ( ssl_ctx ) ADD *X = *X + offset1 MOV *Y = *X LOAD *Z = **Y MOV *0x080dbc28 = *Z ( cert ) @ 0x080dbc28 SSL_CTX * ssl_ctx BN_ULONG * d2 BIGNUM * d1 Private Key struct cert_st * cert struct rsa_st * rsa CERT_PKEY * key EVP_PKEY*privatekey 73
Case Study: Bypassing Randomization @ 0x080dbc28 MOV *X = *0x080dbc28 ( ssl_ctx ) ssl_ctx ADD *X = *X + offset1 MOV *Y = *X LOAD *Z = **Y cert MOV *0x080dbc28 = *Z ( cert ) @ 0x080dbc28 SSL_CTX * ssl_ctx BN_ULONG * d2 BIGNUM * d1 Private Key struct cert_st * cert struct rsa_st * rsa CERT_PKEY * key EVP_PKEY*privatekey 74
Case Study: Bypassing Randomization @ 0x080dbc28 MOV *X = *0x080dbc28 ( ssl_ctx ) d2 ADD *X = *X + offset1 MOV *Y = *X LOAD *Z = **Y MOV *0x080dbc28 = *Z ( cert ) @ 0x080dbc28 SSL_CTX * ssl_ctx BN_ULONG * d2 BIGNUM * d1 Private Key struct cert_st * cert struct rsa_st * rsa CERT_PKEY * key EVP_PKEY*privatekey 75
Case Study: Bypassing Randomization @ 0x080dbc28 MOV *X = *0x080dbc28 ( ssl_ctx ) d2 ADD *X = *X + offset1 MOV *Y = *X buf LOAD *Z = **Y MOV *0x080dbc28 = *Z ( cert ) write(outsock, buf, strlen(buf)) ; @ 0x080dbc28 SSL_CTX * ssl_ctx BN_ULONG * d2 BIGNUM * d1 Private Key struct cert_st * cert struct rsa_st * rsa CERT_PKEY * key EVP_PKEY*privatekey 76
Case Study: Bypassing Randomization @ 0x080dbc28 MOV *X = *0x080dbc28 ( ssl_ctx ) d2 ADD *X = *X + offset1 MOV *Y = *X buf LOAD *Z = **Y MOV *0x080dbc28 = *Z ( cert ) write(outsock, buf, strlen(buf)) ; @ 0x080dbc28 SSL_CTX * ssl_ctx BN_ULONG * d2 BIGNUM * d1 Private Key struct cert_st * cert struct rsa_st * rsa CERT_PKEY * key EVP_PKEY*privatekey 77
Case Study: Bypassing Randomization @ 0x080dbc28 MOV *X = *0x080dbc28 ( ssl_ctx ) d2 ADD *X = *X + offset1 MOV *Y = *X buf LOAD *Z = **Y MOV *0x080dbc28 = *Z ( cert ) write(outsock, buf, strlen(buf)) ; leak private key to network @ 0x080dbc28 SSL_CTX * ssl_ctx BN_ULONG * d2 BIGNUM * d1 Private Key struct cert_st * cert struct rsa_st * rsa CERT_PKEY * key EVP_PKEY*privatekey 78
dlopen () – Dynamic Linking Interface • Load the dynamic library into memory space – resolve symbols based on binary metadata – patch program due to relocation – like LoadLibrary () on Windows 79
dlopen () – Dynamic Linking Interface • Load the dynamic library into memory space – resolve symbols based on binary metadata – patch program due to relocation – like LoadLibrary () on Windows • Dynamic loader can do arbitrary computation * RTLD_ _start() exec() sysexec ld.so bin START() file access bin ld.so libc.so libc.so before run * R. Shapiro, S. Bratus, and S. W. Smith, ““Weird Machines” in ELF: A Spotlight on the Underappreciated Metadata,” in WOOT 2013. 80
dlopen () – Dynamic Linking Interface • Load the dynamic library into memory space – resolve symbols based on binary metadata – patch program due to relocation – like LoadLibrary () on Windows • Dynamic loader can do arbitrary computation * RTLD_ _start() exec() sysexec ld.so bin START() file access bin ld.so libc.so libc.so before run • The same to dlopen () * R. Shapiro, S. Bratus, and S. W. Smith, ““Weird Machines” in ELF: A Spotlight on the Underappreciated Metadata,” in WOOT 2013. 81
Case Study: Simulating A Network Bot • Attacks with dlopen dynamic library list link_map …… dlopen() { } head 82
Case Study: Simulating A Network Bot • Attacks with dlopen – send malicious payload dynamic library list link_map …… dlopen() { } head ProFTPD ’s memory Malicious payload 83
Case Study: Simulating A Network Bot • Attacks with dlopen – send malicious payload – corrupt link list & call dlopen dynamic library list link_map …… dlopen() { } head ProFTPD ’s memory Malicious payload 84
Case Study: Simulating A Network Bot • Attacks with dlopen – send malicious payload invalid input – corrupt link list & call dlopen dynamic library list link_map …… dlopen() { } head ProFTPD ’s memory Malicious payload 85
Case Study: Simulating A Network Bot • Attacks with dlopen – send malicious payload invalid input – corrupt link list & call dlopen no call to dlopen dynamic library list link_map …… dlopen() { } head ProFTPD ’s memory Malicious payload 86
Case Study: Simulating A Network Bot • dlopen allows arbitrary computation • DOP attack addresses the problems – send malicious payload invalid input – corrupt link list & call dlopen no call to dlopen dynamic library list link_map …… dlopen() { } head ProFTPD ’s memory Malicious payload 87
Case Study: Simulating A Network Bot • dlopen allows arbitrary computation • DOP attack addresses the problems – send malicious payload invalid input – construct payload in memory – corrupt link list & call dlopen no call to dlopen dynamic library list link_map …… dlopen() { } head ProFTPD ’s memory (1) Payload Malicious payload prepare MOV MOV 88
Case Study: Simulating A Network Bot • dlopen allows arbitrary computation • DOP attack addresses the problems – send malicious payload invalid input – construct payload in memory – corrupt link list & call dlopen no call to dlopen dynamic library list link_map …… dlopen() { } head ProFTPD ’s memory (1) Payload Malicious payload prepare MOV MOV 89
Case Study: Simulating A Network Bot • DOP attack addresses the problems • dlopen allows arbitrary computation – send malicious payload invalid input – construct payload in memory – corrupt link list & call dlopen no call to dlopen – force call to dlopen dynamic library list link_map if (flag) { …… dlopen() { } head } ProFTPD ’s memory (1) Payload Malicious payload prepare MOV MOV 90
Case Study: Simulating A Network Bot • DOP attack addresses the problems • dlopen allows arbitrary computation – send malicious payload invalid input – construct payload in memory – corrupt link list & call dlopen no call to dlopen – force call to dlopen dynamic library list link_map if (flag) { …… dlopen() { } head } (2) Trigger MOV ProFTPD ’s STORE memory (1) Payload Malicious payload prepare MOV MOV 91
Case Study: Simulating A Network Bot • DOP attack addresses the problems • dlopen allows arbitrary computation – send malicious payload invalid input – construct payload in memory – corrupt link list & call dlopen no call to dlopen – force call to dlopen dynamic library list link_map if (flag) { …… dlopen() { } head } > 700 (2) Trigger MOV requests ProFTPD ’s STORE memory (1) Payload Malicious payload prepare MOV MOV 92
Case Study: Altering Memory Permissions • Defenses based on memory permissions – DEP: non-writable code – CFI: non-writable jump tags 93
Case Study: Altering Memory Permissions • Defenses based on memory permissions – DEP: non-writable code – CFI: non-writable jump tags • dlopen(): relocation – change any page permission to writable – update page content – change the permission back 94
Case Study: Altering Memory Permissions • Defenses based on memory permissions – DEP: non-writable code – CFI: non-writable jump tags • dlopen(): relocation – change any page permission to writable – update page content – change the permission back • DOP attacks – dlopen (code_addr, shellcode) 95
Case Study: Altering Memory Permissions • Defenses based on memory permissions – DEP: non-writable code – CFI: non-writable jump tags • dlopen(): relocation – change any page permission to writable – update page content – change the permission back • DOP attacks – dlopen (code_addr, shellcode) • Code injection is back! 96
Related Work Independent Turing Preserve Techniques of specific Complete? CFI? data / funcs? Non-control Data Attacks (Chen et al. 2005) COOP (Schuster et al. 2015) FlowStitch (Hu et al. 2015) Printf-Oriented Programming (Carlini et al. 2015) Control Jujustu (Evans et al. 2015) Data-Oriented Programming 97
Potential Defenses • Memory Safety – e.g., Cyclone (Jim et al. 2002) , CCured (Necula et al. 2002) , SoftBounds+CETS (Nagarakatte et al. 2009, 2010) – high performance overhead (> 100%) • Data-flow Integrity – e.g, DFI (Castro et al. 2006) , kernel DFI (Song et al. 2016) • Fined-grained randomization in data space – e.g., DSR (Bhatkar et al. 2008) • Hardware & software fault isolation – e.g., HDFI (Song et al. 2016) , MPX 98
Potential Defenses • Memory Safety – e.g., Cyclone (Jim et al. 2002) , CCured (Necula et al. 2002) , SoftBounds+CETS (Nagarakatte et al. 2009, 2010) – high performance overhead (> 100%) • Data-flow Integrity – e.g, DFI (Castro et al. 2006) , kernel DFI (Song et al. 2016) • Fined-grained randomization in data space – e.g., DSR (Bhatkar et al. 2008) • Hardware & software fault isolation – e.g., HDFI (Song et al. 2016) , MPX No practical defenses yet ! 99
Conclusion • Non-control data attacks can be Turing-complete 100
Recommend
More recommend