Software Security
Dynamic analysis and fuzz testing Bhargava Shastry
- Prof. Jean-Pierre Seifert
Security in Telecommunications TU Berlin
SoSe 2016
1 / 21
Software Security Dynamic analysis and fuzz testing Bhargava - - PowerPoint PPT Presentation
Software Security Dynamic analysis and fuzz testing Bhargava Shastry Prof. Jean-Pierre Seifert Security in Telecommunications TU Berlin SoSe 2016 1 / 21 Introduction What is this lecture about? How do we find bugs in programs? ... by
1 / 21
2 / 21
3 / 21
4 / 21
1 #i n c l u d e <s t d i o . h> 2 #i n c l u d e <u n i s t d . h> 3 #i n c l u d e <s t d l i b . h> 4 #i n c l u d e <s t r i n g . h> 5 6 i n t main ( i n t argc , char ∗argv [ ] ) { 7 8 char buf [ 2 0 ] ; 9 10 while ( AFL LOOP (1000) ) { 11 memset ( buf , 0 , 20) ; 12 i f ( read (0 , buf , 19) < 0) { 13 p e r r o r ( ” read ” ) ; 14 return 1 ; 15 } 16 17 i f ( buf [ 0 ] != ’ p ’ ) 18 p r i n t f ( ” f i r s t l e t t e r i s not p\n” ) ; 19 e l s e i f ( buf [ 1 ] != ’w ’ ) 20 p r i n t f ( ” second l e t t e r i s not w\n” ) ; 21 e l s e i f ( buf [ 2 ] != ’ n ’ ) 22 p r i n t f ( ” t h i r d l e t t e r i s not n\n” ) ; 23 e l s e 24 abort () ; 25 26 p r i n t f ( ” buf c o n t a i n s %s\n” , buf ) ; 27 } 28 return 0 ; 29 } 5 / 21
1 #i n c l u d e <s t d i o . h> 2 #i n c l u d e <u n i s t d . h> 3 #i n c l u d e <s t d l i b . h> 4 #i n c l u d e <s t r i n g . h> 5 6 i n t main ( i n t argc , char ∗argv [ ] ) { 7 8 char buf [ 2 0 ] ; 9 10 while ( AFL LOOP (1000) ) { 11 memset ( buf , 0 , 20) ; 12 i f ( read (0 , buf , 19) < 0) { 13 p e r r o r ( ” read ” ) ; 14 return 1 ; 15 } 16 17 i f ( buf [ 0 ] != ’ p ’ ) 18 p r i n t f ( ” f i r s t l e t t e r i s not p\n” ) ; 19 e l s e i f ( buf [ 1 ] != ’w ’ ) 20 p r i n t f ( ” second l e t t e r i s not w\n” ) ; 21 e l s e i f ( buf [ 2 ] != ’ n ’ ) 22 p r i n t f ( ” t h i r d l e t t e r i s not n\n” ) ; 23 e l s e 24 abort () ; 25 26 p r i n t f ( ” buf c o n t a i n s %s\n” , buf ) ; 27 } 28 return 0 ; 29 }
1Pwn is a leetspeak slang term derived from the verb own, as meaning to appropriate or to conquer to gain
6 / 21
. . . i n the F a l l
1988 , t h e r e was a w i l d midwest thunderstorm . . . With the heavy rain , t h e r e was n o i s e
the ( d i a l −up ) l i n e and that n o i s e was i n t e r f e r i n g with my a b i l i t y to type s e n s i b l e commands to the s h e l l . − Prof . M i l l e r
7 / 21
8 / 21
9 / 21
10 / 21
11 / 21
1 #i n c l u d e <s t d i o . h> 2 #i n c l u d e <u n i s t d . h> 3 #i n c l u d e <s t d l i b . h> 4 #i n c l u d e <s t r i n g . h> 5 6 i n t main ( i n t argc , char ∗argv [ ] ) { 7 8 . . . 9 . . . 10 11 i f ( buf [ 0 ] != ’ p ’ ) 12 // buf [ 0 ] != ’ p ’ 13 p r i n t f ( ” f i r s t l e t t e r i s not p\n” ) ; 14 e l s e i f ( buf [ 1 ] != ’w ’ ) 15 // buf [ 0 ] == ’ p ’ && buf [ 1 ] != ’w ’ 16 p r i n t f ( ” second l e t t e r i s not w\n” ) ; 17 e l s e i f ( buf [ 2 ] != ’ n ’ ) 18 // buf [ 0 ] == ’ p ’ && buf [ 1 ] == ’w ’ && buf [ 2 ] != ’ n ’ 19 p r i n t f ( ” t h i r d l e t t e r i s not n\n” ) ; 20 e l s e 21 // buf [ 0 ] == ’ p ’ && buf [ 1 ] == ’w ’ && buf [ 2 ] == ’ n ’ 22 abort () ; 23 24 . . . 25 . . . 26 } 12 / 21
13 / 21
14 / 21
15 / 21
16 / 21
17 / 21
18 / 21
19 / 21
20 / 21
21 / 21