Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute the CMU binary bomb in Ubuntu Linux?

I'm trying to do CMU's binary bomb as an independent project to learn some x86 Assembly and reverse engineering. (It's not an auto-graded version tied to a class.)

I downloaded bomb.tar from http://csapp.cs.cmu.edu/public/labs.html.

From CMU's lab description:

A "binary bomb" is a program provided to students as an object code file. When run, it prompts the user to type in 6 different strings. If any of these is incorrect, the bomb "explodes," printing an error message and logging the event on a grading server. Students must "defuse" their own unique bomb by disassembling and reverse engineering the program to determine what the 6 strings should be. The lab teaches students to understand assembly language, and also forces them to learn how to use a debugger. It's also great fun. A legendary lab among the CMU undergrads.

Here's a Linux/IA32 binary bomb that you can try out for yourself. The feature that notifies the grading server has been disabled, so feel free to explode this bomb with impunity.

After saving it into an appropriate folder I ran this command in the Terminal:

tar xvf bomb.tar
  1. It did extract a file called bomb (no file extension), but I thought it would also give me bomb.c, which would also be helpful for reference.

  2. I can't get "bomb" to run. Here's what I've tried:

    bomb
    bomb: command not found
    
    ./bomb
    bash: ./bomb: No such file or directory
    
  3. While I realize solving it requires stepping through it in gdb, I can't even run it in BASH and blow myself up with wrong answers yet! A little help would be fantastic.

like image 373
Seaver Avatar asked Oct 18 '14 05:10

Seaver


2 Answers

As the other answers have suggested, this appears to a CPU architecture compatibility issue. I was able to resolve this on Ubuntu 15.04 64-bit by installing the packages located at AskUbuntu.com How to run 32-bit programs on a 64-bit system [duplicate]

Specifically, the following command helped.

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
like image 126
gluxon Avatar answered Sep 29 '22 21:09

gluxon


Since Fabio A. Correa ran file on the bomb and found out that it was a 32-bit LSB executable, it seems that is is caused by some missing LSB scripts which should be loaded at startup.

Simply running sudo apt-get install lsb-core will fix this. After doing so, ldd bomb will also work.

Update:

Further ldd (after getting the LSB things ready) shows that it is actually caused by some inexist libc.so.6 => /lib32/libc.so.6, which is the libc of the i386 architecture. You can try installing the libc6-i386 package directly instead.

After that, you can run disassemble func_name in your gdb directly. With all the symbols preserved, you can see the names of the functions directly. strings might help you too.

Btw, this question should be placed in Unix&Linux, I guess.

like image 38
Mingye Wang Avatar answered Sep 29 '22 21:09

Mingye Wang