本人真正菜鸟学脱arm壳,比葫芦画瓢,过程如下:(看看哪一点不对)
环境:XP,OD,Peid查明为Arm2.5x-2.6x壳
脱壳过程
设置Ollydbg忽略所有的异常选项,用IsDebug 1.4插件去掉Ollydbg的调试器标志。
(1)查找OEP
用OD中载入程序,下bp WaitForDebugEvent,F9运行,中断如下:
77EB3A07 > 55 PUSH EBP <====中断在此处,清除断点
77EB3A08 8BEC MOV EBP,ESP
77EB3A0A 83EC 68 SUB ESP,68
77EB3A0D 56 PUSH ESI
77EB3A0E FF75 0C PUSH DWORD PTR SS:[EBP+C]
查看堆栈窗口:
0012DAEC 00650B44 /CALL 到 WaitForDebugEvent
0012DAF0 0012EB9C |pDebugEvent = 0012EB9C <====在这里点击右键选“转存中跟随”
0012DAF4 000003E8 \Timeout = 1000. ms
然后再下bp WriteProcessMemory,F9运行
77E61A90 > 55 PUSH EBP <====中断在此处
77E61A91 8BEC MOV EBP,ESP
77E61A93 51 PUSH ECX
77E61A94 51 PUSH ECX
77E61A95 8B45 0C MOV EAX,DWORD PTR SS:[EBP+C]
看数据转存窗口:
0012EB9C 01 00 00 00 A4 0A 00 00 ...?..
0012EBA4 D4 03 00 00 01 00 00 80 ?.. ..?
0012EBAC 00 00 00 00 00 00 00 00 ........
0012EBB4 00 10 40 00 02 00 00 00 . @. ...
0012EBBC 00 00 00 00 00 10 40 00 ..... @.
0012EBC4 00 10 40 00 00 00 00 00 . @.....
可能401000就是OEP,这样我们接着来
(2)dump文件
现在我们重新用OD中载入程序,下硬件断点,he WaitForDebugEvent,F9运行,中断如下:
77EB3A07 > 55 PUSH EBP <====中断在此处,删除断点
77EB3A08 8BEC MOV EBP,ESP
77EB3A0A 83EC 68 SUB ESP,68
77EB3A0D 56 PUSH ESI
77EB3A0E FF75 0C PUSH DWORD PTR SS:[EBP+C]
Alt+F9返回,搜索常数FFFFFFF8,来到(00651167处):
0065111B > 83BD D8F5FFFF>CMP DWORD PTR SS:[EBP-A28],0
00651122 . 0F8C 41020000 JL hce.00651369 <====跳转到00651369处,因此在00651369处下断点
00651128 . 8B8D D8F5FFFF MOV ECX,DWORD PTR SS:[EBP-A28]
0065112E . 3B0D 34E06700 CMP ECX,DWORD PTR DS:[67E034]
00651134 . 0F8D 2F020000 JGE hce.00651369
0065113A . 8B95 48F6FFFF MOV EDX,DWORD PTR SS:[EBP-9B8]
00651140 . 81E2 FF000000 AND EDX,0FF
00651146 . 85D2 TEST EDX,EDX
00651148 . 0F84 AD000000 JE hce.006511FB
0065114E . 6A 00 PUSH 0
00651150 . 8BB5 D8F5FFFF MOV ESI,DWORD PTR SS:[EBP-A28]
00651156 . C1E6 04 SHL ESI,4
00651159 . 8B85 D8F5FFFF MOV EAX,DWORD PTR SS:[EBP-A28]
0065115F . 25 07000080 AND EAX,80000007
00651164 . 79 05 JNS SHORT hce.0065116B
00651166 . 48 DEC EAX
00651167 . 83C8 F8 OR EAX,FFFFFFF8 <=====搜索来到这里,向上看
0065116A . 40 INC EAX
0065116B > 33C9 XOR ECX,ECX
0065116D . 8A88 50C66700 MOV CL,BYTE PTR DS:[EAX+67C650]
00651173 . 8B95 D8F5FFFF MOV EDX,DWORD PTR SS:[EBP-A28]
00651179 . 81E2 07000080 AND EDX,80000007
0065117F . 79 05 JNS SHORT hce.00651186
00651181 . 4A DEC EDX
00651182 . 83CA F8 OR EDX,FFFFFFF8
00651185 . 42 INC EDX
00651186 > 33C0 XOR EAX,EAX
00651188 . 8A82 51C66700 MOV AL,BYTE PTR DS:[EDX+67C651]
0065118E . 8B3C8D 608267>MOV EDI,DWORD PTR DS:[ECX*4+678260]
00651195 . 333C85 608267>XOR EDI,DWORD PTR DS:[EAX*4+678260]
0065119C . 8B8D D8F5FFFF MOV ECX,DWORD PTR SS:[EBP-A28]
006511A2 . 81E1 07000080 AND ECX,80000007
006511A8 . 79 05 JNS SHORT hce.006511AF
006511AA . 49 DEC ECX
006511AB . 83C9 F8 OR ECX,FFFFFFF8
006511AE . 41 INC ECX
006511AF > 33D2 XOR EDX,EDX
006511B1 . 8A91 52C66700 MOV DL,BYTE PTR DS:[ECX+67C652]
006511B7 . 333C95 608267>XOR EDI,DWORD PTR DS:[EDX*4+678260]
006511BE . 8B85 D8F5FFFF MOV EAX,DWORD PTR SS:[EBP-A28]
006511C4 . 99 CDQ
006511C5 . B9 1C000000 MOV ECX,1C
006511CA . F7F9 IDIV ECX
006511CC . 8BCA MOV ECX,EDX
006511CE . D3EF SHR EDI,CL
006511D0 . 83E7 0F AND EDI,0F
006511D3 . 03F7 ADD ESI,EDI
006511D5 > 8B15 24E06700 MOV EDX,DWORD PTR DS:[67E024]
006511DB . 8D04B2 LEA EAX,DWORD PTR DS:[EDX+ESI*4]
006511DE . 50 PUSH EAX
006511DF . 8B8D D8F5FFFF MOV ECX,DWORD PTR SS:[EBP-A28]
006511E5 . 51 PUSH ECX
006511E6 . E8 621D0000 CALL hce.00652F4D
006511EB . 83C4 0C ADD ESP,0C
006511EE . 25 FF000000 AND EAX,0FF <====从这里开始修改
006511F3 . 85C0 TEST EAX,EAX
006511F5 . 0F84 6E010000 JE hce.00651369
006511FB > 8B95 D4F5FFFF MOV EDX,DWORD PTR SS:[EBP-A2C]
在0065111B处下硬件执行断点,F9运行到0065111B处,此时[ebp-A28] =[0012EB8C]= 00000000,上述的修改地方修改为:
006511EE FF05 8CEB1200 INC DWORD PTR DS:[12EB8C]
006511F4 C705 38E06700 01000000 MOV DWORD PTR DS:[67E038],1
006511F5 ^ E9 21FFFFFF JMP hce.0065111B
006511FA 90 NOP
去掉所有断点,并在00651369处下断,00651369处为:
0065135D > 61 POPAD
0065135E . 9D POPFD
0065135F > C785 E0F5FFFF 02000100 MOV DWORD PTR SS:[EBP-A20],10002 ; UNICODE "::=::\"
00651369 > E9 FB0D0000 JMP hce.00652169
0065136E 8B DB 8B
0065136F 8D DB 8D
00651370 E4 DB E4
00651371 F5 DB F5
00651372 FF DB FF
00651373 FF DB FF
00651374 81 DB 81
F9运行,断住。说是所有代码都强制解压完成。
运行LordPE,有2个进程,选择第2个,但dump不出来,死机了。
非常郁闷。。。。
重新试一次,不用LordPE,直接用OD插件OllyDump可以dump了,但是如何修改入口点,如何修复IAT,如何往下进行呢?
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!