迅闪4.92版
PE-Armor 0.46 -> China Cracking Group *
00568000 > E8 AA000000 call 005680AF /壳的OEP
00568005 2D 80160000 sub eax, 1680
看了一下看雪论坛精华七
首先知道这个壳要先用VirtualAlloc来申请空间
BP VirtualAlloc
F9
取消断点
堆栈:
0012FFB0 005680E3 /CALL 到 VirtualAlloc 来自 游戏菜单.005680DD
0012FFB4 00000000 |Address = NULL
0012FFB8 00004DC6 |Size = 4DC6 (19910.)
0012FFBC 00001000 |AllocationType = MEM_COMMIT
0012FFC0 00000004 \Protect = PAGE_READWRITE
ALT+F9
005680E3 50 push eax /eax=00370000 入栈
005680E4 8B9D 7E000000 mov ebx, [ebp+7E] /偏移量=1A2
005680EA 03DD add ebx, ebp /把RVA=00568000转为VA=005681A2
005680EC 50 push eax /eax再次入栈,存放解压代码?
005680ED 53 push ebx /ebx=005681A2入栈
005680EE E8 04000000 call 005680F7 /解压
堆栈:
0012FFB8 005681A2 |Arg1 = 005681A2
0012FFBC 00370000 \Arg2 = 00370000
005680F3 5A pop edx /edx出栈并附00370000(刚申请的地址)
005680F4 55 push ebp /原RVA0=00568000入栈
005680F5 FFE2 jmp edx /跳到刚申请的空间
00370000 E8 05000000 call 0037000A /F7跟进
00370005 0F01 ??? /未知命令
00370007 EB 05 jmp short 0037000E
00370009 E8 EBFB0000 call 0037FBF9
0037000E 83C4 04 add esp, 4 /平衡堆栈
00370011 E8 07000000 call 0037001D /JMP short的变形
..............凡是CALL的地方用F7跟进,会恢复原代码,因为一次出错,按错了,那只好用CRTL+F7,跟啦,到适当的地方就按停。
00371087 /EB 14 jmp short 0037109D
00371089 |64:FF35 0000000>push dword ptr fs:[0]
00371090 |64:8925 0000000>mov fs:[0], esp
00371097 |33C9 xor ecx, ecx
00371099 |99 cdq
0037109A |F7F1 div ecx /出现异常,整数除以0,有了第一次的经验,下次除整数除以0其它异常忽略就到这了,呵呵
0037109C |E9 E8080000 jmp 00371989
然后看教程应该是检查API,BP GetModuleHandleA,因为检查API要加载动态连接库,所以
0012FFC0 00371B87 ASCII "VirtualFree"
原来是释放第一个申请的空间,汗!!!
呵呵,然后下面又申请一次空间
0037192B 53 push ebx
0037192C 6A 04 push 4
0037192E 68 00100000 push 1000
00371933 FF342B push dword ptr [ebx+ebp]
00371936 6A 00 push 0
00371938 FF95 BC020000 call [ebp+2BC] /CALL VirtualAlloc
0012FFAC 0037193E /CALL 到 VirtualAlloc 来自 00371938
0012FFB0 00000000 |Address = NULL
0012FFB4 00121000 |Size = 121000 (1183744.)
0012FFB8 00001000 |AllocationType = MEM_COMMIT
0012FFBC 00000004 \Protect = PAGE_READWRITE
0037193E 5B pop ebx /堆栈 [0012FFC0]=000002FD ebx=000002FD
0037193F 8BF0 mov esi, eax /把申请到地址eax=00570000,暂存到ESI
00371941 8BC3 mov eax, ebx /再将偏移量2FD,存到eax
00371943 03C5 add eax, ebp /ebp=0037189A eax=000002FD,把RVA转为RA=00371B97
00371945 8B78 04 mov edi, [eax+4] /[eax+4]=00001000 ASCII "MZP" edi=00001000
00371948 03BD C0020000 add edi, [ebp+2C0] /ss:[00371B5A]=00400000 (游戏菜单.00400000), ASCII "MZP" edi=00001000
0037194E 56 push esi
0037194F 57 push edi
00371950 FF95 D8020000 call [ebp+2D8]
00371956 8B0C2B mov ecx, [ebx+ebp]
00371959 56 push esi
0037195A F3:A4 rep movs byte ptr es:[edi], byte ptr>
0037195C 5E pop esi
0037195D 53 push ebx
0037195E 68 00800000 push 8000
00371963 6A 00 push 0
00371965 56 push esi
00371966 FF95 F9020000 call [ebp+2F9] ; kernel32.VirtualFree
0037196C 5B pop ebx
0037196D 83C3 0C add ebx, 0C
00371970 ^ EB B3 jmp short 00371925
00371972 8B85 C4020000 mov eax, [ebp+2C4]
00371978 0BC0 or eax, eax
0037197A 0F85 81000000 jnz 00371A01
00371980 8BBD CC020000 mov edi, [ebp+2CC]
00371986 03BD C0020000 add edi, [ebp+2C0]
0037198C 8B77 0C mov esi, [edi+C]
0037198F 0BF6 or esi, esi
00371991 75 02 jnz short 00371995
00371993 EB 6A jmp short 003719FF
00371995 03B5 C0020000 add esi, [ebp+2C0]
0037199B 56 push esi
00371A1D FF95 B4020000 call [ebp+2B4] ; kernel32.GetModuleHandleA
003719A2 0BC0 or eax, eax
003719A4 75 07 jnz short 003719AD
003719A6 56 push esi
003719A7 FF95 B8020000 call [ebp+2B8]
003719AD 8BF0 mov esi, eax
003719AF 8B17 mov edx, [edi]
003719B1 0BD2 or edx, edx
003719B3 75 03 jnz short 003719B8
003719B5 8B57 10 mov edx, [edi+10]
003719B8 0395 C0020000 add edx, [ebp+2C0]
003719BE 8B5F 10 mov ebx, [edi+10]
003719C1 039D C0020000 add ebx, [ebp+2C0]
003719C7 8B02 mov eax, [edx]
003719C9 0BC0 or eax, eax
003719CB 75 02 jnz short 003719CF
003719CD EB 2B jmp short 003719FA
003719CF 53 push ebx
003719D0 52 push edx
003719D1 99 cdq
003719D2 0BD2 or edx, edx
003719D4 75 0B jnz short 003719E1
003719D6 83C0 02 add eax, 2
003719D9 0385 C0020000 add eax, [ebp+2C0]
003719DF EB 05 jmp short 003719E6
003719E1 25 FFFFFF7F and eax, 7FFFFFFF
003719E6 50 push eax
003719E7 56 push esi
00371A5E FF95 B0020000 call [ebp+2B0] ; kernel32.GetProcAddress
003719EE 8903 mov [ebx], eax
003719F0 5A pop edx
003719F1 5B pop ebx
003719F2 83C2 04 add edx, 4
003719F5 83C3 04 add ebx, 4
003719F8 ^ EB CD jmp short 003719C7
003719FA 83C7 14 add edi, 14
003719FD ^ EB 8D jmp short 0037198C
003719FF EB 75 jmp short 00371A76
00371A01 8B95 CC020000 mov edx, [ebp+2CC]
00371A07 03D5 add edx, ebp
00371A09 8B3A mov edi, [edx]
00371A0B 0BFF or edi, edi
00371A0D 75 02 jnz short 00371A11
00371A0F EB 65 jmp short 00371A76
00371A11 03BD C0020000 add edi, [ebp+2C0]
00371A17 83C2 05 add edx, 5
00371A1A 8BF2 mov esi, edx /edx=00371C3C, (ASCII "kernel32.dll") esi=00570000
00371A1C 56 push esi
00371A1D FF95 B4020000 call [ebp+2B4] ; kernel32.GetModuleHandleA
00371A23 0BC0 or eax, eax
00371A25 75 07 jnz short 00371A2E
00371A27 56 push esi
00371A28 FF95 B8020000 call [ebp+2B8]
00371A2E 0FB64E FF movzx ecx, byte ptr [esi-1] /函数在动态连接库的偏移量 ecx=0000000C
00371A32 03F1 add esi, ecx
00371A34 8BD6 mov edx, esi
00371A36 8BF0 mov esi, eax
00371A38 42 inc edx
00371A39 8B0A mov ecx, [edx]
00371A3B 83C2 04 add edx, 4
00371A3E 51 push ecx /调用动态连接态的函数个数
00371A3F 0FB602 movzx eax, byte ptr [edx]
00371A42 0BC0 or eax, eax
00371A44 75 14 jnz short 00371A5A
00371A46 42 inc edx
00371A47 52 push edx
00371A48 8B02 mov eax, [edx]
00371A4A 50 push eax
00371A4B 56 push esi
00371A5E FF95 B0020000 call [ebp+2B0] ; kernel32.GetProcAddress
00371A52 8907 mov [edi], eax
00371A54 5A pop edx
00371A55 83C2 04 add edx, 4
00371A58 EB 13 jmp short 00371A6D
00371A5A 42 inc edx /edx=00371C4D, (ASCII 15,"DeleteCriticalSection")
00371A5B 52 push edx
00371A5C 52 push edx
00371A5D 56 push esi
00371A5E FF95 B0020000 call [ebp+2B0] ; kernel32.GetProcAddress
00371A64 8907 mov [edi], eax ; ntdll.RtlDeleteCriticalSection
00371A66 5A pop edx
00371A67 0FB642 FF movzx eax, byte ptr [edx-1]
00371A6B 03D0 add edx, eax
00371A6D 42 inc edx
00371A6E 83C7 04 add edi, 4
00371A71 59 pop ecx
00371A72 ^ E2 CA loopd short 00371A3E /循环读取动态连接态的函数
00371A74 ^ EB 93 jmp short 00371A09 /读取下一个动态连接态
00371A76 8B85 C8020000 mov eax, [ebp+2C8] /F4在此
00371A7C 83F8 01 cmp eax, 1
00371A7F 75 27 jnz short 00371AA8
00371A81 8BBD D0020000 mov edi, [ebp+2D0]
00371A87 03FD add edi, ebp
00371A89 8DB5 59020000 lea esi, [ebp+259]
00371A8F 8B07 mov eax, [edi]
00371A91 0BC0 or eax, eax
00371A93 75 02 jnz short 00371A97
00371A95 EB 11 jmp short 00371AA8
00371A97 25 FFFFFF7F and eax, 7FFFFFFF
00371A9C 8BDE mov ebx, esi
00371A9E 2BD8 sub ebx, eax
00371AA0 8958 FC mov [eax-4], ebx
00371AA3 83C7 08 add edi, 8
00371AA6 ^ EB E7 jmp short 00371A8F
00371AA8 64:FF35 3000000>push dword ptr fs:[30]
00371AAF 58 pop eax
00371AB0 85C0 test eax, eax
00371AB2 78 0F js short 00371AC3
00371AB4 8B40 0C mov eax, [eax+C]
00371AB7 8B40 0C mov eax, [eax+C]
00371ABA C740 20 0010000>mov dword ptr [eax+20], 1000
00371AC1 EB 1C jmp short 00371ADF
00371AC3 6A 00 push 0
00371AC5 FF95 B4020000 call [ebp+2B4]
00371ACB 85D2 test edx, edx
00371ACD 79 10 jns short 00371ADF
00371ACF 837A 08 FF cmp dword ptr [edx+8], -1
00371AD3 75 0A jnz short 00371ADF
00371AD5 8B52 04 mov edx, [edx+4]
00371AD8 C742 50 0010000>mov dword ptr [edx+50], 1000
00371ADF 89AD 64020000 mov [ebp+264], ebp
00371AE5 8B85 D4020000 mov eax, [ebp+2D4]
00371AEB 0385 C0020000 add eax, [ebp+2C0]
00371AF1 FFE0 jmp eax /OEP?eax=004FD5E4
004FD5E4 55 push ebp /这应该是OEP吧?
004FD5E5 8BEC mov ebp, esp
004FD5E7 83C4 F0 add esp, -10
004FD5EA B8 44D14F00 mov eax, 004FD144
004FD5EF E8 348FF0FF call 00406528
004FD5F4 A1 00945000 mov eax, [509400]
004FD5F9 8B00 mov eax, [eax]
004FD5FB E8 AC03F8FF call 0047D9AC
004FD600 8B0D 74955000 mov ecx, [509574] ; 游戏菜单.0050AFDC
004FD606 A1 00945000 mov eax, [509400]
004FD60B 8B00 mov eax, [eax]
004FD60D 8B15 D0474F00 mov edx, [4F47D0] ; 游戏菜单.004F481C
004FD613 E8 AC03F8FF call 0047D9C4
004FD618 A1 00945000 mov eax, [509400]
004FD61D 8B00 mov eax, [eax]
004FD61F E8 2004F8FF call 0047DA44
004FD624 E8 E36AF0FF call 0040410C
我用DUMP下来,但运行出错了?用ImportREC的自动查找IAT,获取输入表,找到的都是无效指针,用查找IAT,它会提示把大小改为00121000,然后我跟着改了,它提示IAT读取成功,但是ImportREC卡住不动了。
请问高手们,偶应该怎么做好呢?本人第一次脱壳,请高手别见怪我这么菜!
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)