Overflow in Motion
Demonstrate how a simple buffer overflow vulnerability in a C program can be used to manipulate the value of an adjacent variable in memory without directly modifying it in code
#include <stdio.h>
#include <string.h>
int main() {
char buffer[8];
int flag = 0;
printf("Enter some input: ");
gets(buffer);
if (flag == 1) {
printf("Buffer overflow successful! 🎉\n");
} else {
printf("Try again. Flag is still %d.\n", flag);
}
return 0;
}Understanding the Code
But here’s the problem:
⚠️ Whygets()Is Unsafe (and Useful Here)
Compiling and Running the Code
What This Does:

🧨 Now Let’s Exploit the Vulnerability

🧠 What Just Happened?
Last updated