Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 6FD0C3B8 -> 6FD13AA0(6FD13980) -> 6FD11B1A(6FD11AD0) -> 6FD36053(6FD35FD0) -> 6FD35F5E(6FD35EE0) -> 6FD3643B(6FD363D0) -> (6FD3E050)
- // NtMapViewOfSection
- 00150000 55 push ebp
- 00150001 8bec mov ebp,esp
- 00150003 ff752c push dword ptr [ebp+2Ch]
- 00150006 ff7528 push dword ptr [ebp+28h]
- 00150009 ff7524 push dword ptr [ebp+24h]
- 0015000c ff7520 push dword ptr [ebp+20h]
- 0015000f ff751c push dword ptr [ebp+1Ch]
- 00150012 ff7518 push dword ptr [ebp+18h]
- 00150015 ff7514 push dword ptr [ebp+14h]
- 00150018 ff7510 push dword ptr [ebp+10h]
- 0015001b ff750c push dword ptr [ebp+0Ch]
- 0015001e ff7508 push dword ptr [ebp+8]
- 00150021 e88c010000 call 001501b2 // go back
- 00150026 85c0 test eax,eax
- 00150028 753f jne 00150069
- 0015002a 8b4510 mov eax,dword ptr [ebp+10h]
- 0015002d 8b00 mov eax,dword ptr [eax]
- 0015002f 3d0000807c cmp eax,7C800000h // Hook BaseDllInitialize
- 00150034 7414 je 0015004a
- 00150036 3d0000d06f cmp eax,6FD00000h
- 0015003b 752a jne 00150067
- 0015003d 05bcb30700 add eax,7B3BCh
- 00150042 c70000001600 mov dword ptr [eax],160000h
- 00150048 eb1d jmp 00150067
- 0015004a e85f010000 call 001501ae
- 0015004f 2d4f000000 sub eax,4Fh
- 00150054 8d9024060000 lea edx,[eax+624h]
- 0015005a 0502020000 add eax,202h
- 0015005f ff32 push dword ptr [edx]
- 00150061 50 push eax
- 00150062 e8f3000000 call 0015015a
- 00150067 33c0 xor eax,eax
- 00150069 c9 leave
- 0015006a c22800 ret 28h
- // Hook BaseDllInitialize
- 0015006d 55 push ebp
- 0015006e 8bec mov ebp,esp
- 00150070 53 push ebx
- 00150071 e838010000 call 001501ae
- 00150076 2d76000000 sub eax,76h
- 0015007b 8bd8 mov ebx,eax
- 0015007d 8d9024060000 lea edx,[eax+624h]
- 00150083 52 push edx
- 00150084 0507020000 add eax,207h
- 00150089 ff32 push dword ptr [edx]
- 0015008b 50 push eax
- 0015008c e8c9000000 call 0015015a // restore the original function
- 00150091 5a pop edx
- 00150092 ff7510 push dword ptr [ebp+10h]
- 00150095 ff750c push dword ptr [ebp+0Ch]
- 00150098 ff7508 push dword ptr [ebp+8]
- 0015009b ff12 call dword ptr [edx] // call BaseDllInitialize, jump to NtMapViewOfSection
- 0015009d 84c0 test al,al
- 0015009f 7423 je 001500c4
- 001500a1 8d830c020000 lea eax,[ebx+20Ch]
- 001500a7 badbae807c mov edx,7C80AEDBh
- 001500ac 50 push eax
- 001500ad ffd2 call edx // LoadLibraryW
- 001500af 85c0 test eax,eax
- 001500b1 740c je 001500bf
- 001500b3 ba20c3d06f mov edx,6FD0C320h
- 001500b8 6a00 push 0
- 001500ba 6a01 push 1
- 001500bc 50 push eax
- 001500bd ffd2 call edx // DllEntry
- 001500bf b801000000 mov eax,1
- 001500c4 5b pop ebx
- 001500c5 c9 leave
- 001500c6 c20c00 ret 0Ch
- // LdrLoadDll
- 001500c9 55 push ebp
- 001500ca 8bec mov ebp,esp
- 001500cc 53 push ebx
- 001500cd 56 push esi
- 001500ce 57 push edi
- 001500cf 8b5d10 mov ebx,dword ptr [ebp+10h]
- 001500d2 85db test ebx,ebx
- 001500d4 7460 je 00150136
- 001500d6 0fb70b movzx ecx,word ptr [ebx]
- 001500d9 85c9 test ecx,ecx
- 001500db 7459 je 00150136
- 001500dd 66b85c00 mov ax,5Ch
- 001500e1 8b7b04 mov edi,dword ptr [ebx+4]
- 001500e4 8d1439 lea edx,[ecx+edi]
- 001500e7 8d7afe lea edi,[edx-2]
- 001500ea d1e9 shr ecx,1
- 001500ec fd std
- 001500ed f266af repne scas word ptr es:[edi]
- 001500f0 7503 jne 001500f5
- 001500f2 83c702 add edi,2
- 001500f5 fc cld
- 001500f6 83c702 add edi,2
- 001500f9 8bca mov ecx,edx
- 001500fb 2bcf sub ecx,edi
- 001500fd d1e9 shr ecx,1
- 001500ff 81f90b000000 cmp ecx,0Bh
- 00150105 752f jne 00150136
- 00150107 8bf7 mov esi,edi
- 00150109 bf48041500 mov edi,150448h
- 0015010e 85ff test edi,edi
- 00150110 7424 je 00150136
- 00150112 66ad lods word ptr [esi]
- 00150114 6683f861 cmp ax,61h
- 00150118 720a jb 00150124
- 0015011a 6683f87a cmp ax,7Ah
- 0015011e 7704 ja 00150124
- 00150120 6683e820 sub ax,20h
- 00150124 66af scas word ptr es:[edi]
- 00150126 750e jne 00150136
- 00150128 e2e8 loop 00150112
- 0015012a e87f000000 call 001501ae
- 0015012f 05ed040000 add eax,4EDh
- 00150134 8bd8 mov ebx,eax
- 00150136 ff7514 push dword ptr [ebp+14h]
- 00150139 53 push ebx
- 0015013a ff750c push dword ptr [ebp+0Ch]
- 0015013d ff7508 push dword ptr [ebp+8]
- 00150140 e895000000 call 001501da // go back
- 00150145 85c0 test eax,eax
- 00150147 740a je 00150153
- 00150149 3b5d10 cmp ebx,dword ptr [ebp+10h]
- 0015014c 7405 je 00150153
- 0015014e 8b5d10 mov ebx,dword ptr [ebp+10h]
- 00150151 ebe3 jmp 00150136
- 00150153 5f pop edi
- 00150154 5e pop esi
- 00150155 5b pop ebx
- 00150156 c9 leave
- 00150157 c21000 ret 10h
- // Hook function
- 0015015a 55 push ebp
- 0015015b 8bec mov ebp,esp
- 0015015d 83c4f4 add esp,0FFFFFFF4h
- 00150160 53 push ebx
- 00150161 56 push esi
- 00150162 57 push edi
- 00150163 c745f805000000 mov dword ptr [ebp-8],5
- 0015016a 8b450c mov eax,dword ptr [ebp+0Ch]
- 0015016d 8945fc mov dword ptr [ebp-4],eax
- 00150170 bbd0d6927c mov ebx,7C92D6D0h
- 00150175 8d45f4 lea eax,[ebp-0Ch]
- 00150178 50 push eax
- 00150179 6a04 push 4
- 0015017b 8d45f8 lea eax,[ebp-8]
- 0015017e 50 push eax
- 0015017f 8d45fc lea eax,[ebp-4]
- 00150182 50 push eax
- 00150183 6aff push 0FFFFFFFFh
- 00150185 ffd3 call ebx
- 00150187 8b7508 mov esi,dword ptr [ebp+8]
- 0015018a 8b7d0c mov edi,dword ptr [ebp+0Ch]
- 0015018d b905000000 mov ecx,5
- 00150192 f3a4 rep movs byte ptr es:[edi],byte ptr [esi]
- 00150194 8d45f4 lea eax,[ebp-0Ch]
- 00150197 50 push eax
- 00150198 ff75f4 push dword ptr [ebp-0Ch]
- 0015019b 8d45f8 lea eax,[ebp-8]
- 0015019e 50 push eax
- 0015019f 8d45fc lea eax,[ebp-4]
- 001501a2 50 push eax
- 001501a3 6aff push 0FFFFFFFFh
- 001501a5 ffd3 call ebx
- 001501a7 5f pop edi
- 001501a8 5e pop esi
- 001501a9 5b pop ebx
- 001501aa c9 leave
- 001501ab c20800 ret 8
- 001501ae 8b0424 mov eax,dword ptr [esp]
- 001501b1 c3 ret
- // go back
- 001501b2 b86c000000 mov eax,6Ch
- 001501b7 e949d37d7c jmp 7c92d505
- 001501bc 92 xchg eax,edx
- 001501bd 7ceb jl 001501aa
- 001501bf 21807c5c0500 and dword ptr [eax+55C7Ch],eax
- 001501c5 0000 add byte ptr [eax],al
- 001501c7 d592 aadb 92h
- 001501c9 7c8c jl 00150157
- 001501cb 97 xchg eax,edi
- 001501cc 1200 adc al,byte ptr [eax]
- 001501ce 2800 sub byte ptr [eax],al
- 001501d0 0000 add byte ptr [eax],al
- 001501d2 6c ins byte ptr es:[edi],dx
- 001501d3 97 xchg eax,edi
- 001501d4 12b86c000000 adc bh,byte ptr [eax+6Ch]
- // Go back
- 001501da 686c020000 push 26Ch
- 001501df e9c4617e7c jmp 7c9363a8
- 001501e4 92 xchg eax,edx
- 001501e5 7ceb jl 001501d2
- 001501e7 21807c5c0500 and dword ptr [eax+55C7Ch],eax
- 001501ed 00a363937c8c add byte ptr [ebx-73836C9Dh],ah
- 001501f3 97 xchg eax,edi
- 001501f4 1200 adc al,byte ptr [eax]
- 001501f6 2800 sub byte ptr [eax],al
- 001501f8 0000 add byte ptr [eax],al
- 001501fa 6c ins byte ptr es:[edi],dx
- 001501fb 97 xchg eax,edi
- 001501fc 12686c adc ch,byte ptr [eax+6Ch]
- 001501ff 0200 add al,byte ptr [eax]
- 00150201 00e9 add cl,ch
- 00150203 2a4a94 sub cl,byte ptr [edx-6Ch]
- 00150206 838bff558bec5a or dword ptr [ebx-1374AA01h],5Ah
- 0015020d 003a add byte ptr [edx],bh
- 0015020f 005c0063 add byte ptr [eax+eax+63h],bl
- 00150213 006500 add byte ptr [ebp],ah
- 00150216 650064006f add byte ptr gs:[eax+eax+6Fh],ah
- 0015021b 005c0043 add byte ptr [eax+eax+43h],bl
- 0015021f 006500 add byte ptr [ebp],ah
- 00150222 650064006f add byte ptr gs:[eax+eax+6Fh],ah
- 00150227 005c0053 add byte ptr [eax+eax+53h],bl
- 0015022b 006d00 add byte ptr [ebp],ch
- 0015022e 61 popad
- 0015022f 007200 add byte ptr [edx],dh
- 00150232 7400 je 00150234
- 00150234 50 push eax
- 00150235 006c0061 add byte ptr [eax+eax+61h],ch
- 00150239 007900 add byte ptr [ecx],bh
- 0015023c 65007200 add byte ptr gs:[edx],dh
- 00150240 5c pop esp
- 00150241 006e00 add byte ptr [esi],ch
- 00150244 61 popad
- 00150245 007000 add byte ptr [eax],dh
- 00150248 6300 arpl word ptr [eax],ax
- 0015024a 6f outs dx,dword ptr [esi]
- 0015024b 007200 add byte ptr [edx],dh
- 0015024e 65002e add byte ptr gs:[esi],ch
- 00150251 0064006c add byte ptr [eax+eax+6Ch],ah
- 00150255 006c0000 add byte ptr [eax+eax],ch
- 00150259 0000 add byte ptr [eax],al
- 00150411 0000 add byte ptr [eax],al
- 00150413 005a00 add byte ptr [edx],bl
- 00150416 3a00 cmp al,byte ptr [eax]
- 00150418 5c pop esp
- 00150419 006300 add byte ptr [ebx],ah
- 0015041c 65006500 add byte ptr gs:[ebp],ah
- 00150420 64006f00 add byte ptr fs:[edi],ch
- 00150424 5c pop esp
- 00150425 005700 add byte ptr [edi],dl
- 00150428 69006e006400 imul eax,dword ptr [eax],64006Eh
- 0015042e 6f outs dx,dword ptr [esi]
- 0015042f 007700 add byte ptr [edi],dh
- 00150432 7300 jae 00150434
- 00150434 5c pop esp
- 00150435 005300 add byte ptr [ebx],dl
- 00150438 7900 jns 0015043a
- 0015043a 7300 jae 0015043c
- 0015043c 7400 je 0015043e
- 0015043e 65006d00 add byte ptr gs:[ebp],ch
- 00150442 3300 xor eax,dword ptr [eax]
- 00150444 3200 xor al,byte ptr [eax]
- 00150446 5c pop esp
- 00150447 004d00 add byte ptr [ebp],cl
- 0015044a 53 push ebx
- 0015044b 004300 add byte ptr [ebx],al
- 0015044e 4f dec edi
- 0015044f 005200 add byte ptr [edx],dl
- 00150452 45 inc ebp
- 00150453 004500 add byte ptr [ebp],al
- 00150456 2e0044004c add byte ptr cs:[eax+eax+4Ch],al
- 0015045b 004c0000 add byte ptr [eax+eax],cl
- 0015045f 0000 add byte ptr [eax],al
- KiUserApcDispatcher -> LdrpInitializeProcess -> LdrpLoadDll(kernel32.dll) -> LdrMapDll -> ZwMapViewOfSection
- LdrpCallInitRoutine -> BaseDllInitialize
- CShellExecute::_DoExecCommand -> ShCreateProcess -> CreateProcess
- ceedo.exehook了SheelExecuteEx,当其启动子进程时,会hook子进程的LdrLoadDll和NtMapViewOfSection,并且通过VirtualAlloc分配一块空间用来写入自定义的被hook的函数。主线程启动后,子进程加载kernel32.dll,被hook的NtMapViewOfSection会hook kernel32!BaseDllInitialize. 当运行被hook的BaseDllInitialize时,napcore.dll会被加载并调用其DllEntryPoint函数。DllEntryPoint会hook ntdll和kernel32中的函数。具体操作是:将原函数的前5个字节保存,计算原函数与hook函数的地址差,将地址差写到原函数的前5个字节。此时,DllEntryPoint会hook ntdll!NtMapViewOfSection,当子进程还需要加载其他dll时,会hook该dll中的函数。
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement