这是一道CTF题,涉及到The House of Force技术
文件及writeup可以在
http://uaf.io/exploitation/2016/03/20/BCTF-bcloud.html
下载,另外还有
http://www.freebuf.com/news/topnews/100143.html
、
https://github.com/ctfs/write-ups-2016/tree/master/bctf-2016/exploit/bcloud-200
等相关参考资料。
首先运行一下,看一下大致流程,
root@yang-virtual-machine:~/ctf# ./bcloud
Input your name:
123
Hey 123! Welcome to BCTF CLOUD NOTE MANAGE SYSTEM!
Now let's set synchronization options.
Org:
qwe
Host:
asd
OKay! Enjoy:)
1.New note
2.Show note
3.Edit note
4.Delete note
5.Syn
6.Quit
option--->>
1
Input the length of the note content:
ssssssssssssssssss
Input the content:
Create success, the id is 0
1.New note
2.Show note
3.Edit note
4.Delete note
5.Syn
6.Quit
option--->>
然后放到IDA中静态分析一下,为了提高可读性,对一些变量进行了重命名。
首先分析一下input_name函数的伪代码:
int input_name()
{
char s; // [sp+1Ch] [bp-5Ch]@1
int heap_of_name; // [sp+5Ch] [bp-1Ch]@1
int v3; // [sp+6Ch] [bp-Ch]@1
v3 = *MK_FP(__GS__, 20);
memset(&s, 0, 0x50u);
puts("Input your name:");
read_user_define((int)&s, 64, 10);
heap_of_name = (int)malloc(0x40u);
dword_804B0CC = heap_of_name;
strcpy((char *)heap_of_name, &s);
print_info(heap_of_name);
return *MK_FP(__GS__, 20) ^ v3;
}
我们输入name时,保存到s处,也就是bp-5