>
This site is best viewed in a modern browser with JavaScript enabled.
### id="flarum-content">
[36D杯]逆向_BBBigEqSet和逆向_tiny
newbie99
逆向_BBBigEqSet
ida 缺省打开,无法F5,报错too big function
修改配置文件IDA 7.0\cfg\hexrays.cfg
MAX_FUNCSIZE = 64 // Functions over 64K are not decompiled
// 修改为:
MAX_FUNCSIZE = 1024 // Functions over 64K are not decompiled
可以F5打开了,是个方程组。128个未知数,128个条件
第一感觉上Z3求解,剩下就是体力活了,整理数据。
结果跑N久,然后优化,加约束,还是不行。求解失败。
改用numpy。再梳理一遍数据。
1min不到,numpy解出来了,看来Z3有时还是不如np。
逆向_tiny
这是个精简过的elf文件,具体方法可以参见https://www.kancloud.cn/kancloud/cbook/69003
ida、gdb等对它均无效,所以分析带来一定难度。
我是采用李代桃僵的方式,自行写个helloworld,编译成32位文件,然后把tiny的代码段替换进main处,再用ida打开,(能够直接看机器码的大佬们请无视。。。)
基本流程还是很清晰的了:
text:565C6199 ; int __cdecl main(int argc, const char **argv, const char **envp)
.text:565C6199 public main
.text:565C6199 main proc near ; DATA XREF: .got:main_ptr↓o
.text:565C6199 ; __unwind {
.text:565C6199 pop ebx ; 弹栈
.text:565C619A pop ebx
.text:565C619B pop ebx
.text:565C619C xor ecx, ecx
.text:565C619E push ecx
.text:565C619F inc ecx
.text:565C61A0 inc ecx ; loop循环次数2
.text:565C61A1 jmp short loc_565C61A7
.text:565C61A1 ; ---------------------------------------------------------------------------
.text:565C61A3 db 20h
.text:565C61A4 db 0, 1, 0
.text:565C61A7 ; ---------------------------------------------------------------------------
.text:565C61A7
.text:565C61A7 loc_565C61A7: ; CODE XREF: main+8↑j
.text:565C61A7 pop eax
.text:565C61A8 push 8AF45207h
.text:565C61AD push 93F9A63h
.text:565C61B2
.text:565C61B2 loc_565C61B2: ; CODE XREF: main+2D↓j
.text:565C61B2 mov edi, [ebx+ecx*4-4] ; ecx=2 取输入参数 后4位
.text:565C61B2 ; ecx=1 取输入参数 前4位
.text:565C61B6 ror edi, 3
.text:565C61B9 push 5D99429h
.text:565C61BE pop edx
.text:565C61BF pop esi
.text:565C61C0 xor esi, edi
.text:565C61C2 xor edx, esi
.text:565C61C4 or eax, edx
.text:565C61C6 loop loc_565C61B2
.text:565C61C8 xor ebx, ebx
.text:565C61CA test eax, eax
.text:565C61CC setnz bl ; status
.text:565C61CF xor eax, eax
.text:565C61D1 inc eax
.text:565C61D2 int 80h ; LINUX - sys_exit
.text:565C61D2 main endp ; sp-analysis failed
剩下手工算一下也可以了:
hex((0x05D99429 ^ 0x093F9A63)<<3) 0x67307250
hex((0x5D99429 ^ 0x8AF45207)<<3) 0x4796e3170L --> 0x796e3174
再转成字符串拼一下即可。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论