Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Stack smashing question in C . Given the following C code file, perform a stack smash on the ( vuln . c ) code file

Stack smashing question in C.
Given the following C code file, perform a stack smash on the (vuln.c) code file using a C program that you create named `exploit.c`. Your program should attempt to open up a reverse shell on the attacked program as root by exploiting the buffer (you can verify this by typing the command `whoami` on the resulting terminal). The (vuln.c) code must be compiled in its own, separate program and must not be altered from its original state.
vuln.c
#include
#include
int main(int argc, char **argv){
// Make some stack information
char a[100], b[100], c[100], d[100];
// Call the exploitable function
exploitable(argv[1]);
// Return: everything is OK
return(0);
}
int exploitable(char *arg){
// Make some stack space
char buffer[10];
// Now copy the buffer
strcpy(buffer, arg);
printf("The buffer says ..[%s/%p].
", buffer, &buffer);
// Return: everything fun
return(0);
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions