Lab 2: Buffer Overflows
Fengwei Zhang
SUSTech CS 315 Computer Security 1
Lab 2: Buffer Overflows Fengwei Zhang SUSTech CS 315 Computer - - PowerPoint PPT Presentation
Lab 2: Buffer Overflows Fengwei Zhang SUSTech CS 315 Computer Security 1 Buffer Overflows One of the most common vulnerabilities in software Programming languages commonly associated with buffer overflows including C and C++
SUSTech CS 315 Computer Security 1
SUSTech CS 315 Computer Security 2
SUSTech CS 315 Computer Security 3
SUSTech CS 315 Computer Security 4
SUSTech CS 315 Computer Security 5
SUSTech CS 315 Computer Security 6
Stack Heap Data Segment Text Segment High memory Low memory
SUSTech CS 315 Computer Security 7
Kernel Space Stack Heap BSS Segment Data Segment Text Segment (ELF) 1GB 3GB Local variable: int a Function malloc() Uninitialized static variables: static char *u static char *s = “Hello world” Binary of the program
SUSTech CS 315 Computer Security 8
SUSTech CS 315 Computer Security 9
SUSTech CS 315 Computer Security 10
3 2 Ret Address EBP C High memory Low memory ESP int add (int a, int b) { int c; c = 1+b; return c; }
SUSTech CS 315 Computer Security 11
SUSTech CS 315 Computer Security 12
(A) str(A) Ret addr(A) EBP(A) A A A A A A High memory Low memory ESP
SUSTech CS 315 Computer Security 13
SUSTech CS 315 Computer Security 14
SUSTech CS 315 Computer Security 15
(A) str(A) Ret addr(A) EBP(A) Canary(A) A A A A A High memory Low memory ESP
SUSTech CS 315 Computer Security 16
SUSTech CS 315 Computer Security 17