CS 208 s20 — Reverse Engineering with gdb

Table of Contents

Note: I say in the video your bomb for lab 2 will be emailed---they are available at a customized URL instead. See the lab writeup for instructions

1 Intro, Register Background, GDB basics

Watch the first 16 minutes of the video for an intruction and background material.

2 Follow Along

Follow along with next 21 minutes of the video going through activity parts 1 and 2

3 Activity 3

Activity 3 has a Bomb Lab feel to it. It will print out "good args!" if you type in the right numbers into the command line. Use GDB to find what numbers to use, and if you get stuck, look at the walkthrough in the video or the slides.

$ cat act3.c        // display the source code of act3
$ gdb act3

Q. Which register holds the return value from a function? (Hint: Use disassemble in main and look at what register is used right after the function call to compare)

4 Activity 4

Use what you have learned to get act4 to print "Finish."

The source code is available in act4.c if you get stuck. The video contains a walkthrough, as do the slides. Also, you can ask on Slack for help understanding the assembly code.

5 Tips

The GDB and lab 2 tips section of the video will probably be most useful when you're starting lab 2.

6 Video

7 Homework

  1. Work on activity parts 3 and 4 on your own before watching those parts of the video
  2. Both the Week 3 quiz and lab 1 are tonight 9pm (April 29)