Stack over flow for sun sparc, C/C++ Programming

Assignment Help:

Please use C or C++ to write your programs. Our homework will focus on SUN sparc machines because to exploit x86 stack-overflow is too easy. This is not just a programming assignment. In your report, you must answer all the questions listed here in the report in addition to your programs.

First you should do the following:  copy all the files

See README, attack.c and server.c. See how the program "attack" can use stack overflow to run a shell after executing the program "server." Is it fun?

Imagine that the server program is a setuid program owned by the root, then after you penetrate the program with a shell running, you become the ROOT and you can remove the whole file system if you want. So it it extremely risky to have a setuid program with stack-overflow vulnerability.

Make sure that all the programs including yours must be complied by "cc",  not "gcc".

4. In the "ass3" directory, there are two exploitable programs, server1 and server2. I have given you the source codes of server1.c and server2.c. Now you need to write programs, exploit1 and exploit2, to exploit their stack overflow vulnerabilities in server1 and server2respectively. All of your exploit programs should successfully launch a shell eventually.

You should read the articles linked from the course web page before you try to write your programs. Do not use the attack.c that I gave you because it is not flexible. Use some program in the article. Your program should be user friendly and general. I would suggest you to have at least two arguments into your program: buffersize and offset. Run your program something like exploit1buffersize offset and exploit2 buffersize offset.

You can try your program A FEW times to find out the working arguments so you can set up a working buffer to overflow the stacks for server1 and server2. After you find out what will be the working arguments from your general attack program, put the explanation in your README file and in your report. In your README file, you must let TA know how to run your programs to exploit server1, and server2. Make sure that your programs andparameters work for apache. TA will run your programs on apache.

5. Answer the following questions.

(1) Why server2 is hard to attack by buffer overflow than server1.

(2) To successfully attack server2, can the assembly shell code be put in the copy2()'s frame? Why or why not?

(3) Tell me your ideas how you layout your bu?er in terms of NOP, shell code, return addresses in order to attack server2 successfully. Tell me which return address you are to change? Is it the return address for copy2 to return to copy1 or the return address for copy1 to return to main? Or the return address for main to return to its parent?

(4)        Will the last printf in the main(): printf(" Good Bye!... ) be printed out if you successfully execute the shell program in your input buffer? Why or why not?

6. Answer the following questions.

When you try to exploit a server, the results may be one of the following three cases:

(1) The server program finishes okay.

(2) Abort with illegal instruction.

(3) Abort with bus error. Please explain the causes of each case and what action you like to do when having each case in order to successfully exploit the target server program? You should explain them in terms of bu?er size and return address, etc.

7. Socket Programming Question. You need to write a program to attack two servers: listen and listen1.

In order for you to get start more easily, I've provided a simple socket application called "listen and speak" in the assignment directory "socket". Two programs are provided. One is 2 called "listen" (and also "listen1"), and the other is called "speak". Invoke "listen" first in one machine by providing an unused port number, for example 7000, and then invoke "speak" in another machine (or THE SAME MACHINE) by providing the name of the machine running "listen" and the same port number. Then you can type some sentences from the "speak" machine. After you type return, the string you just typed in will be displayed in the "listen" machine. Study these two programs, you will know how to write socket programs.

Do the following. Open two X-windown (for example, use putty) on apache. In one window, run "listen 7000" and in another windows, run "speak apache 7000". Then you can do the same thing to run "listen1 6000" and "speak apache 6000" in another X-window.

You can see that each of listen.c and listen1 has a stack overflow vulnerability. Try to exploit it. You need to revise speak.c so the new program, called "attack",can prepare a well-crafted message and send it to listen and listen1. And then a shell should be run in listen or listen1.

Develop your program in that "socket" directory. Write README clearly; tell TA how to run your program. To make the testing easy, TA will run "listen" and "listen1" in apache and run your attack program in apache as well. Make your programs run like this

To attack "listen 7000", run your program "attack apache 7000 buffersize offset".

To attack "listen1 6000", run your program "attack apache 6000 buffersize offset".

I do not give you the complete source code of listen1.c, so it is not compliable. You, as a hacker, should try to figure out how to break it yourself.

8. SUGGESTIONS: Don't think it an easy programming. You must read article 1 and article 2 to get some ideas first. My attack.c there is NOT a good one for you to do this assignment. A program in one article there can be a good one for you to revise to finish this assignment. Check it out.

The programming must be done in SUN Sparc machines, for example, apache.

9. Make sure you have a subdirectory "socket" under directory "ass3" which contains your codes related to the socket programs.

The grading of your programs is based on the clarity, correctness, efficiency, and programming styles of your programs. Do not expect that you can get full points even your program runs correctly.

10. Make sure that your programs work in SUN machine. TAwill test your programs in that machine.

Be honest. If your program does not work, SAY SO. TA will read your programs, compile your programs and test your programs. If your program does not work but you "claim" yours works, you will have severe penalty!


Related Discussions:- Stack over flow for sun sparc

Padovan string, write a C program for padovan string for a natural number ...

write a C program for padovan string for a natural number   program 1 : package test.padovanstring; public class PadovanString {     public int stringOccurrences(int n,

What is memory allocation, What is memory allocation? Memory Allocation...

What is memory allocation? Memory Allocation : It is the method of allocating memory storage to program in such that the program can be run.

Decoding the messages, 6999066263304447777077766622337778 -----> message se...

6999066263304447777077766622337778 -----> message sent by the first smuggler. my name is robert---------> message decoded by the second smuggler. Where ‘0’ denotes the "space".

Explain syntax rules for writing constructor functions, Syntax rules for wr...

Syntax rules for writing constructor functions Its name must be similar as that of the class to which it belongs. It is declared with no return type (not even void). Ho

Flowchart, create a flowchart that display the assume that there are 3 sect...

create a flowchart that display the assume that there are 3 section each student ?

Area, write a program to find the area under the curve y=f(x) between x=a &...

write a program to find the area under the curve y=f(x) between x=a & x=b

Write a program that calculates points along a curve, write a program that ...

write a program that calculates points along a rhodonea curve.... ? int fillArray( double data[ ], int nValues, double min, double max ); o Used to fill in the theta array. Return

Array, array itself is a pinter.explain

array itself is a pinter.explain

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd