Question: Use the SEED VM ( this lab is from SEED and has been slightly modified ) gcc - z execstack - o vul _ prog

Use the SEED VM (this lab is from SEED and has been slightly modified)
gcc -z execstack -o vul_prog Lab8.c
sudo chown root vul_prog
sudo chmod +s vul_prog
Do the following successfully using a string format vulnerability
Crash program
Print secret value secret
Modify secret value secret
Modify secret value secret with a predetermined value 0x42454546
Get a root shell
Even/*vul_prog.c*/
#include
#include
#define SECRET 0x44
void vulfunc(char *user_input){
int secret;
int a, b, c, d; /*other variables, not used here.*/
/*getting the secret*/
secret = SECRET;
printf("The variable secrets address is 0x%8x
",(unsigned int)&secret);
printf("The variable secrets value is 0x%x or %d
",(unsigned int)secret, secret);
/*Vulnerable place*/
printf(user_input);
printf("
");
/*Verify whether your attack is successful*/
printf("The original secret: 0x%x or %d
", SECRET, SECRET);
printf("The new secret: 0x%x or %d
", secret, secret);
return;
}
int main(int argc, char*argv[]){
FILE *badfile;
char str[200];
badfile = fopen("vulfile","rb");
fread(str, sizeof(char),200, badfile);
vulfunc(str);
return 1;
} if you cant get a shell, I want to see all the steps you did

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!