Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//Lab 1 - Task 4 #include int main (int argc, char** argv) { const int magic = 80; const char secret[] = x44x45x46x41x43x45x44; char buf[128];

//Lab 1 - Task 4

#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; }

For this question we will be using the above code. The purpose of this question is to exploit a format string vulnerability to read and write arbitrary memory. Compile the above code into binary form using GCC. In order to successfully exploit the vulnerability you need to perform the following steps: Find the offset from ESP that stores the address of the variable you want to read/write Determine how many 4-byte chunks on the stack you need to traverse to get to your desired address Craft an appropriate format string to perform the stack traversal and read/write of your desired address Use the Python command $(python c print

+ %08x-* + %s/%n to read/write respectively 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

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

What is Centrifugation?

Answered: 1 week ago

Question

To find integral of ?a 2 - x 2

Answered: 1 week ago

Question

To find integral of e 3x sin4x

Answered: 1 week ago

Question

To find the integral of 3x/(x - 1)(x - 2)(x - 3)

Answered: 1 week ago

Question

What are Fatty acids?

Answered: 1 week ago