还是挺有趣的(不就是 CTF 吗
打开 bomb.c
,发现程序主体如下:
#include <stdio.h>
#include <stdlib.h>
#include "support.h"
#include "phases.h"
。
。
。
/* Hmm... Six phases must be more secure than one phase! */
input = read_line(); /* Get input */
phase_1(input); /* Run the phase */
phase_defused(); /* Drat! They figured it out!
* Let me know how they did it. */
printf("Phase 1 defused. How about the next one?\n");
。
。
。
/* This phase will never be used, since no one will get past the
* earlier ones. But just in case, make this one extra hard. */
input = read_line();
phase_6(input);
phase_defused();
/* Wow, they got it! But isn't something... missing? Perhaps
* something they overlooked? Mua ha ha ha ha! */
就是输入 6 个字符串,phase_x()
会对其进行处理,如果失败了就 bomb!
因为缺失了 phases.h
文件,所以我们看不到 phase_x()
的 C 代码
于是只能看汇编代码,反推出应该输入什么字符串(逆向工程)
前五个还是比较简单的,最后一个卡了我很久。。。
由最后一行注释可知,还有个隐藏关卡(我虽然找到了,不过今晚没时间解了
在做之前可以看看视频与讲义(虽然只是简单介绍一下要用到的命令
到官方网站下载 Self-Study Handout 就可以做了
推荐大家用 peda 来做
不过 peda 默认是 Intel 的语法,把 peda.py
里以下两行注释掉就可以 了
self.execute("set disassembly-flavor intel")
peda.execute("set disassembly-flavor intel")
PS:
我今晚是开了直播做的,不过只有 @没有人 看
明天下午可能会继续在 teamviewer 直播做 attack lab
因为这两个 lab 是探索性的,感觉一起做会比较有意思,看了第三章就会做啦