its

CSCI 2330
Introduction to Systems

Bowdoin College
Spring 2016
Instructor: Sean Barker

Project 2 - Bowdoin BitBombs

This project should be completed individually.

This project will give you experience with x86-64 machine code, application reverse-engineering, and the use of a low-level debugger (gdb). You will do this by defusing a BitBomb planted on the class server!

Start by reading through the entire project description!

Project Overview

Agents of the nefarious organization BitBombs Inc. have infiltrated the CSCI 2330 server and planted a set of BitBombs on our machine. A BitBomb is a compiled executable program that consists of a sequence of phases, each of which is wired to explode and wreak havoc on our bits. Luckily, each bitbomb contains a failsafe mechanism - if a particular code is entered for each phase of the bitbomb, the bitbomb will be harmlessly defused. However, if an incorrect code is entered for any phase, the bitbomb will immediately explode.

There are too many bitbombs for your instructor to handle, so each of you will be provided a bitbomb to defuse. Your task is to defuse the bitbomb before the due date (at which point all remaining bitbombs will explode). Good luck - we are counting on you!

BitBomb Files

Each of you have a set of files pertaining to your bitbomb that have been checked into your SVN directory under proj2. First, run svn update within your directory to download these files. Within the proj2 directory, there are several key files:

BitBomb Handling

Note: You can execute the bitbomb ONLY on the class server. Attempting to execute it elsewhere will immediately detonate the bitbomb!

To run the bitbomb, you can execute it directly:

$ ./bitbomb

When run, the bitbomb will wait for you to enter a defusal code, which will be passed to the current phase. If the code is correct, the phase will be defused and you will be prompted to enter the code for the next phase. If the code is incorrect, the bitbomb will explode. Note: Rumor has it that your instructor will be automatically notified of bitbomb explosions. Don't blindly execute your bitbomb!

Once you have determined one or more defusal codes, to avoid having to re-enter the codes each time you run the bitbomb, you should enter your codes in codes.txt, one phase per line. Then, you can pass this file to your bitbomb when you execute it to automatically feed it your codes:

$ ./bitbomb codes.txt

Once all the codes from codes.txt have been given to the bitbomb, it will switch over to prompting for defusal codes as normal.

To avoid accidentally setting off the bitbomb, you will need to learn how to step through the assembly code, examine the state of the program, and set breakpoints using a debugger. Learning to use a debugger will be an extremely useful skill both in defusing your bitbomb and beyond!

To run the bitbomb using the debugger gdb, you can do the following:

$ gdb bitbomb
... startup messages from gdb ...
(gdb) run codes.txt

See the tools and advice section below for more tips on defusing your bitbomb and using gdb.

Logistics

You are responsible for two tasks:

You should organize your descriptions by phase (i.e., each phase should have a code and a corresponding description). Each description should be a short paragraph or two describing what the phase is doing with your input (to the best of your understanding), and how you determined the correct input. While your description should be detailed enough to convey your understanding, you should not go as far as giving a line-by-line explanation of the assembly commands.

As usual, your final submission will consist of your committed files at the time of the due date, as well as the automatically submitted results of executing your bitbomb.

Evaluation

You will be evaluated both on determining the correct defusal codes for each phase, as well as clearly documenting your methods and insights during reverse-engineering in descriptions.txt. Points for each phase are described below (of which roughly half will be from your solution and half from your description):

Partial credit is possible on unsolved phases for clear documentation that demonstrates effort and some understanding of the phase. However, repeated detonations of your bitbomb may have a negative impact on your total score.

Lastly, unconfirmed rumors report that each bitbomb may have a secret phase 111...

Tools

There are many approaches you can take to defusing your bitbomb. You can examine your bitbomb in great detail without ever executing it to figure out how it works. While useful, this is not always straightforward. You can also execute the bitbomb using a debugger to run it step by step and examine the state of the machine along the way (while also giving you a chance to bail out before it explodes!). A mix of these two approaches is probably most efficient.

First, you should not use brute force to defuse your bitbomb! While you could theoretically write a program to try many defusal codes on your bitbomb, this is a bad idea for several reasons. One, the number of possibilities is so large that you are unlucky to solve your bitbomb using this approach. Two, a brute force approach will not allow you to write a very good description of your reverse engineering approach. Three, exploding your bitbomb repeatedly is hazardous to your score (as well as our bits)!

There are many tools that are designed to help you figure out how programs work and what is wrong when they do not work. You are likely to find the following tools helpful in particular:

If you encounter x86-64 assembly instructions with which you are not familiar, you can consult the textbook, Google, or go right to the source and check the the official Intel architecture manuals. Remember when consulting references that we're using x86-64, not the 32-bit x86 (aka IA32).

Tips and Advice