aeg automa c exploit genera on
play

AEG: Automa+c Exploit Genera+on Thanassis Avgerinos, Sang - PowerPoint PPT Presentation

AEG: Automa+c Exploit Genera+on Thanassis Avgerinos, Sang Kil Cha, Brent Lim Tze Hao, David Brumley 2/8/11 Carnegie Mellon University 1


  1. AEG: ¡Automa+c ¡Exploit ¡Genera+on ¡ Thanassis ¡Avgerinos, ¡ ¡ Sang ¡Kil ¡Cha, ¡ ¡ Brent ¡Lim ¡Tze ¡Hao, ¡ ¡ David ¡Brumley ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 1 ¡

  2. The ¡iwconfig ¡vulnerability ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 2 ¡

  3. iwconfig: ¡setuid ¡wireless ¡config ¡ 1 int get_info(int skfd, char * ifname, …){ 2 ... Inputs triggering bug: 3 if(iw_get_ext(skfd, ifname, SIOCGIWNAME, &wrq) < 0) length(argv[1]) > sizeof(ifr_name) 4 { 5 struct ifreq ifr; struct ifreq { 6 strcpy(ifr.ifr_name, ifname); char ifr_name[32] 7 } … } 8 print_info(int skfd, char *ifname,…){ 9 ... 10 get_info(skfd, ifname, …); 11 } Can you spot 12 main(int argc, char *argv[]){ the bug? 13 ... 14 print_info(skfd, argv[1], NULL, 0); 15 } 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 3 ¡

  4. Is ¡it ¡exploitable? ¡ • (Fundamental ¡ques+on ¡in ¡our ¡work) ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 4 ¡

  5. get_info ¡stack ¡frame ¡ 1 int get_info(int skfd, char * ifname, …){ Return ¡address ¡ 2 ... 3 if(iw_get_ext(skfd, ifname, SIOCGIWNAME, &wrq) < 0) … ¡ 4 { 5 struct ifreq ifr; < ¡locals ¡> ¡ 6 strcpy(ifr.ifr_name, ifname); … ¡ 68 ¡ 7 } bytes ¡ ¡ 8 print_info(int skfd, char *ifname,…){ ¡ 9 ... ifr.ifr_name ¡ 10 get_info(skfd, ifname, …); 11 } 12 main(int argc, char *argv[]){ 13 ... Memory ¡Layout ¡ 14 print_info(skfd, argv[1], NULL, 0); 15 } 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 5 ¡

  6. get_info ¡stack ¡frame ¡ 1 int get_info(int skfd, char * ifname, …){ Return ¡address ¡ 2 ... 3 if(iw_get_ext(skfd, ifname, SIOCGIWNAME, &wrq) < 0) … ¡ 4 { 5 struct ifreq ifr; < ¡locals ¡> ¡ 6 strcpy(ifr.ifr_name, ifname); … ¡ 68 ¡ 7 } bytes ¡ ¡ 8 print_info(int skfd, char *ifname,…){ ¡ 9 ... ifr.ifr_name ¡ 10 get_info(skfd, ifname, …); 11 } 12 main(int argc, char *argv[]){ 13 ... Memory ¡Layout ¡ 14 print_info(skfd, argv[1], NULL, 0); 15 } 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 6 ¡

  7. get_info ¡stack ¡frame ¡ 1 int get_info(int skfd, char * ifname, …){ Return ¡address ¡ 2 ... 3 if(iw_get_ext(skfd, ifname, SIOCGIWNAME, &wrq) < 0) … ¡ 4 { 5 struct ifreq ifr; < ¡locals ¡> ¡ 6 strcpy(ifr.ifr_name, ifname); … ¡ 68 ¡ 7 } bytes ¡ User ¡ ¡ 8 print_info(int skfd, char *ifname,…){ ¡ Input ¡ 9 ... ¡ 10 get_info(skfd, ifname, …); ifr.ifr_name ¡ 11 } 12 main(int argc, char *argv[]){ 13 ... Memory ¡Layout ¡ 14 print_info(skfd, argv[1], NULL, 0); 15 } 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 7 ¡

  8. get_info ¡stack ¡frame ¡ 1 int get_info(int skfd, char * ifname, …){ Return ¡address ¡ 2 ... 3 if(iw_get_ext(skfd, ifname, SIOCGIWNAME, &wrq) < 0) ¡ 4 { 5 struct ifreq ifr; ¡ 6 strcpy(ifr.ifr_name, ifname); User ¡ ¡ 68 ¡ 7 } Input ¡ bytes ¡ ¡ 8 print_info(int skfd, char *ifname,…){ ¡ 9 ... ¡ 10 get_info(skfd, ifname, …); ifr.ifr_name ¡ 11 } 12 main(int argc, char *argv[]){ 13 ... Memory ¡Layout ¡ 14 print_info(skfd, argv[1], NULL, 0); 15 } 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 8 ¡

  9. get_info ¡stack ¡frame ¡ 1 int get_info(int skfd, char * ifname, …){ 2 ... 3 if(iw_get_ext(skfd, ifname, SIOCGIWNAME, &wrq) < 0) ¡ 4 { User ¡ 5 struct ifreq ifr; ¡ 6 strcpy(ifr.ifr_name, ifname); ¡ Input ¡ 68 ¡ 7 } bytes ¡ ¡ 8 print_info(int skfd, char *ifname,…){ ¡ 9 ... ¡ 10 get_info(skfd, ifname, …); ifr.ifr_name ¡ 11 } 12 main(int argc, char *argv[]){ 13 ... Memory ¡Layout ¡ 14 print_info(skfd, argv[1], NULL, 0); 15 } 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 9 ¡

  10. Automa+c ¡Exploit ¡Genera+on ¡ Given ¡program, ¡find ¡bugs ¡and ¡demonstrate ¡exploitability ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 10 ¡

  11. DEMO ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 11 ¡

  12. Automa+c ¡Exploit ¡Genera+on ¡ Given ¡program, ¡find ¡bugs ¡and ¡demonstrate ¡exploitability ¡ Rest ¡of ¡the ¡talk ¡ ¡ • Our ¡problem ¡defini+on ¡and ¡scope ¡ • Techniques ¡and ¡challenges ¡ • Results ¡and ¡discussion ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 12 ¡

  13. Problem ¡Domain ¡ All ¡Inputs ¡ length(input) ¡> ¡sizeof(ifr_name) ¡ (Bugs) ¡ Control ¡ length(input) ¡> ¡sizeof(ifr_name) ¡ Hijack ¡ Λ ¡ “execute ¡shellcode” ¡ AEG ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 13 ¡

  14. The ¡goal ¡ AEG ¡ Exploits ¡ Prog ¡ Bug ¡ Exploit ¡ Compile ¡ Finder ¡ Generator ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 14 ¡

  15. Our ¡Approach ¡ Bugs ¡ Vulnerability ¡ Exploit ¡ Exploits ¡ Prog ¡ Genera+on ¡ Discovery ¡ Dynamic ¡ Symbolic ¡ Binary ¡ Execu+on ¡on ¡ Analysis ¡ source ¡code ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 15 ¡

  16. Vulnerability ¡ Discovery ¡ Technique: ¡ ¡ Symbolic ¡Execu+on ¡on ¡source ¡code ¡ Goal: ¡Discover ¡the ¡“buggy” ¡predicate ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 16 ¡

  17. Symbolic ¡Execu+on: ¡How ¡it ¡works ¡ x ¡is ¡input ¡ x ¡can ¡be ¡anything ¡ char ¡buf[42]; ¡ Buggy ¡Path ¡ Predicate ¡ (x ¡> ¡0) ¡ if ¡x ¡> ¡0 ¡ t ¡ f ¡ if ¡x*x ¡= ¡0x42424242 ¡ (x ¡> ¡0) ¡Λ ¡(x*x ¡= ¡0x42424242) ¡ t ¡ f ¡ buf[45] ¡= ¡x; ¡ Bug! ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 17 ¡

  18. Tradi+onal ¡symbolic ¡execu+on: ¡ ¡ cover ¡all ¡paths ¡ ¡ (Slow ¡to ¡find ¡exploitable ¡bugs) ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 18 ¡

  19. Tradi+onal ¡Symbolic ¡Execu+on ¡ strcpy(ifr_name, ¡ifname); ¡ If ¡ ¡(ifname[0] ¡!= ¡0) ¡ ¡ t ¡ f ¡ If ¡ ¡(ifname[1] ¡!= ¡0) ¡ ¡ for ¡(i ¡= ¡0 ¡; ¡ifname[i] ¡!= ¡0 ¡; ¡i++) ¡ t ¡ f ¡ ¡ ¡ ¡ ¡ifr_name[i] ¡= ¡ifname[i]; ¡ ifr_name[i] ¡= ¡0; ¡ … ¡ If ¡ ¡(ifname[n] ¡!= ¡0) ¡ ¡ t ¡ f ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 19 ¡

  20. Tradi+onal ¡Symbolic ¡Execu+on ¡ If ¡ ¡(ifname[0] ¡!= ¡0) ¡ ¡ t ¡ f ¡ If ¡ ¡(ifname[1] ¡!= ¡0) ¡ ¡ t ¡ f ¡ 20 ¡min ¡ explora+on ¡ … ¡ 30 ¡min ¡ If ¡ ¡(ifname[n] ¡!= ¡0) ¡ ¡ explora+on ¡ t ¡ f ¡ KLEE ¡[Cadar’08] ¡does ¡ ¡ Exploitable ¡ x ¡min ¡ Bug ¡found ¡ this ¡ explora+on ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 20 ¡

  21. Tradi+onal ¡symbolic ¡execu+on: ¡ ¡ cover ¡all ¡paths ¡ ¡ (Slow ¡to ¡find ¡exploitable ¡bugs) ¡ Our ¡Intui+on ¡for ¡Exploit ¡ Genera+on: ¡ ¡ only ¡explore ¡buggy ¡paths ¡(Fast) ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 21 ¡

  22. Insight: ¡ Precondi)on ¡Symbolic ¡Execu)on ¡ to ¡only ¡(likely) ¡exploitable ¡paths ¡ All ¡Inputs ¡ Bugs ¡ Precondi+on ¡ length(input) ¡> ¡n ¡ ¡ Control ¡ where ¡n ¡is ¡the ¡size ¡of ¡ Hijack ¡ the ¡smallest ¡buffer ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 22 ¡

  23. AEG: ¡Precondi+oned ¡Symbolic ¡Execu+on ¡ Unsa+sfiable ¡ Precondi+on ¡Check: ¡ If ¡ ¡(ifname[0] ¡!= ¡0) ¡ ¡ ¡ t ¡ f ¡ length(input) ¡> ¡n ¡ ¡ Unsa+sfiable ¡ Λ ¡ If ¡ ¡(ifname[1] ¡!= ¡0) ¡ ¡ ifname[0] ¡== ¡0 ¡ t ¡ f ¡ Not ¡explored. ¡ Precondi+on ¡Check: ¡ Saved ¡20 ¡min ¡ … ¡ ¡ length(input) ¡> ¡n ¡ ¡ Not ¡explored. ¡ Λ ¡ If ¡ ¡(ifname[n] ¡!= ¡0) ¡ ¡ Saved ¡30min ¡ Ifname[1] ¡== ¡0 ¡ t ¡ f ¡ Not ¡ Exploitable ¡ explored. ¡ Bug ¡found ¡ Saved ¡x ¡min ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 23 ¡

  24. How ¡to ¡select ¡the ¡length? ¡ • Lightweight ¡sta+c ¡analysis: ¡use ¡the ¡size ¡of ¡the ¡ largest ¡sta+cally ¡allocated ¡buffer ¡ • Allowed ¡AEG ¡to ¡fully ¡automa+cally ¡detect ¡10 ¡ of ¡the ¡16 ¡exploits ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 24 ¡

  25. Second ¡Insight ¡ Not ¡all ¡paths ¡are ¡equally ¡likely ¡to ¡be ¡exploitable ¡ 2/8/11 ¡ Carnegie ¡Mellon ¡University ¡ 25 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend