- UID
- 1420
注册时间2005-5-4
阅读权限30
最后登录1970-1-1
龙战于野
该用户从未签到
|
发表于 2005-6-25 12:56:28
|
显示全部楼层
找了另一篇就是修复不了IAT?(3.92版)
PeCompact 2.x 通用简单脱壳法
文章作者: peaceclub 文章来源:看雪论坛
今天还有朋友在问PeCompact2.x的脱壳方法,我再这里把我的通用脱法提一下(在看其它高手们文章的基础上总结的,在此表示感谢).
[法则]:
PeCompact2.x是制造了两个异常(00000000内存写异常和Single Step单步循环异常),我们可以轻松通过查看SEH链来进行脱壳
下面我说一下通用简单脱壳法:
1、去掉所有异常忽略,保留kernel32里的内存读写异常忽略
2、F9,run
3、遇到写[00000000]内存异常,暂停
4、查看SEH 链,也可从esp+4获得第一个SE Handle,Ctrl+G,来到此地址
5、向下找jmp eax,大概在$+CB处,记住此地址
6、ollydbg重新载入,下硬件执行断点: he 第5步的地址,F9,Shift+F9,中断
7、F8
8、dump,imprec fix iat,完工
[例子]:
GameThrust1.2: http://www.onlinedown.net/soft/37372.htm
工具: Ollydbg/LordPE/Imprec
依照上面提及通用方法,去掉ollydbg中所有异常忽略,保留kernel32里的内存读写异常忽略
用ollydbg载入GameThrust.exe,F9
引用:
--------------------------------------------------------------------------------
00401000 > B8 34C05000 MOV EAX,GameThru.0050C034
00401005 50 PUSH EAX
00401006 64:FF35 00000000 PUSH DWORD PTR FS:[0]
0040100D 64:8925 00000000 MOV DWORD PTR FS:[0],ESP
00401014 33C0 XOR EAX,EAX
00401016 8908 MOV DWORD PTR DS:[EAX],ECX ;****此处异常****
00401018 50 PUSH EAX
00401019 45 INC EBP
0040101A 43 INC EBX
--------------------------------------------------------------------------------
查看SEH 链,也可从esp+4获得第一个SE Handle
引用:
--------------------------------------------------------------------------------
0012FFBC 0012FFE0 Pointer to next SEH record
0012FFC0 0050C034 SE handler ;******SE handle 50C034*****
0012FFC4 7C816D4F RETURN to kernel32.7C816D4F
0012FFC8 7C930738 ntdll.7C930738
0012FFCC FFFFFFFF
0012FFD0 7FFD9000
0012FFD4 8054C038
--------------------------------------------------------------------------------
Ctrl+G,50C034
引用:
--------------------------------------------------------------------------------
0050C034 B8 DEAE50F0 MOV EAX,F050AEDE ;***来到这里***
0050C039 8D88 79110010 LEA ECX,DWORD PTR DS:[EAX+10001179]
0050C03F 8941 01 MOV DWORD PTR DS:[ECX+1],EAX
0050C042 8B5424 04 MOV EDX,DWORD PTR SS:[ESP+4]
0050C046 8B52 0C MOV EDX,DWORD PTR DS:[EDX+C]
0050C049 C602 E9 MOV BYTE PTR DS:[EDX],0E9
0050C04C 83C2 05 ADD EDX,5
0050C04F 2BCA SUB ECX,EDX
0050C051 894A FC MOV DWORD PTR DS:[EDX-4],ECX
0050C054 33C0 XOR EAX,EAX
0050C056 C3 RETN
0050C057 B8 78563412 MOV EAX,12345678
0050C05C 64:8F05 00000000 POP DWORD PTR FS:[0]
0050C063 83C4 04 ADD ESP,4
0050C066 55 PUSH EBP
0050C067 53 PUSH EBX
0050C068 51 PUSH ECX
0050C069 57 PUSH EDI
0050C06A 56 PUSH ESI
0050C06B 52 PUSH EDX
0050C06C 8D98 32110010 LEA EBX,DWORD PTR DS:[EAX+10001132]
0050C072 8B53 18 MOV EDX,DWORD PTR DS:[EBX+18]
0050C075 52 PUSH EDX
0050C076 8BE8 MOV EBP,EAX
0050C078 6A 40 PUSH 40
0050C07A 68 00100000 PUSH 1000
0050C07F FF73 04 PUSH DWORD PTR DS:[EBX+4]
0050C082 6A 00 PUSH 0
0050C084 8B4B 10 MOV ECX,DWORD PTR DS:[EBX+10]
0050C087 03CA ADD ECX,EDX
0050C089 8B01 MOV EAX,DWORD PTR DS:[ECX]
0050C08B FFD0 CALL EAX
0050C08D 5A POP EDX
0050C08E 8BF8 MOV EDI,EAX
0050C090 50 PUSH EAX
0050C091 52 PUSH EDX
0050C092 8B33 MOV ESI,DWORD PTR DS:[EBX]
0050C094 8B43 20 MOV EAX,DWORD PTR DS:[EBX+20]
0050C097 03C2 ADD EAX,EDX
0050C099 8B08 MOV ECX,DWORD PTR DS:[EAX]
0050C09B 894B 20 MOV DWORD PTR DS:[EBX+20],ECX
0050C09E 8B43 1C MOV EAX,DWORD PTR DS:[EBX+1C]
0050C0A1 03C2 ADD EAX,EDX
0050C0A3 8B08 MOV ECX,DWORD PTR DS:[EAX]
0050C0A5 894B 1C MOV DWORD PTR DS:[EBX+1C],ECX
0050C0A8 03F2 ADD ESI,EDX
0050C0AA 8B4B 0C MOV ECX,DWORD PTR DS:[EBX+C]
0050C0AD 03CA ADD ECX,EDX
0050C0AF 8D43 1C LEA EAX,DWORD PTR DS:[EBX+1C]
0050C0B2 50 PUSH EAX
0050C0B3 57 PUSH EDI
0050C0B4 56 PUSH ESI
0050C0B5 FFD1 CALL ECX
0050C0B7 5A POP EDX
0050C0B8 58 POP EAX
0050C0B9 0343 08 ADD EAX,DWORD PTR DS:[EBX+8]
0050C0BC 8BF8 MOV EDI,EAX
0050C0BE 52 PUSH EDX
0050C0BF 8BF0 MOV ESI,EAX
0050C0C1 8B46 FC MOV EAX,DWORD PTR DS:[ESI-4]
0050C0C4 83C0 04 ADD EAX,4
0050C0C7 2BF0 SUB ESI,EAX
0050C0C9 8956 08 MOV DWORD PTR DS:[ESI+8],EDX
0050C0CC 8B4B 10 MOV ECX,DWORD PTR DS:[EBX+10]
0050C0CF 894E 24 MOV DWORD PTR DS:[ESI+24],ECX
0050C0D2 8B4B 14 MOV ECX,DWORD PTR DS:[EBX+14]
0050C0D5 51 PUSH ECX
0050C0D6 894E 28 MOV DWORD PTR DS:[ESI+28],ECX
0050C0D9 8B4B 0C MOV ECX,DWORD PTR DS:[EBX+C]
0050C0DC 894E 14 MOV DWORD PTR DS:[ESI+14],ECX
0050C0DF FFD7 CALL EDI
0050C0E1 8985 23120010 MOV DWORD PTR SS:[EBP+10001223],EAX
0050C0E7 8BF0 MOV ESI,EAX
0050C0E9 59 POP ECX
0050C0EA 5A POP EDX
0050C0EB 03CA ADD ECX,EDX
0050C0ED 68 00800000 PUSH 8000
0050C0F2 6A 00 PUSH 0
0050C0F4 57 PUSH EDI
0050C0F5 FF11 CALL DWORD PTR DS:[ECX]
0050C0F7 8BC6 MOV EAX,ESI
0050C0F9 5A POP EDX
0050C0FA 5E POP ESI
0050C0FB 5F POP EDI
0050C0FC 59 POP ECX
0050C0FD 5B POP EBX
0050C0FE 5D POP EBP
0050C0FF FFE0 JMP EAX ;*****JMP EAX*****
0050C101 0000 ADD BYTE PTR DS:[EAX],AL
0050C103 0000 ADD BYTE PTR DS:[EAX],AL
--------------------------------------------------------------------------------
向下找jmp eax,大概在$+CB处,记住此地址50c0ff
用ollydbg重新载入,下硬件执行断点: he 50c0ff,F9,Shift+F9,中断
F8,来到487228处
引用:
--------------------------------------------------------------------------------
00487228 55 PUSH EBP *****OEP******
00487229 8BEC MOV EBP,ESP
0048722B B9 35000000 MOV ECX,35
00487230 6A 00 PUSH 0
00487232 6A 00 PUSH 0
00487234 49 DEC ECX
00487235 ^75 F9 JNZ SHORT GameThru.00487230
00487237 51 PUSH ECX
00487238 53 PUSH EBX
00487239 56 PUSH ESI
0048723A 57 PUSH EDI
0048723B B8 706E4800 MOV EAX,GameThru.00486E70
00487240 E8 97EDF7FF CALL GameThru.00405FDC
00487245 33C0 XOR EAX,EAX
--------------------------------------------------------------------------------
dump,imprec fix iat,完工.
别看写了这么多,真正做起来就几步,实际上有经验的话,几个F8,然后shift+F8,跟踪几下就到了. |
|