Consider the following C program:
Q1. Mount buffer overflow attack on the given program and corrupt the variable “check” with the value 25.Code:void func(char * str) { char buff[16]; strcpy(buff,str); } void main(int argc, char * argv[]) { int check = 1; func(argv); if(check == 1) { printf(“check should be 1 (%d)\n”,check); } else { Printf(“check should not be 1 (%d)\n”,check); } }
After the buffer overflow attack the output of the program should be the following:
check should not be 1 (25)
Q2. Mount buffer overflow attack on the given program and bypass the “if” condition.
After the buffer overflow attack the output of the program should be the following:
check should not be 1 (1)
Q3. Increase the size of the buffer “buff” to as much as you want. Mount a buffer overflow attack and make the program execute a shell (“/bin/bash”).



LinkBack URL
About LinkBacks



