Bomb Lab

Phase 1

objdump -d bomb > bomb.as Get the assemble code. Look into phase 1

strings_not_equal is used to trigger the bomb.

In this function, the register %rdi and %rsi are used to store the string. Therefore, we can use gdb to check what is in them.

Phase 2

We can check out what is going on after 4026c3 by gdb break

we can get this output, when we set the second line in psol.txt as 1:

With more try, we know that the register %rsp is used to store the array. Then we translate the assemble code.

Therefore, the first and second number is 1, 1. From the code we know that the loop is doing the Fibonacci array check.

Write [1, 1, 2, 3, 5, 8] in the second line, we can run the bomb and get

Phase 3

Phase 3 code is longer...

First look into the value of %eax, with more than 1 input. Set breakpoint after call 402200 <__isoc99_sscanf@plt>

get the output of:

Although we input more than one arguement, the eax is still 2. Therefore we know there are 2 argument in the sscanf. If the eax is 1, the jle 40276e <phase_3+0x52> will jump to 40276e and explode bomb!!! Next, look at this part:

set break point at 402754 we can check that the rdx is the first input a, and rax = rdx-6 <= 7. Legal fist input a<=13

phase3 Input a = 10, b = 0 with (gdb)stepi we can defuse the phase3 bomb.

Phase 4

We know that 1<b<4

After the <func4> the output rax should equal to the first input a = 0x10(%rsp) =24. Therefore a = 24, 1<b<4

phase4

Phase 5

First, set break points at this two place for safety

rsi is the place for us to select the data (gdb) x/128c $rsi

The program is input the index for the memory, and try to map and combine the character to the target value 0x5264cb -> in binary 0101 0010 0110 0100 1100 1011. Therefore, we need to select the char 5, 2, 6, 4, 12, 11 whose index is [11, 1, 2, 8, 4, 12], in char you can use this as 6 byte input: ;0284<. There can be multiple answers according to the ascii table.

Phase 6

We can know from the code that the input is between 1 to 6, and can not repeat.

check the value in the memory we get:

1 6 4 5 3 2