I'm trying to run the file when defusing a bomb in phase_1, but it exits before reaching my breakpoint.
gdb bomb
...
(gdb) break phase_1
Breakpoint 1 at 0x1264
(gdb) run
Starting program: .../bomb
Initialization error: Running on an illegal host [2]
[Inferior 1 (process 3262) exited with code 010]I don't know why i couldn't even run the bomb file, please help.
31 Answer
Your bomb appears to be tamper-resistant and intentionally refuses to run on your machine. (Or possibly the program detected it was running under a debugger, and used that message even if on the University host?) That message was printed by the bomb program itself, not GDB.
You could set a breakpoint in its main or something to work around the hostname check (or whatever it's actually checking; use strace to find out). Or perhaps your instructor wants you to defuse it only from static analysis of the disassembly, not from single-stepping it in the debugger.
However, I googled on that string and found which mentions:
Include the
-qflag which prevents program from contacting non-existent grading server in addition to the above error.
So its worth trying run -q, in case your bomb supports that command-line option. If so, you're probably intended to be able to use the debugger while figuring out the phases, just not to skip the phases entirely and get to the part of the program that submits that you've disarmed it.