Project 8 (Buffer Overflow)

Objectives

  • Use a debugger to examine assembly code and stack memory
  • Conduct simple buffer overflow attacks against a vulnerable program from the command line

Resources

The CS department has prepared a VM for each of you to be able to use on the lab machines or your own machine. You need to be connected to the CS network to download the actual VM. Instructions

For tips on how to use GDB, here is a document detailing some of the more useful and important commands. Ignore the comments on the Bomb lab: it may become a lab later in the semester but you don't have to worry about it now.

Part 1 - This is now HW 11a

This part is intended to introduce you to the debugger, understand how to examine and update memory locations using a debugger, and gain experience with how the runtime stack is organized. A helpful way to start is to watch an introductory video on buffer overflow attacks. The following file makes a series of function calls main → freshman → sophomore → junior → senior. Compile the program and run it in the debugger, breaking somewhere in function senior. Print out all of the stack activation frames, and label as many memory locations as you can.

Not all the stack locations will be labeled. Extra space may be allocated on the stack that is set to uninitialized values that already existing in memory. Be sure to label the following elements for all four functions. You should be able to identify 1) return addresses, 2) saved frame pointers (ebp), 3) local variables, 4) function arguments. Use the “info frame” gdb command to compare the information you labeled with what the debugger reports is in each stack frame. You may print out a hard copy, write on it to label all the items, and turn in a scan of the hard copy. You may also create your result electronically. Make it easy for the TAs to grade.

  • Compile the program with the -m32 compiler option. We will use a 32-bit program for simplicity.
  • compile with -g and -m32 options to give you debugging info

Part 2

I used a collection of files based on materials found in Jon Erickson's The Art of Exploitation. Visit the following page for hints on using gdb and perl, and then try a range of options to change the flow control for a program.

  • Complete Sections A, B, C, and D in the Resources File
    • Section C - From the command line, gain access to the program without providing a legitimate password.
    • Take a screen shot of your result for Section C and submit that to Learning Suite.
    • Section D - From the command line, submit shell code to launch your own shell
    • Take a screen shot of your result for Section D and submit that to Learning Suite.
cs-465/project-8-buffer-overflow.txt · Last modified: 2017/11/11 17:10 by seamons
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0