用的还是先前的HideW程序,只不过这次是加了个aspack0040D001 > 60 pushad ; OD载入后停在了这里
0040D002 E8 03000000 call HideW.0040D00A
0040D007 - E9 EB045D45 jmp 459DD4F7
0040D00C 55 push ebp
0040D00D C3 retn
0040D00E E8 01000000 call HideW.0040D014
0040D013 EB 5D jmp XHideW.0040D072
0040D015 BB EDFFFFFF mov ebx,-0x13
0040D01A 03DD add ebx,ebp
0040D01C 81EB 00D00000 sub ebx,0xD000
像往常一样,F8步过,却发现跑飞了,于是重新开始,F7步入这个call里0040D00A 5D pop ebp ; 发现就一条有用的指令,即inc ebp
0040D00B 45 inc ebp
0040D00C 55 push ebp
0040D008 /EB 04 jmp XHideW.0040D00E ; 居然retn到这里了 F8JMP过去
0040D00A |5D pop ebp ; 发现就一条有用的指令,即inc ebp
0040D00B |45 inc ebp
0040D00C |55 push ebp
0040D00D |C3 retn
0040D00E \E8 01000000 call HideW.0040D014
0040D013 EB 5D jmp XHideW.0040D072
0040D015 BB EDFFFFFF mov ebx,-0x13
0040D01A 03DD add ebx,ebp
0040D01C 81EB 00D00000 sub ebx,0xD000
0040D022 83BD 22040000 0>cmp dword ptr ss:[ebp+0x422],0x0
0040D029 899D 22040000 mov dword ptr ss:[ebp+0x422],ebx
0040D02F 0F85 65030000 jnz HideW.0040D39A
这个地方感觉很神奇,原来刚开始的那个CALL后的0040D007 - E9 EB045D45 jmp 459DD4F7根本就不会被执行到
再仔细看一下,这个JMP过去的地址也很奇怪,以后再看到这样的就要多长个心眼了
继续吧,这下面的要F4了,不然一直在循环,出不来0040D12D 0BC9 or ecx,ecx
0040D12F 74 2E je XHideW.0040D15F ; 这两个跳转均未实现
0040D131 78 2C js XHideW.0040D15F ; 但是循环了几次发现,最终肯定会跳过去的,所以就直接F4执行到那里
0040D133 AC lods byte ptr ds:[esi]
0040D134 3C E8 cmp al,0xE8
0040D136 74 0A je XHideW.0040D142
0040D138 EB 00 jmp XHideW.0040D13A
0040D13A 3C E9 cmp al,0xE9
0040D13C 74 04 je XHideW.0040D142
0040D13E 43 inc ebx
0040D13F 49 dec ecx
0040D140 ^ EB EB jmp XHideW.0040D12D
0040D142 8B06 mov eax,dword ptr ds:[esi]
0040D144 EB 00 jmp XHideW.0040D146
0040D146 803E 00 cmp byte ptr ds:[esi],0x0
0040D149 ^ 75 F3 jnz XHideW.0040D13E
0040D14B 24 00 and al,0x0
0040D14D C1C0 18 rol eax,0x18
0040D150 2BC3 sub eax,ebx
0040D152 8906 mov dword ptr ds:[esi],eax
0040D154 83C3 05 add ebx,0x5
0040D157 83C6 04 add esi,0x4
0040D15A 83E9 05 sub ecx,0x5
0040D15D ^ EB CE jmp XHideW.0040D12D ; 这个是往回跳的,就在上面两个跳转的前面
0040D15F 5B pop ebx ; 所以必定会执行到这里
0040D160 5E pop esi
0040D161 59 pop ecx
0040D162 58 pop eax
0040D163 EB 08 jmp XHideW.0040D16D
继续0040D395 ^\E9 EBFEFFFF jmp HideW.0040D285 ; 不能向上跳,不然又会到上面那个循环中去了
0040D39A B8 3F110000 mov eax,0x113F
0040D39F 50 push eax
0040D3A0 0385 22040000 add eax,dword ptr ss:[ebp+0x422]
0040D3A6 59 pop ecx
0040D3A7 0BC9 or ecx,ecx
0040D3A9 8985 A8030000 mov dword ptr ss:[ebp+0x3A8],eax
0040D3AF 61 popad ;看到POPAD了
0040D3B0 75 08 jnz XHideW.0040D3BA ;跳转,所以下面第一个retn是没执行的
0040D3B2 B8 01000000 mov eax,0x1
0040D3B7 C2 0C00 retn 0xC
0040D3BA 68 00000000 push 0x0
0040D3BF C3 retn ; 这之后就是OEP了
此时的堆栈:
0012FFC0 0040113F HideW.0040113F
0012FFC4 7C817077 返回到 kernel32.7C817077
0012FFC8 7C930228 ntdll.7C930228
F8后
看来一切都是正确的了0040113F . 6A 00 push 0x0 ; /pModule = NULL
00401141 . E8 86010000 call HideW.004012CC ; \GetModuleHandleA
00401146 . A3 18304000 mov dword ptr ds:[0x403018],eax
0040114B . C705 3C304000>mov dword ptr ds:[0x40303C],0x30
00401155 . C705 40304000>mov dword ptr ds:[0x403040],0x3
0040115F . C705 44304000>mov dword ptr ds:[0x403044],HideW.00>
00401169 . C705 48304000>mov dword ptr ds:[0x403048],0x0
00401173 . C705 4C304000>mov dword ptr ds:[0x40304C],0x1E
0040117D . FF35 18304000 push dword ptr ds:[0x403018]
00401183 . 8F05 50304000 pop dword ptr ds:[0x403050]
00401189 . C705 5C304000>mov dword ptr ds:[0x40305C],0x10
00401193 . C705 60304000>mov dword ptr ds:[0x403060],0x0
0040119D . C705 64304000>mov dword ptr ds:[0x403064],HideW.00>; ASCII "DLGCLASS"
004011A7 . 68 007F0000 push 0x7F00 ; /RsrcName = IDI_APPLICATION
004011AC . 6A 00 push 0x0 ; |hInst = NULL
004011AE . E8 DD000000 call HideW.00401290 ; \LoadIconA
004011B3 . A3 54304000 mov dword ptr ds:[0x403054],eax
004011B8 . A3 68304000 mov dword ptr ds:[0x403068],eax
004011BD . 68 007F0000 push 0x7F00 ; /RsrcName = IDC_ARROW
004011C2 . 6A 00 push 0x0 ; |hInst = NULL
004011C4 . E8 C1000000 call HideW.0040128A ; \LoadCursorA
004011C9 . A3 58304000 mov dword ptr ds:[0x403058],eax
004011CE . 68 3C304000 push HideW.0040303C ; /pWndClassEx = HideW.0040303C
004011D3 . E8 C4000000 call HideW.0040129C ; \RegisterClassExA
004011D8 . 6A 00 push 0x0 ; /lParam = 0
004011DA . 68 00104000 push HideW.00401000 ; |pDlgProc = HideW.00401000
004011DF . 6A 00 push 0x0 ; |hOwner = NULL
004011E1 . 6A 65 push 0x65 ; |pTemplate = 65
004011E3 . FF35 18304000 push dword ptr ds:[0x403018] ; |hInst = NULL
004011E9 . E8 78000000 call HideW.00401266 ; \CreateDialogParamA
004011EE . A3 1C304000 mov dword ptr ds:[0x40301C],eax
004011F3 . 68 64B04000 push HideW.0040B064 ; /IniFileName = ""
004011F8 . 6A 00 push 0x0 ; |Default = 0
004011FA . 68 73204000 push HideW.00402073 ; |Key = "ShowSelf"
004011FF . 68 6B204000 push HideW.0040206B ; |Section = "Default"
00401204 . E8 C9000000 call HideW.004012D2 ; \GetPrivateProfileIntA
00401209 . 50 push eax ; /ShowState
0040120A . FF35 1C304000 push dword ptr ds:[0x40301C] ; |hWnd = NULL
00401210 . E8 99000000 call HideW.004012AE ; \ShowWindow
00401215 . FF35 1C304000 push dword ptr ds:[0x40301C] ; /hWnd = NULL
0040121B . E8 9A000000 call HideW.004012BA ; \UpdateWindow
00401220 > 6A 00 push 0x0 ; /MsgFilterMax = 0
00401222 . 6A 00 push 0x0 ; |MsgFilterMin = 0
00401224 . 6A 00 push 0x0 ; |hWnd = NULL
00401226 . 68 20304000 push HideW.00403020 ; |pMsg = HideW.00403020
0040122B . E8 4E000000 call HideW.0040127E ; \GetMessageA
00401230 . 0BC0 or eax,eax
00401232 . 74 2A je XHideW.0040125E
00401234 . 68 20304000 push HideW.00403020 ; /pMsg = WM_NULL
00401239 . FF35 1C304000 push dword ptr ds:[0x40301C] ; |hWnd = NULL
0040123F . E8 40000000 call HideW.00401284 ; \IsDialogMessageA
00401244 . 0BC0 or eax,eax
00401246 . 75 14 jnz XHideW.0040125C
00401248 . 68 20304000 push HideW.00403020 ; /pMsg = WM_NULL
0040124D . E8 62000000 call HideW.004012B4 ; \TranslateMessage
00401252 . 68 20304000 push HideW.00403020 ; /pMsg = WM_NULL
00401257 . E8 16000000 call HideW.00401272 ; \DispatchMessageA
0040125C >^ EB C2 jmp XHideW.00401220
0040125E > 6A 00 push 0x0 ; /ExitCode = 0
00401260 . E8 5B000000 call HideW.004012C0 ; \ExitProcess
入口点113F,用OD的插件ollydump脱壳之
运行一下,一切正常,脱壳成功
一段小插曲:我开始retn后看到的可不是这样的,以为不是入口点,大牛答曰,这就是入口点了,请点击一下右键,选择分析代码,然后就是上面这个样子了。
附件说明:HideW.exe为aspack加壳的程序
~~HideW.exe为我脱壳后的程序
原未加壳程序见这里:http://wt.52pojie.cn/thread-81036-1-1.html
set.ini是配制文件,上文中有说明
后来请教大牛得知,aspack壳开头部分的call那里其实是一种花指令,而且也很常见。关于花指令的更多内容,请百度大致了解下,我是懒人,且这不是我目前想看的,所以忽略之。
我觉得初学者应学会忽略,有些东西不应死钻,了解就好,专注当前最重要的部分就可以了,等到需要时再去重点学习这一方面的。
附上本人的学习方法 经验
http://wt.52pojie.cn/thread-81211-1-1.html
|