3、对phase_3破解
得到phase_3的汇编代码,开始破解
sub $0x3c,%esp
lea 0x28(%esp),%eax
mov %eax,0x10(%esp)
lea 0x2f(%esp),%eax
mov %eax,0xc(%esp)
lea 0x24(%esp),%eax
mov %eax,0x8(%esp)
movl $0x804a29a,0x4(%esp)
mov 0x40(%esp),%eax
mov %eax,(%esp)
call 8048870 <__isoc99_sscanf@plt>
cmp $0x2,%eax
jg 8048bf5 <phase_3+0x39>
call 8049176 <explode_bomb>
cmpl $0x7,0x24(%esp)
ja 8048cfc <phase_3+0x140>
mov 0x24(%esp),%eax
jmp *0x804a2c0(,%eax,4)
mov $0x68,%eax
cmpl $0x14a,0x28(%esp)
je 8048d06 <phase_3+0x14a>
call 8049176 <explode_bomb>
mov $0x68,%eax
jmp 8048d06 <phase_3+0x14a>
mov $0x6f,%eax
cmpl $0x309,0x28(%esp)
je 8048d06 <phase_3+0x14a>
call 8049176 <explode_bomb>
mov $0x6f,%eax
jmp 8048d06 <phase_3+0x14a>
mov $0x6e,%eax
cmpl $0x3e6,0x28(%esp)
je 8048d06 <phase_3+0x14a>
call 8049176 <explode_bomb>
mov $0x6e,%eax
jmp 8048d06 <phase_3+0x14a>
mov $0x63,%eax
cmpl $0x125,0x28(%esp)
je 8048d06 <phase_3+0x14a>
call 8049176 <explode_bomb>
mov $0x63,%eax
jmp 8048d06 <phase_3+0x14a>
mov $0x75,%eax
cmpl $0x167,0x28(%esp)
je 8048d06 <phase_3+0x14a>
call 8049176 <explode_bomb>
mov $0x75,%eax
jmp 8048d06 <phase_3+0x14a>
mov $0x68,%eax
cmpl $0x242,0x28(%esp)
je 8048d06 <phase_3+0x14a>
call 8049176 <explode_bomb>
mov $0x68,%eax
jmp 8048d06 <phase_3+0x14a>
mov $0x78,%eax
cmpl $0x329,0x28(%esp)
je 8048d06 <phase_3+0x14a>
call 8049176 <explode_bomb>
mov $0x78,%eax
jmp 8048d06 <phase_3+0x14a>
mov $0x6c,%eax
cmpl $0x24b,0x28(%esp)
je 8048d06 <phase_3+0x14a>
call 8049176 <explode_bomb>
mov $0x6c,%eax
jmp 8048d06 <phase_3+0x14a>
call 8049176 <explode_bomb>
mov $0x64,%eax
cmp 0x2f(%esp),%al
je 8048d11 <phase_3+0x155>
call 8049176 <explode_bomb>
add $0x3c,%esp
ret
通过分析可以看出,这一段代码需要输入三个数据,通过分析“jmp *0x804a2c0(,%eax,4)”这一行代码可以看到,这是一个switch的选择分支,通过第一个数据进入一个switch选择分支,第一个数据的数值只能在0~7之间,然后对后两个数据的数值进行判断,只有当后两个均相同的时候才不会引爆炸弹。最终得到的密码为:0 h 330或1 o 777或2 n 998或3 c 293或4 u 359或5 h 578或6 x 809或7 l 587中任意一个
对应的编程语言为:
int a,c;
char b;
cin>>a>>b>>c;
switch (a)
case 0:{
if(b!=’h’||c!=330)
explode_bomb;
break;
}
case 1:{
if(b!=’o’||c!=777)
explode_bomb;
break;
}
case 2:{
if(b!=’n’||c!=998)
explode_bomb;
break;
}
case 3:{
if(b!=’c’||c!=293)
explode_bomb;
break;
}
case 4:{
if(b!=’u’||c!=359)
explode_bomb;
break;
}
case 5:{
if(b!=’h’||c!=578)
explode_bomb;
break;
}
case 6:{
if(b!=’x’||c!=809)
explode_bomb;
break;
}
case 7:{
if(b!=’l’||c!=587)
explode_bomb;
break;
}
default:{
explode_bomb;
}