Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The C programs ( given below ) should be compiled and executed in a Linux environment. In addition, 3 2 - bit binaries can be
The C programs given below should be compiled and executed in a Linux environment. In addition, bit binaries can be used and turn off the stack protections. Note that, although you can use gdb to help analyse the memory and instructions, your exploitation must work under the normal shell not inside gdb
The C program boc below takes a password from users, but never lets any user log in
Task : Pointing out the statement in the program that has a buffer overflow vulnerability and Have to explain why it may cause a buffer overflow attack.
Task : Figuring out a password to make the program output "You are logged in without modifying the return address. Have to explain in detail how the password works.
Task : Figuring out a password to make the program output "You are logged in by modifying the return address. Have to explain in detail how the password works.
Task : Have to explain how you can fix the buffer overflow vulnerability in the program.
Task : Figure out a way to defeat ASLR Address Space Layout Randomisation and still complete Task Have to explain the answer. To turn on ASLR, you must run the following command and compile the program without the option nopie'.
"echo sudo tee procsyskernelrandomizevaspace
gcc w mg fnostackprotector z execstack o bo boc
Figuring out a way to defeat ASLR and still complete Task Have to explain your answer.
The boc C program
#include
char getPasswd
int trigger F;
char passwd;
getspasswd;
return chartrigger;
void login
printfYou are logged in
;
exit;
void main
printfPlease enter password: ;
if getPasswdT
login;
else
printfThe password is incorrect.
;
exit;
The C program fsc given below is a slightly modified version of the previous program, which also never lets any user log in
Task : Pointing out the statement in the program that has a format string vulnerability and have to explain why it may cause a format string attack.
Task : Figuring out a password to reveal the contents on the current stack frame in hexadecimal format with width for example, c should be displayed as c Have to explain in detail how the password works.
Task : Figure out a password to launch a simple DoS Denial of Service attack. Have to explain in detail how the password works.
Task : Figure out a password to make the program output "You are logged in Have to explain in detail how the password works.
Task : Have to explain how you can fix the format string vulnerability in the program.
The fsc C program
#include
char passwd;
char getPasswd
int trigger F;
int t &trigger;
fgetspasswd sizeofpasswd stdin;
printfPassword is ;
printfpasswd;
return chart;
void main
printfPlease enter password: ;
if getPasswdT
printfYou are logged in
;
exit;
else
printfThe password is incorrect.
;
exit;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started