BUUCTF:Mysterious
题目来源:https://buuoj.cn/challenges#Mysterious
基础逆向题
题目给了一个exe文件
随意输了一些字符没有反应
打开010分析
PE...L...是32位的exe文件特征 PE....d?...是64位exe文件特征
拖到32位ida里
Shift+F12检索程序字符串
well done扎眼 点进去
追踪sub_401090 F5反汇编
到了这边直接看代码也能得到flag
memset(&String, 0, 0x104u); v10 = 0; if ( a2 == 16 ) { DestroyWindow(hWnd); PostQuitMessage(0); } else if ( a2 == 273 ) { if ( a3 == 1000 ) { GetDlgItemTextA(hWnd, 1002, &String, 260);//输入 strlen(&String); if ( strlen(&String) > 6 ) ExitProcess(0); v10 = atoi(&String) + 1; if ( v10 == 123 && v12 == 120 && v14 == 122 && v13 == 121 )//判断语句 { strcpy(Text, "flag"); memset(&v7, 0, 0xFCu); v8 = 0; v9 = 0; _itoa(v10, &v5, 10);//将整型的数字变量转换为字符数组变量 即:&v5="v10"="123" strcat(Text, "{"); strcat(Text, &v5); strcat(Text, "_"); strcat(Text, "Buff3r_0v3rf|0w"); strcat(Text, "}"); MessageBoxA(0, Text, "well done", 0); } SetTimer(hWnd, 1u, 0x3E8u, TimerFunc);//弹窗显示的信息 } if ( a3 == 1001 ) KillTimer(hWnd, 1u); } return 0; }
得到:flag{123_Buff3r_0v3rf|0w}
根据判断语句推断出当输入"122xyz"时满足 if ( v10 == 123 && v12 == 120 && v14 == 122 && v13 == 121 )
此时也能得到flag
参考:https://zhuanlan.zhihu.com/p/364062274 https://blog.csdn.net/mochu7777777/article/details/109146153