githubEdit

Buffer Overflow

Overview

Buffer overflows occur when a program writes more data to a buffer than it can hold, overwriting adjacent memory. This can lead to crashes, data corruption, or arbitrary code execution.

Types of Buffer Overflows

Stack-Based Buffer Overflow

+------------------+  High Memory
|   Command Args   |
+------------------+
|  Environment     |
+------------------+
|     Stack        |  <- Grows downward
|  +------------+  |
|  | Local Vars |  |
|  +------------+  |
|  | Saved EBP  |  |
|  +------------+  |
|  | Return Addr|  |  <- TARGET
|  +------------+  |
|  | Parameters |  |
|  +------------+  |
+------------------+
|      Heap        |  <- Grows upward
+------------------+
|      BSS         |
+------------------+
|      Data        |
+------------------+
|      Text        |
+------------------+  Low Memory

Heap-Based Buffer Overflow

Finding Buffer Overflows

Fuzzing

Pattern Creation

GDB Analysis

Exploitation Techniques

Classic Return Address Overwrite

Return to Shellcode

Return to libc (ret2libc)

Return Oriented Programming (ROP)

64-bit Exploitation

Bypassing Protections

ASLR Bypass

Stack Canary Bypass

NX/DEP Bypass

PIE Bypass

Format String Attacks

Windows Buffer Overflows

Finding Bad Characters

JMP ESP Technique

SEH Overwrite

Egghunter

Useful Tools

Debugging Commands

Practice Resources

Last updated

Was this helpful?