CS 367 - 002, Spring 2010
Lab 1: Defusing a Binary Bomb
Due: Sunday, 3/21 (11:59 pm)

You may work in a group of up to two people on this assignment; HOWEVER, each student have their own personalized bomb. This is to prevent the situation where one student is doing all/most of the work (and hence, all/most of the learning). While each bomb is unique, the phases follow basic patterns - defusing the second bomb should take much less effort.

Introduction

The nefarious Dr. Evil has planted a slew of "binary bombs" on our machines. A binary bomb is a program that consists of a sequence of phases. Each phase expects you to type a particular string on stdin. If you type the correct string, then the phase is defused and the bomb proceeds to the next phase. Otherwise, the bomb explodes by printing "BOOM!!!" and then terminating. The bomb is defused when every phase has been defused.

Step 1: Get Your Bomb

Each student will attempt to defuse their own personalized bomb. Each bomb is a Linux binary executable file that has been compiled from a C program. To obtain your bomb, you need to be able to connect to the machine zeus.ite.gmu.edu. This machine is behind a firewall. You can access it from a machine on campus, e.g. from any of the dual-boot PCs in the IT&E labs or from a machine off-campus. To access zeus.ite.gmu.edu from off-campus, you can ssh to mason.gmu.edu and then ssh to zeus.ite.gmu.edu, or use can install VPN software and set up the VPN as described at:

http://labs.ite.gmu.edu/reference/faq_iteaccount.htm#home

This installation procedure is quite straightforward.

Once you are able to connect to zeus.ite.gmu.edu, one (and only one) of the group members should point your Web browser to the bomb request daemon at

http://zeus.ite.gmu.edu:15213

Fill out the HTML form with the email addresses and names of your team members, and then submit the form by clicking the "Submit" button. The request daemon will build your bomb and return it immediately to your browser in a tar file called bombk.tar, where k is the unique number of your bomb. Note that a team of two students will have to do this process twice to get two bombs.

Save the bombk.tar file to a (protected) directory in which you plan to do your work. Then give the command:

tar -xvf bombk.tar.

This will create a directory called ./bombk with the following files:

We have given you two versions of the bomb. The program bomb-zeus will only run on zeus.ite.gmu.edu. When you defuse a phase of the bomb (as described below), the program notifies the instructor. To receive a grade for this assignment, you must defuse bomb-zeus. However, each time your bomb explodes on zeus.ite.gmu.edu it notifies the instructor , and you lose 1 point (up to a max of 10 points) in the final score for the lab. So there are consequences to exploding the bomb on zeus.ite.gmu.edu. You must be careful!

For your convenience, we have also given you a "quiet" version of the bomb that does not communicate with the instructor. This bomb will run on any LinuxPC. We recommend that you first figure out how to defuse bomb-quiet. The same input strings will also defuse bomb-zeus. Also, if you make any kind of mistake requesting a bomb (such as neglecting to save it or typing the wrong group members), simply request another bomb.

Step 2: Defuse Your Bomb

Your job is to defuse the bomb. You can use many tools to help you with this; please look at the hints section for some tips and ideas. The best way is to use your favorite debugger to step through the disassembled binary.

Each phase is worth 10 points, for a total of 60 points. Remember that each time your bomb explodes it notifies the instructor, and you lose 1 point (up to a max of 10 points) in the final score for the lab. So there are consequences to exploding the bomb on zeus. The phases get progressively harder to defuse, but the expertise you gain as you move from phase to phase should offset this difficulty. However, the last phase will challenge even the best students, so please don't wait until the last minute to start.

The bomb ignores blank input lines. If you run your bomb with a command line argument, for example,

linux> ./bomb psol.txt

then it will read the input lines from psol.txt until it reaches EOF (end of file), and then switch over to stdin. We added this feature so you don't have to keep retyping the solutions to phases you have already defused.

To avoid accidentally detonating the bomb, you will need to learn how to single-step through the assembly code and how to set breakpoints. You will also need to learn how to inspect both the registers and the memory states. One of the nice side-effects of doing the lab is that you will get very good at using a debugger. This is a crucial skill that will pay big dividends the rest of your career.

Hand-In

There is no explicit hand-in. The bomb will notify your instructor automatically after you have successfully defused it on zeus.ite.gmu.edu. You can keep track of how you (and the other groups) are doing by looking at

http://hermes-web.ite.gmu.edu/~cs367/bomb-status.html

This web page is updated continuously to show the progress of each group.

Note that this web page is only accessible from a machine in the IT&E labs or if you have connected to the IT&E labs using the VPN software.

Hints (Please read this!)

There are many ways of defusing your bomb. You can examine it in great detail without ever running the program, and figure out exactly what it does. This is a useful technique, but it is not always easy to do. You can also run it under a debugger, watch what it does step by step, and use this information to defuse it. This is probably the fastest way of defusing it. You may not modify your bomb in any way to defuse it

We make one request; please do not use brute force! You could write a program that will try every possible key to find the right one. But this is no good because we haven't told you how long the strings are, nor have we told you what characters are in them. Even if you made the (wrong) assumptions that they all are less than 80 characters long and only contain letters, then you will have 2680 guesses for each phase. This will take a long time to run, and you will not get the answer before the assignment is due.

There are many tools which are designed to help you figure out both how programs work, and what is wrong when they don't work. Here is a list of some of the tools you may find useful in analyzing your bomb, and hints on how to use them.

Looking for a particular tool? How about documentation? Don't forget, the command man is your friend. In particular, man ascii might come in useful. The web may also be a treasure trove of information.