Docsity

Project on Programming Malware and Software Vulnerability Analysis | CAP 6135, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
CAP6135: Programming Project 1 (Spring 2009)
Delivery:
Put your source code (exploit.c) and 1 page document explaining what you did in a zip
file and send to our TA Juraj Obert at: [email protected]. Please put your email title as:
CAP6135: project 1 firstname.lastname
Problem: Stack overflow attack
In order to complete this assignment, you need write a program to obtain a shell by
exploiting stack overflow vulnerability of a given target application.
This project is modified from the programming project 1 in Dr. Dawn Song’s course
“CS161: computer security” in Fall 2008:
http://inst.eecs.berkeley.edu/~cs161/fa08/
Target
The target (target.c) is a simple application which copies the command-line parameter
into its own internal buffer stored on the stack. The source code is provided for your
reference. Of course you can build your own target while working on the assignment, but
the submitted code MUST use the prebuilt version.
Exploit
The exploit is the application (exploit.c) which calls the target (executable program) and
passes in an artfully crafted character buffer which causes the target to give you a shell.
The compressed file: “assignment1.tgz” contains two directory: exploits and target. You
will need to generate the executable “target” first. Then you will need to modify
“exploit.c” to add your overflow code. Noted that you will need to modify:
#define TARGET "/home/jobert/cap6135/1/proj1-fa08/targets/target"
to use your own “target” directory.
You can download the compressed file “assignment1.tgz” from webcourse@UCF at the
first assignment place.
The following are the suggested steps to complete this assignment:
1. Read the “Smashing The Stack for Fun and Profit” tutorial at
http://doc.bughunter.net/buffer-overflow/smash-stack.html
2. Make sure you understand it.
3. Familiarize yourself with gdb. You will need gdb to debug your target/exploit and
display memory/stack information. With it help, you can decide the where is the return
address to overwrite and how to jump to execute the provided shellcode. Look up
commands: break, run, continue, info f, p/x, backtrace, attach…
pf2

Partial preview of the text

Download Project on Programming Malware and Software Vulnerability Analysis | CAP 6135 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

CAP6135: Programming Project 1 (Spring 2009)

Delivery: Put your source code (exploit.c) and 1 page document explaining what you did in a zip file and send to our TA Juraj Obert at: [email protected]. Please put your email title as:

CAP6135: project 1 firstname.lastname

Problem: Stack overflow attack

In order to complete this assignment, you need write a program to obtain a shell by exploiting stack overflow vulnerability of a given target application.

This project is modified from the programming project 1 in Dr. Dawn Song’s course “CS161: computer security” in Fall 2008: http://inst.eecs.berkeley.edu/~cs161/fa08/

Target The target (target.c) is a simple application which copies the command-line parameter into its own internal buffer stored on the stack. The source code is provided for your reference. Of course you can build your own target while working on the assignment, but the submitted code MUST use the prebuilt version.

Exploit The exploit is the application (exploit.c) which calls the target (executable program) and passes in an artfully crafted character buffer which causes the target to give you a shell.

The compressed file: “assignment1.tgz” contains two directory: exploits and target. You will need to generate the executable “target” first. Then you will need to modify “exploit.c” to add your overflow code. Noted that you will need to modify: #define TARGET "/home/jobert/cap6135/1/proj1-fa08/targets/target" to use your own “target” directory.

You can download the compressed file “assignment1.tgz” from webcourse@UCF at the first assignment place.

The following are the suggested steps to complete this assignment:

  1. Read the “Smashing The Stack for Fun and Profit” tutorial at http://doc.bughunter.net/buffer-overflow/smash-stack.html
  2. Make sure you understand it.
  3. Familiarize yourself with gdb. You will need gdb to debug your target/exploit and display memory/stack information. With it help, you can decide the where is the return address to overwrite and how to jump to execute the provided shellcode. Look up commands: break, run, continue, info f, p/x, backtrace, attach…
  1. Draw the stack (locations of parameters, local variables and registers) of the target application once execution reaches the first statement of the foo function.
  2. Figure out the length of the exploit buffer.
  3. Figure out where in the exploit buffer the new RET address will go.
  4. Compute the new RET address. The code to spawn a shell is provided in the shellcode.h file. You can use testshellcode to test it.

Important notes: Olympus.eecs.ucf.edu (the server you’ll be working on) employs a technique called “Stack address randomization”, which randomizes the beginning of the stack for each new process. Therefore your SP register will always be different when you start a new process. This behavior is not desirable for this assignment, because we want the SP to be the same every time we execute the exploit/target (see the aforementioned tutorial for why this is so important).

The way around this is by using the wrapper setarch in the following way: jobert@olympus:~/cap6135/1/proj1-fa08/exploits$ setarch i686 -R ./exploit The –R parameter disables stack address randomization and creates a new process by executing ./exploit.

Grading: [+10%] if your program compiles and runs [+10%] if your program can successfully overflow the buffer [+10%] for correctly showing how you use gdb to obtain the stack information. [+10%] for correct drawing of the stack (in the document) with the addresses. [+60%] if execution of target gives the user a shell

[-20%] if you submitted your project late (no late submission will be accepted after Feb. 19 th).