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
Get step-by-step solutions from verified subject matter experts
