Buffer overflow
Buffer overflow can cause the program to crash or leak private information. A buffer in case of a running program, can be considered as a section in a computer's main memory with specific boundaries, so basically accessing any buffer outside this allocated region of memory space.
As the variables are stored together in stack/heap, accessing anything outside this boundary may cause read/write of some bytes of some other variables. But with a better understanding we can execute some attacks.
How to do it...
Follow the steps to generate an exploit code for buffer overflow attacks in Linux environment:
- We have to create a vulnerable application for the test. Create a
bof.c
file and add the following code:
#include <stdio.h> void secretFunction() { printf("Congratulations!\n"); printf("You have entered in the secret function!\n"); } void echo() { char buffer[20]; printf("Enter some text:\n"); scanf("%s", buffer); printf("You entered: %s\n", buffer); } int main...