pwnable.kr [flag]
Papa brought me a packed present! let’s open it.
Download : http://pwnable.kr/bin/flag
This is reversing task. all you need is binary
题目要求直接看二进制文件。ida打开观察一波
反编译代码如下
__int64 __fastcall start(__int64 a1)
{
__int64 v1; // rdx
__int64 result; // rax
char v3; // dl
((void (*)(void))loc_44A770)();
result = sub_44A560(v1, a1, v1, 0LL);
v3 = *(_BYTE *)(a1 + 4);
return result;
}
函数名看不懂,网上查了一下,这种一般是加壳了说是用upx这个压缩器,那么解压之后的代码如下
int __cdecl main(int argc, const char **argv, const char **envp)
{
char *dest; // ST08_8
puts("I will malloc() and strcpy the flag there. take it.", argv, envp);
dest = (char *)malloc(100LL);
strcpy(dest, flag);
return 0;
很明显了,程序会把flag的值复制到字符串里,那么flag一定是存在程序文件内部的。
ida中直接点击flag参数找数据
查看data
这里出现了提示字符串,疑似flag,提交发现不是
那么f此处的flag参数应该是一个数据指针,再次点击。
有发现了提示字符串,测试提交后发现是flag
总结
upx 命令:解压 upx -d [文件]