Static analysis for exploitable vulnerability detection
Marie-Laure Potet
VERIMAG University of Grenoble
September 2014
Static analysis for exploitable vulnerability detection 1/43
Static analysis for exploitable vulnerability detection Marie-Laure - - PowerPoint PPT Presentation
Static analysis for exploitable vulnerability detection Marie-Laure Potet VERIMAG University of Grenoble September 2014 Static analysis for exploitable vulnerability detection 1/43 Outline 1 Context Vulnerability detection process Static
Static analysis for exploitable vulnerability detection 1/43
Static analysis for exploitable vulnerability detection 2/43
Static analysis for exploitable vulnerability detection 3/43
Static analysis for exploitable vulnerability detection 4/43
1 Identification of flaws
2 Possibility of exploit (exploitability)
3 Building an real exploit
Static analysis for exploitable vulnerability detection 5/43
1 Flaw: buffer overflow if no 0 in the first four characters 2 Poc : control flow hijacking if the return address is erased 3 Weaponized exploit : DEP (→ ROP), ASLR (→ address
Static analysis for exploitable vulnerability detection 6/43
Static analysis for exploitable vulnerability detection 7/43
Static analysis for exploitable vulnerability detection 8/43
Static analysis for exploitable vulnerability detection 9/43
Static analysis for exploitable vulnerability detection 10/43
Static analysis for exploitable vulnerability detection 11/43
Static analysis for exploitable vulnerability detection 12/43
Static analysis for exploitable vulnerability detection 13/43
Static analysis for exploitable vulnerability detection 14/43
Static analysis for exploitable vulnerability detection 15/43
1 2 typedef struct { 3 void (*f)(void); 4 } st; 5 6 void nothing () 7 { 8 printf("Nothing\n"); 9 } 10 11 int main(int argc , char * argv []) 12 { 13 st *p1; 14 char *p2; 15 p1=(st*) malloc(sizeof(st)); 16 p1 ->f=& nothing; 17 free(p1); // p1 freed 18 p2=malloc(strlen(argv [1])); // possible re -allocation 19 strcpy(p2 ,argv [1]); 20 p1 ->f(); // Use 21 return 0; 22 } Static analysis for exploitable vulnerability detection 16/43
2,008 2,009 2,010 2,011 2,012 2,013 50 100 150 200 Years Number of CVE related to UaF Broswer Other
https://web.nvd.nist.gov/view/vuln/search, 4 june 2013 Static analysis for exploitable vulnerability detection 17/43
Static analysis for exploitable vulnerability detection 18/43
Static analysis for exploitable vulnerability detection 19/43
Static analysis for exploitable vulnerability detection 20/43
Static analysis for exploitable vulnerability detection 21/43
Static analysis for exploitable vulnerability detection 22/43
1 typedef struct { 2 void (*f)(void); 3 } st; 4 5 int main(int argc , char * argv []) 6 { 7 st *p1; 8 char *p2; 9 p1=(st*) malloc(sizeof(st)); 10 free(p1); 11 p2=malloc(sizeof(int)); 12 strcpy(p2 ,argv [1]); 13 p1 ->f(); 14 return 0; 15 }
9 : p1=(st*) malloc(sizeof(st)) (Init(EBP), -4) → {chunk0},. . . HA = {chunk0} HF = ∅ 10 : free(p1) (Init(EBP), -4) → {chunk0},. . . HA = ∅ HF = {chunk0} 11 : p2=malloc(sizeof(int)) (Init(EBP), -4) → {chunk0}, (Init(EBP), -8) → {chunk1} HA = {chunk1},. . . HF = {chunk0} Static analysis for exploitable vulnerability detection 23/43
Static analysis for exploitable vulnerability detection 24/43
Static analysis for exploitable vulnerability detection 25/43
Static analysis for exploitable vulnerability detection 26/43
1 Determine paths where new allocations take place between
2 Determine if some allocations can reallocate the same memory
3 Is the size of new allocations a tainted value? Is the content
4 How is the AccessHeap used: a read, write or jump patterns? Static analysis for exploitable vulnerability detection 27/43
Static analysis for exploitable vulnerability detection 28/43
9 : p1=(st*) malloc(sizeof(st)) HA = {(heap0, 4)} HF =<> 10 : free(p1) HA = ∅ HF =< (heap0, 4) > 11 : p2=malloc(sizeof(int)) HA = {(heap0, 4)} HF =<> Static analysis for exploitable vulnerability detection 29/43
1 2 typedef struct { 3 void (*f)(void); 4 } st; 5 6 void nothing () 7 { 8 printf("Nothing\n"); 9 } 10 11 int main(int argc , char * argv []) 12 { 13 st *p1; 14 char *p2; 15 p1=(st*) malloc(sizeof(st)); 16 p1 ->f=& nothing; 17 free(p1); 18 p2=malloc(strlen(argv [1])); // size is tainted 19 strcpy(p2 ,argv [1]); // content of p2 is tainted 20 p1 ->f(); // Access as a jump 21 return 0; 22 } Static analysis for exploitable vulnerability detection 30/43
Static analysis for exploitable vulnerability detection 31/43
Static analysis for exploitable vulnerability detection 32/43
Static analysis for exploitable vulnerability detection 33/43
Static analysis for exploitable vulnerability detection 34/43
Static analysis for exploitable vulnerability detection 35/43
Static analysis for exploitable vulnerability detection 36/43
Static analysis for exploitable vulnerability detection 37/43
Static analysis for exploitable vulnerability detection 38/43
Static analysis for exploitable vulnerability detection 39/43
Static analysis for exploitable vulnerability detection 40/43
Static analysis for exploitable vulnerability detection 41/43
Sofia Bekrar, Chaouki Bekrar, Roland Groz, and Laurent Mounier. A taint based approach for smart fuzzing. In Giuliano Antoniol, Antonia Bertolino, and Yvan Labiche, editors, Proceedings of SecTest, pages 818–825, 2012. Josselin Feist, Laurent Mounier, and Marie-Laure Potet. Statically detecting use-after-free on binary code. Journal of Computer Virology and Hacking Techniques, online article, January 2014. Gustavo Grieco, Laurent Mounier, Marie-Laure Potet, and Sanjay Rawat. A stack model for symbolic buffer overflow exploitability analysis. In Proceedings of CSTVA (ICST Workshop), pages 216–217, Luxembourg, march 2013. IEEE. Guillaume Jeanne. G´ en´ eration automatique d’exploits ` a partir de traces d’erreurs. MR Grenoble INP, september 2014. Marie-Laure Potet, Josselin Feist, and Laurent Mounier. Analyse de code et recherche de vuln´ erabilit´ es. Revue MISC, hors-s´ erie, juin 2014. Marie-Laure Potet, Laurent Mounier, Maxime Puys, and Louis Dureuil. Lazart: A symbolic approach for evaluation the robustness of secured codes against control flow injections. In IEEE Seventh International Conference on Software Testing, Verification and Validation, ICST 2014, March 31 2014-April 4, 2014, Cleveland, Ohio, USA, pages 213–222, 2014. Sanjay Rawat, Dumitru Ceara, Laurent Mounier, and Marie-Laure Potet. Combining static and dynamic analysis for vulnerability detection. MDV’10, Modeling and Detecting Vulnerabilities workshop, associated to ICST 2010, IEEE digital Library, 2010. Static analysis for exploitable vulnerability detection 42/43
Sanjay Rawat and Laurent Mounier. Offset-aware mutation based fuzzing for buffer overflow vulnerabilities: Few preliminary results. In Proc. of The Second International Workshop on Security Testing (SECTEST). IEEE, 2011. Sanjay Rawat and Laurent Mounier. Finding buffer overflow inducing loops in binary executables. In Proceedings of Sixth International Conference on Software Security and Reliability (SERE), pages 177–186, Gaithersburg, Maryland, USA, 2012. IEEE. Sanjay Rawat, Laurent Mounier, and Marie-Laure Potet. LiSTT: An investigation into unsound-incomplete yet practical result yielding static taintflow analysis. In Proceedings of SAW 2014 (ARES Workshop), Fribourg (Switzerland), September 2014. IEEE. Static analysis for exploitable vulnerability detection 43/43