effective memory protection using dynamic tainting
play

Effective Memory Protection Using Dynamic Tainting James Clause - PowerPoint PPT Presentation

Effective Memory Protection Using Dynamic Tainting James Clause Ioanis Doudalis and Alessandro Orso Milos Prvulovic (software) (hardware) College of Computing Georgia Institute of Technology Supported in part by: NSF awards CCF-0541080


  1. Approach overview 3 2 1 C B A 1 Assign taint marks P 1 2 Propagate P 4 taint marks 1 1 P 2 2 3 Check P 5 taint marks P 3 3 3

  2. Approach overview 3 2 1 C B A 1 Assign taint marks P 1 2 Propagate P 4 taint marks 1 1 P 2 2 3 Check P 5 taint marks P 3 3 3

  3. Approach overview 3 2 1 C B A 1 Assign taint marks � P 1 2 Propagate P 4 taint marks 1 1 P 2 2 3 Check P 5 taint marks P 3 3 3

  4. Approach overview 3 2 1 C B A 1 Assign taint marks P 1 2 Propagate P 4 taint marks 1 1 P 2 2 3 Check P 5 taint marks P 3 3 3

  5. Approach overview 3 2 1 C B A 1 Assign taint marks P 1 2 Propagate P 4 taint marks 1 1 P 2 2 3 Check P 5 taint marks P 3 3 3

  6. Approach overview 3 2 1 C B A 1 Assign taint marks P 1 � 2 Propagate P 4 taint marks 1 1 P 2 2 3 Check P 5 taint marks P 3 3 3

  7. Outline • Our approach 1. Assigning taint marks 2. Propagating taint marks 3. Checking taint marks • Empirical evaluation • Conclusions

  8. 1 Assigning taint marks Static Dynamic Memory Pointers

  9. 1 Assigning taint marks Static Dynamic Memory Pointers

  10. 1 Assigning taint marks Static Dynamic buf: i: n: Memory Pointers np:

  11. 1 Assigning taint marks Static [&np , &np + sizeof(int *)) Dynamic buf: i: n: { Memory Pointers np:

  12. 1 Assigning taint marks Static Dynamic buf: i: n: Memory Pointers np:

  13. 1 Assigning taint marks Static Dynamic buf: 4 i: 3 n: 2 Memory Pointers np: 1

  14. 1 Assigning taint marks Static Dynamic Memory Pointers

  15. 1 Assigning taint marks Static Dynamic Memory Pointers

  16. 1 Assigning taint marks Static address-of operator ( &) Dynamic Memory Pointers

  17. 1 Assigning taint marks Static Dynamic Memory Pointers

  18. 1 Assigning taint marks Static Dynamic buf: 4 i: 3 n: 2 Memory Pointers np: 1

  19. 1 Assigning taint marks Static Dynamic Memory Pointers

  20. 1 Assigning taint marks Static Dynamic Memory Pointers

  21. 1 Assigning taint marks Static Dynamic Memory Pointers

  22. 1 Assigning taint marks Static Dynamic buf: 4 i: 3 n: 3 2 Memory Pointers np: 1 2

  23. 1 Assigning taint marks { Static Dynamic [ret, ret + arg0) buf: 4 i: 3 n: 3 2 Memory Pointers np: 1 2

  24. 1 Assigning taint marks Static Dynamic buf: 4 i: 3 n: 3 2 Memory Pointers np: 1 2

  25. 1 Assigning taint marks Static 5 5 5 Dynamic buf: 4 i: 3 n: 3 2 Memory Pointers np: 1 2

  26. 1 Assigning taint marks Static Dynamic Memory Pointers

  27. 1 Assigning taint marks Static Dynamic Memory Pointers

  28. 1 Assigning taint marks Static Dynamic return value of malloc Memory Pointers

  29. 1 Assigning taint marks Static Dynamic Memory Pointers

  30. 1 Assigning taint marks Static 5 5 5 Dynamic buf: 4 i: 3 n: 3 2 Memory Pointers np: 1 2

  31. 1 Assigning taint marks Static Dynamic Memory Pointers

  32. 1 Assigning taint marks Static Dynamic Memory Pointers

  33. Propagating taint marks 2 Overview Overview P 1 P 2 Addition, Subtraction 1 AND Multiplication, Division, OR, XOR

  34. Propagating taint marks 2 + , � , � , ÷ , Overview Overview P 1 P 2 and , or , xor , Addition, Subtraction 1 ... AND Multiplication, Division, OR, XOR

  35. Propagating taint marks 2 + , � , � , ÷ , Overview Overview P 1 P 2 and , or , xor , Addition, Subtraction 1 ... Should the result be tainted? AND If so, how? Multiplication, Division, OR, XOR

  36. Propagating taint marks 2 + , � , � , ÷ , Overview Overview P 1 P 2 and , or , xor , Addition, Subtraction 1 ... Should the result be tainted? AND If so, how? Multiplication, Division, • Propagation must take into account both OR, XOR operation semantics and programmer intent

  37. Propagating taint marks 2 + , � , � , ÷ , Overview Overview P 1 P 2 and , or , xor , Addition, Subtraction 1 ... Should the result be tainted? AND If so, how? Multiplication, Division, • Propagation must take into account both OR, XOR operation semantics and programmer intent • Our policy is based on knowledge of C/C++/assembly and patterns observed in real software

  38. Propagating taint marks 2 A + / − B = C Overview A B C 1 1 Addition, Subtraction Addition, Subtraction / no 1 1 taint ... AND Most common use of addition and Multiplication, Division, subtraction is to add or subtract a OR, XOR pointer and an offset

  39. Propagating taint marks 2 A & B = C Overview A B C no or 1 1 taint Addition, Subtraction ... AND AND The result of and ing a pointer and a mask should be treated differently depending on the value of the mask Multiplication, Division, OR, XOR c = a & 0xffffff00 - base address c = a & 0x000000ff - offset

  40. Propagating taint marks 2 Overview Addition, Subtraction We found zero cases where the AND result of any of these operations was a pointer Multiplication, Division, Multiplication, Division, OR, XOR OR, XOR

  41. Checking taint marks 3 When memory is accessed through a pointer: compare the memory taint mark and the pointer taint mark Pointer Memory IMA? no 2 2 yes 1 2 yes 3 yes 3 yes

  42. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5. buf = malloc(n * sizeof(int)); 6. for(i = 0; i <= n; i++) 7. *(buf + i) = rand()%10; ... }

  43. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5. buf = malloc(n * sizeof(int)); 6. for(i = 0; i <= n; i++) 7. *(buf + i) = rand()%10; ... }

  44. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5. buf = malloc(n * sizeof(int)); 6. for(i = 0; i <= n; i++) 7. *(buf + i) = rand()%10; ... }

  45. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: ... 2 } np: 1

  46. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: ... 2 } np: 1

  47. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: ... 2 } np: 1 2

  48. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: ... 2 } np: 1 2

  49. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: ... 2 } np: 1 2

  50. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: ... 2 } np: 1 2 �

  51. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: ... 2 } np: 1 2

  52. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: 1 2

  53. Preventing IMAs void main() { 1. int *np, n, i, *buf; 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: 1 2

  54. Preventing IMAs 5 void main() { 1. int *np, n, i, *buf; 5 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: 1 2

  55. Preventing IMAs 5 void main() { 1. int *np, n, i, *buf; 5 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 i: 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: 1 2

  56. Preventing IMAs 5 void main() { 1. int *np, n, i, *buf; 5 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 i: 0 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: 1 2

  57. Preventing IMAs 5 void main() { 1. int *np, n, i, *buf; 5 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 i: 0 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: + = 5 5 1 2

  58. Preventing IMAs 5 void main() { 1. int *np, n, i, *buf; 5 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 � i: 0 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: + = 5 5 1 2

  59. Preventing IMAs 5 void main() { 1. int *np, n, i, *buf; 5 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 i: 0 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: 1 2

  60. Preventing IMAs 9 5 void main() { 1. int *np, n, i, *buf; 5 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 i: 0 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: 1 2

  61. Preventing IMAs 9 5 void main() { 8 1. int *np, n, i, *buf; 5 2 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 i: 2 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: 1 2

  62. Preventing IMAs 9 5 void main() { 8 1. int *np, n, i, *buf; 5 2 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 i: 2 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: 1 2

  63. Preventing IMAs 9 5 void main() { 8 1. int *np, n, i, *buf; 5 2 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 i: 3 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: + = 5 5 1 2

  64. Preventing IMAs 9 5 void main() { 8 1. int *np, n, i, *buf; 5 2 5 2. np = &n; 3. printf(“Enter size: “); 4. scanf(“%d”, np); 5 buf: 5. buf = malloc(n * sizeof(int)); 4 i: 3 � 6. for(i = 0; i <= n; i++) 3 7. *(buf + i) = rand()%10; n: 3 ... 2 } np: + = 5 5 1 2

Recommend


More recommend