Question
#include int main (int argc, char** argv) { const int magic = 80; const char secret[] = x44x45x46x41x43x45x44; char buf[128]; sprintf(buf, argv[1]); if (magic !=
#include
int main (int argc, char** argv) { const int magic = 80; const char secret[] = "\x44\x45\x46\x41\x43\x45\x44"; char buf[128]; sprintf(buf, argv[1]); if (magic != 80) printf("GREAT SUCCESS! "); printf(buf); printf(" "); return 0; }
Compile above code into binary form using GCC.
Question 4.1 Construct a Format String exploit to read the contents of secret[]. Provide a screenshot showing successful output including your exploit string.
Question 4.2 Construct a Format String exploit to change the value of magic such that the program prints GREAT SUCCESS! Provide a screenshot showing successful output including your exploit string.
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