-2
我在二元炸彈實驗室的這個階段遇到了麻煩。到目前爲止,我認爲答案必須是少於29個字符的字符串(如+24所示),並且必須以某種方式將%ebx增加到5,然後才允許它被解散。
我的問題是我如何知道在哪裏尋找答案,以及需要什麼步驟才能到達那裏?如何解決這個二進制炸彈?
0x00000000004010f6 <+0>: push %r13
0x00000000004010f8 <+2>: push %r12
0x00000000004010fa <+4>: push %rbp
0x00000000004010fb <+5>: push %rbx
0x00000000004010fc <+6>: sub $0x8,%rsp
0x0000000000401100 <+10>: mov %rdi,%r13
0x0000000000401103 <+13>: callq 0x4012b1 <string_length> //x/s showed that 0x4012b1 was "\200?"
0x0000000000401108 <+18>: mov %eax,%r12d //r12d = length of input
0x000000000040110b <+21>: lea -0x1(%rax),%eax
0x000000000040110e <+24>: cmp $0x1d,%eax //refrains from lengths > 30
0x0000000000401111 <+27>: jbe 0x401118 <phase_6+34>
0x0000000000401113 <+29>: callq 0x40152f <detonate_bomb>
0x0000000000401118 <+34>: test %r12d,%r12d
0x000000000040111b <+37>: jle 0x40113d <phase_6+71>
0x000000000040111d <+39>: mov $0x0,%ebx
0x0000000000401122 <+44>: movzbl 0x0(%r13,%rbx,1),%eax
0x0000000000401128 <+50>: sub $0x30,%eax
0x000000000040112b <+53>: cmp $0x1,%al //last 4 bits < 1
0x000000000040112d <+55>: jbe 0x401134 <phase_6+62>
=> 0x000000000040112f <+57>: callq 0x40152f <detonate_bomb>
0x0000000000401134 <+62>: add $0x1,%rbx/
0x0000000000401138 <+66>: cmp %ebx,%r12d
0x000000000040113b <+69>: jg 0x401122 <phase_6+44>
0x000000000040113d <+71>: mov $0x0,%ebx //start of a a double for loop?
0x0000000000401142 <+76>: mov $0x0,%ebp
0x0000000000401147 <+81>: mov $0x604300,%eax //(gdb)x 0x604300 <tnode13>: ""
0x000000000040114c <+86>: movzbl (%rax),%edx
0x000000000040114f <+89>: test %dl,%dl
0x0000000000401151 <+91>: je 0x40116d <phase_6+119>
0x0000000000401153 <+93>: movslq %ebx,%rax
0x0000000000401156 <+96>: cmp 0x402506(%rax),%dl // x 0x402506 = "eaeafc"
0x000000000040115c <+102>: je 0x401163 <phase_6+109>
0x000000000040115e <+104>: callq 0x40152f <detonate_bomb>
0x0000000000401163 <+109>: add $0x1,%ebx //incrementing counter
0x0000000000401166 <+112>: mov $0x604300,%eax
0x000000000040116b <+117>: jmp 0x40118d <phase_6+151>
0x000000000040116d <+119>: movslq %ebp,%rdx //%rdx = 0
0x0000000000401170 <+122>: movzbl 0x0(%r13,%rdx,1),%edx
0x0000000000401176 <+128>: cmp $0x30,%dl
0x0000000000401179 <+131>: jne 0x401181 <phase_6+139>
0x000000000040117b <+133>: mov 0x8(%rax),%rax
0x000000000040117f <+137>: jmp 0x40118a <phase_6+148>
0x0000000000401181 <+139>: cmp $0x31,%dl
0x0000000000401184 <+142>: jne 0x40118a <phase_6+148>
0x0000000000401186 <+144>: mov 0x10(%rax),%rax
0x000000000040118a <+148>: add $0x1,%ebp //increment %ebp
0x000000000040118d <+151>: cmp $0x5,%ebx
0x0000000000401190 <+154>: jg 0x401197 <phase_6+161>
0x0000000000401192 <+156>: cmp %r12d,%ebp //comparing
0x0000000000401195 <+159>: jl 0x40114c <phase_6+86>
0x0000000000401197 <+161>: cmp $0x5,%ebx
0x000000000040119a <+164>: jne 0x4011a2 <phase_6+172>
0x000000000040119c <+166>: cmpb $0x63,(%rax)
0x000000000040119f <+169>: nop
0x00000000004011a0 <+170>: je 0x4011a7 <phase_6+177> //if %rax == 99 jump
0x00000000004011a2 <+172>: callq 0x40152f <detonate_bomb>
0x00000000004011a7 <+177>: add $0x8,%rsp
0x00000000004011ab <+181>: pop %rbx
0x00000000004011ac <+182>: pop %rbp
0x00000000004011ad <+183>: pop %r12
0x00000000004011af <+185>: pop %r13
0x00000000004011b1 <+187>: retq
把它帶到炸彈小隊。 – WedaPashi
在代碼中添加註釋,或者在某處添加註釋,包含迄今爲止關於此函數正在執行的所有內容以及輸入上的哪些約束。二元炸彈的挑戰第一次還挺有趣,但從零開始就對SO上的每一個炸彈問題開始變得老舊。對於其他人來說,看看這些評論是否合理,而不是從靠近你的角度解決它。 –
另外,像Agner Fog的objconv這樣的反彙編程序會將分支目標標籤放在輸出代碼中,使查找分支目標更容易。 (它以NASM語法進行分解,而不是不那麼受歡迎的AT&T。) –