1 / 84

Computer Security: Computer Science with Attackers

Computer Security: Computer Science with Attackers. Usable Privacy and Security Fall 2009 As told by David Brumley. Find X. There it is. X is 5. X. 3. 4. My Security Axioms. I. Attackers Get Lucky Defenders Do Not. II. Attackers are Creative. Agenda.

genna
Download Presentation

Computer Security: Computer Science with Attackers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Security: Computer Science with Attackers Usable Privacy and SecurityFall 2009 As told by David Brumley

  2. Find X There it is X is 5 X 3 4

  3. My Security Axioms I. Attackers Get Lucky Defenders Do Not II. Attackers are Creative

  4. Agenda • Examples of Axioms, (aka, how to think like an attacker) • Example I: Ken Thompson • Example II: APEG • Example III: RSA • How to argue security

  5. Ken Thompson • Born Feb 4, 1943 • Notable Work: • B Programming Language • UNIX • Plan 9 • Popularized regular expressions • 1983: Turing Award (joint with Ritchie) for UNIX and work in OS • 1999: US National Medal of Technology • 1999: First IEEE Tsutomu Kanai Award

  6. A Self-Reproducing Program main(){printf(f,34,f,34,10);} char*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c"; 

  7. When Executed char*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c";  main(){printf(f,34,f,34,10);} printf(“char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c” ,34,f,34,10); char *f=

  8. When Executed char*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c";  main(){printf(f,34,f,34,10);} printf(“char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c” ,34,f,34,10);// 34 ascii is a quote (“) char *f=“

  9. When Executed char*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c";  main(){printf(f,34,f,34,10);} printf(“char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c” ,34,f,34,10); char *f=“char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c

  10. When Executed char*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c";  main(){printf(f,34,f,34,10);} printf(“char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c” ,34,f,34,10); // 34 is a quote char *f=“char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c”

  11. When Executed char*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c";  main(){printf(f,34,f,34,10);} printf(“char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c” ,34,f,34,10); // 34 is a quote char *f=“char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c”;main() {printf(f,34,f,34,10);}

  12. When Executed char*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c";  main(){printf(f,34,f,34,10);} printf(“char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c” ,34,f,34,10); // 10 is newline char *f=“char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c”;main() {printf(f,34,f,34,10);}

  13. Note • This program can contain an arbitrary amount of excess baggage that will be reproduced along with the main algorithm. main(){printf(f,34,f,34,10);} char*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c"; 

  14. The C Compiler • The C compiler (cc) is written in C • Special characters, such as newlines, quotes, etc., are escaped with backslashes. This is called a “character escape sequence” c = next(); if(c != ‘\\’) // Note, since compiler itself is written in C, must escape backslash return c; c = next(); if(c == ‘\\’) return ‘\\’; // Will return “\\” if(c == ‘n’) return ‘\n’ etc.

  15. Adding a New Escape Sequence • The C compiler (cc) is written in C • How do we add a new escape sequence? • Not yet valid C until added to compiler • But compiling modified compiler will not work because not valid C c = next(); if(c != ‘\\’) // Note, since compiler itself is written in C, must escape backslash return c; c = next(); … if(c == ‘v’) return ‘\v’; /// INVALID! etc.

  16. What you do • Solution: Encode in current valid C • ‘\v’ is ASCII 11 c = next(); if(c != ‘\\’) // Note, since compiler itself is written in C, must escape backslash return c; c = next(); … if(c == ‘v’) return 11; // Works etc.

  17. Checkpoint • Can make a program that prints itself out • Can change the semantics of a compiler

  18. How a compiler works Source Language TargetLanguage Compiler Source Code get(s); compile(s); ExecutableCode

  19. Trojaning Login Compiler ‘login’ get(s); compile(s); if(s == ‘login’) compile(backdoor); Trojaned ‘login’

  20. Trojaning Compiler Compiler ‘cc’ get(s); compile(s); if(s == ‘login’) compile(backdoor); if(s == ‘cc’)compile(cc-backdoor); Trojaned ‘cc’

  21. Using Trojaned Compiler Source ‘cc’ source ‘login’ source Compiler get(s); compile(s); if(s == ‘login’) compile(backdoor); if(s == ‘cc’)compile(cc-backdoor); Trojaned ‘cc’ trojaned exec ‘cc’ trojaned exec ‘login’

  22. Agenda • Examples of Axioms, (aka, how to think like an attacker) • Example I: Ken Thompson • Example II: APEG • Example III: RSA • How to argue security

  23. BBuggy Program PPatched New Program Patches Help Security “Regularly Install Patches”− Computer Security Wisdom

  24. Patches Can Help Attackers −Evil David Evil David

  25. Delayed PatchAttack Evil David Use Patch to Reverse Engineer Bug Gets Patch Attack Unpatched Users T1 T2 Evil David’s Timeline

  26. Patch Delay N. Americagets patched version P Asia gets P [Gkantsidis et al 06]

  27. I can reverse engineer the patched bug and create an exploit in minutes Minutes Gets Patch Reverse Engineer Bug Attack Unpatched Users T1 T2 Evil David’s Timeline

  28. Intuition ParticularInput program Bad Good Trigger Bug

  29. Intuition Exploit BBuggy Program program Bad Good

  30. Intuition BBuggy Program PPatched Program program Bad Good Patch leaks:1) Where2) How to exploit

  31. AutomaticPatch-Based Exploit Generation Step 3: Automatically CalculateExploit Step 1: Get program B P Bad Good Step 2: Diff B & P

  32. AutomaticPatch-Based Exploit Generation Step 3: Automatically CalculateExploit Step 1: Get program B P Bad Good Profit! Step 2: Diff B & P

  33. All integers unsigned 32-bits All arithmetic mod 232 B is binary code IE6 Bug Example B read input if input % 2==0 F T s := input + 3 s := input + 2 ptr := realloc(ptr, s)

  34. input = 232-2 IE6 Bug Example B read input if input % 2==0 232-2 % 2 == 0 F T s := input + 3 s := input + 2 s := 0 (232-2 + 2 % 232) ptr := realloc(ptr, s) ptr := realloc(ptr,0) Using ptr is a problem

  35. IE6 Bug Example B read input Wanted: s > input Integer Overflow when:¬(s > input) if input % 2==0 F T s := input + 3 s := input + 2 ptr := realloc(ptr, s)

  36. Patch B read input P read input if input % 2==0 if input % 2==0 F T F T s := input + 3 s := input + 2 s := input + 3 s := input + 2 ptr := realloc(ptr, s) if s > input T F Error ptr := realloc(ptr, s)

  37. Patch B read input P read input if input % 2==0 if input % 2==0 F T F T s := input + 3 s := input + 2 s := input + 3 s := input + 2 ptr := realloc(ptr, s) if s > input T F Error ptr := realloc(ptr, s) Exploits for B are inputs that fail new safety condition check in P(s > input) = false

  38. Result Overview • No public exploit for 3 out of 5 • Exploit unique for other 2

  39. Does Automatic Patch-Based Exploit Generation Always Work? NO! However, in security attackers get lucky, defenders do not Current Delayed Patch Distribution Insecure

  40. Intermission

  41. Agenda • Examples of Axioms, (aka, how to think like an attacker) • Example I: Ken Thompson • Example II: APEG • Example III: RSA • How to argue security

  42. RSA Cryptosystem • Invented in 1978 by Rivest, Shamir, and Adleman • RSA is widely used • Apache+mod_SSL (https) • stunnel (Secure TCP/IP servers) • sNFS (Secure NFS) • bind (name service) • ssh (secure shell) • We believe RSA is secure

  43. RSA Algorithm • RSA Initialization: • pick prime p (secret) • pick prime q (secret) • Let N = pq (N is public) • pick e (public) • Find ds.t. d*e = 1 mod (p-1)(q-1) (private) • RSA encryption of m: calculate me mod N = c • RSA decryption of c: calculate cdmod N =m • p = 61, q = 53 • N = 3233 • e = 17 • d = 2753 • Suppose m = 123 • c = 12317 mod 3233 = 855 • m = 8552753 mod 3233 = 123

  44. Why is RSA Secure • Step 1: define “security” • Step 2: Show that RSA meets definition

  45. Step 1: Define Security • Public Parameters • N = pq (N is public) • e (public) • Private Parameters • p (secret) • q (secret) • d (derived from e, p, and q, private) RSA Problem: Given N,e, me mod N, compute m RSA is secure if the RSA problemcannot be solved efficiently

  46. Step 2: Show RSA Meets Definition RSA Problem: Given N,e, me mod N, compute m • Public Parameters • N = pq (N is public) • e (public) • Private Parameters • p (secret) • q (secret) • d (derived from e, p, and q, private) Fact: we do not know RSA is secure

  47. 2 Ways to Break RSA RSA Problem: Given N,e, me mod N, compute m Fact: if we can factor, we can break RSA Public N e Private pq d FactoringAlgorithm Given me, we can decrypt just like those who know d

  48. 2 Ways to Break RSA RSA Problem: Given N,e, me mod N, compute m Fact: if we can take roots modulo N, we can break RSA Public me mod N Roots m

  49. Arguing Security • Define what is public and private • Define protocol • What bad guy gets to see • What bad guy cannot see • Show that any run of the protocol the bad guy • cannot see what he is not suppose to • cannot efficiently compute what he is not suppose to

  50. I. Attackers Get Lucky Defenders Do Not

More Related