Bomb Lab: Phase 1
Less than 1 minuteAbout 163 words
Assembly
0000000000401440 <phase_1>:
b0:
401440: 48 83 ec 08 sub $0x8,%rsp
401444: 48 8d 35 05 1d 00 00 lea 0x1d05(%rip),%rsi # 403150 <_IO_stdin_used+0x150>
40144b: e8 43 04 00 00 callq 401893 <strings_not_equal>
401450: 85 c0 test %eax,%eax
401452: 74 05 je 401459 <phase_1+0x19>
401454: e8 03 07 00 00 callq 401b5c <explode_bomb>
b1:
401459: 48 83 c4 08 add $0x8,%rsp
40145d: c3 retq
翻译为 C
void phase_1() {
b0:
rsp -= 8;
rsi = rip + 0x1d05;
rax = strings_not_equal(rdi, rsi);
if (rax == 0) // 32-bit
goto b1;
explode_bomb();
b1:
rsp += 8;
return;
}
Optimize
void phase_1(char* rdi) {
char* rsi = 0x403150; // 403150 <_IO_stdin_used+0x150>
if (strings_not_equal(rdi, rsi)) explode_bomb();
return;
}
Hack
(gdb) x/s 0x403150
0x403150: "I am not part of the problem. I am a Republican."
Solution
I am not part of the problem. I am a Republican.