已加壳程序可从 UnPackMe_ChinaProtect 0.3.rar处下载
已脱壳后程序 UnPackMe_ChinaProtect 0.3(脱壳后).rar下载
一、该壳通过TLS偷偷运行程序,大部分壳解密处理都在TLS部分进行;
二、关键指令运行需先解密,运行完后,又进行加密保护;
三、运用SEH阻止、干扰调试软件跟踪、调试,其位于003B1CBA ;
1、将硬件断点全部清除
wwww:003B1E7F xor eax, eax
wwww:003B1E81 cmp ecx, 12h
wwww:003B1E84 mov [esi+10h], eax
wwww:003B1E87 mov [esi+0Ch], eax
wwww:003B1E8A mov [esi+8], eax
wwww:003B1E8D mov [esi+4], eax
2、模糊、改变程序流程
出现SEH时对应处理如下
mov Code,[eip],1
E6:"jc short "
FB:"jnc short "
ED:"je short "
6C:"jne short "
6D:"jna short "
CF:"ja short "
E4:"jl short "
F4:"jnl short "
F1:"jle short "
E7:"jnle short "
EC:"jmp short "
6F:"call "
6E:"jmp Long "
.
.
.
四、复制USER32.DLL、KERNEL32.DLL大部份映像到内存9C0000、930000段,从而干扰调试;
五、利用子进程StartupInfo存储的父进程ID,实现父子进程间相互蹂躏,同时动作,最终完成解密;--前所未有
wwww:003B1784 ZProcess_Debug_OwerProcess proc near
wwww:003B1784
wwww:003B1784 var_DC = dword ptr -0DCh
wwww:003B1784 var_D8 = dword ptr -0D8h
wwww:003B1784 var_D4 = dword ptr -0D4h
wwww:003B1784 var_D0 = dword ptr -0D0h
wwww:003B1784 var_C8 = dword ptr -0C8h
wwww:003B1784 var_7C = byte ptr -7Ch
wwww:003B1784 var_6C = dword ptr -6Ch
wwww:003B1784 var_38 = dword ptr -38h
wwww:003B1784 var_34 = dword ptr -34h
wwww:003B1784 var_30 = dword ptr -30h
wwww:003B1784 var_2C = dword ptr -2Ch
wwww:003B1784 var_8 = dword ptr -8
wwww:003B1784 var_4 = dword ptr -4
wwww:003B1784
wwww:003B1784 push ebp
wwww:003B1785 mov ebp, esp
wwww:003B1787 sub esp, 0DCh
wwww:003B178D push ebx
wwww:003B178E push esi
wwww:003B178F push edi
wwww:003B1790 ; wwww:003B1790
wwww:003B179F mov [ebp+var_4], 248h
wwww:003B17A6 call $+5
wwww:003B17AB pop eax
wwww:003B17AC sub eax, 19A7h
wwww:003B17B1 add eax, [ebp+var_4]
wwww:003B17B4 lea ecx, [ebp+var_7C]
wwww:003B17B7 push ecx
wwww:003B17B8 push dword ptr [eax]
wwww:003B17BA call DecryptAPIAndCall ; GetStartupInfoA
wwww:003B17BF mov esi, [ebp+var_6C]
wwww:003B17C2 pop ecx
wwww:003B17C3 pop ecx
wwww:003B17C4 mov [ebp+var_4], 230h
wwww:003B17CB call $+5
wwww:003B17D0 pop eax
wwww:003B17D1 sub eax, 19CCh
wwww:003B17D6 add eax, [ebp+var_4]
wwww:003B17D9 push esi ;父进程ID
wwww:003B17DA push dword ptr [eax]
wwww:003B17DC call DecryptAPIAndCall ; DebugActiveProcess
wwww:003B17E1 pop ecx
wwww:003B17E2 pop ecx
wwww:003B17E3 mov [ebp+var_38], 288h
wwww:003B17EA mov [ebp+var_34], 220h
wwww:003B17F1 mov ebx, 21Ch
wwww:003B17F6
wwww:003B17F6 loc_3B17F6:
wwww:003B17F6 call $+5
wwww:003B17FB pop eax
wwww:003B17FC sub eax, 19F7h
wwww:003B1801 add eax, [ebp+var_38]
wwww:003B1804 push 0FFFFFFFFh
wwww:003B1806 lea ecx, [ebp+var_DC]
wwww:003B180C push ecx
wwww:003B180D push dword ptr [eax]
wwww:003B180F call DecryptAPIAndCall ; WaitForDebugEvent
wwww:003B1814 mov eax, [ebp+var_DC]
wwww:003B181A add esp, 0Ch
wwww:003B181D cmp eax, 1 ; 异常调试信息
wwww:003B1820 mov [ebp+var_4], 80010001h
wwww:003B1827 jnz short loc_3B183E
wwww:003B1829 lea eax, [ebp+var_DC]
wwww:003B182F push eax
wwww:003B1830 lea eax, [ebp+var_30]
wwww:003B1833 push eax
wwww:003B1834 call ZProcess_ChuLi_OwerSeh
wwww:003B1839 mov [ebp+var_4], eax
wwww:003B183C jmp short loc_3B18BD
wwww:003B183E
wwww:003B183E loc_3B183E:
wwww:003B183E cmp eax, 3 ; 第一次调试信息
wwww:003B1841 jnz short loc_3B186E
wwww:003B1843 push 0Ah
wwww:003B1845 pop ecx
wwww:003B1846 lea esi, [ebp+var_D0]
wwww:003B184C lea edi, [ebp+var_30]
wwww:003B184F rep movsd
wwww:003B1851 mov esi, [ebp+var_C8]
wwww:003B1857 mov [ebp+var_8], 26Ch
wwww:003B185E call $+5
wwww:003B1863 pop eax
wwww:003B1864 sub eax, 1A5Fh
wwww:003B1869 add eax, [ebp+var_8]
wwww:003B186C jmp short loc_3B18B3
wwww:003B186E
wwww:003B186E loc_3B186E:
wwww:003B186E cmp eax, 5 ; debug_exitprocess
wwww:003B1871 jnz short loc_3B1897
wwww:003B1873 mov esi, [ebp+var_30]
wwww:003B1876 mov [ebp+var_8], ebx
wwww:003B1879 call $+5
wwww:003B187E pop eax
wwww:003B187F sub eax, 1A7Ah
wwww:003B1884 add eax, [ebp+var_8]
wwww:003B1887 push esi
wwww:003B1888 push dword ptr [eax]
wwww:003B188A call DecryptAPIAndCall
wwww:003B188F and [ebp+var_2C], 0
wwww:003B1893 pop ecx
wwww:003B1894 pop ecx
wwww:003B1895 jmp short loc_3B18BD
wwww:003B1897
wwww:003B1897 loc_3B1897:
wwww:003B1897 cmp eax, 6
wwww:003B189A jnz short loc_3B18BD
wwww:003B189C mov esi, [ebp+var_D0]
wwww:003B18A2 mov [ebp+var_8], ebx
wwww:003B18A5 call $+5
wwww:003B18AA pop eax
wwww:003B18AB sub eax, 1AA6h
wwww:003B18B0 add eax, [ebp+var_8]
wwww:003B18B3
wwww:003B18B3 loc_3B18B3:
wwww:003B18B3 push esi
wwww:003B18B4 push dword ptr [eax]
wwww:003B18B6 call DecryptAPIAndCall ; ResumeThread
wwww:003B18BB pop ecx
wwww:003B18BC pop ecx
wwww:003B18BD
wwww:003B18BD loc_3B18BD:
wwww:003B18BD
wwww:003B18BD mov esi, [ebp+var_D4]
wwww:003B18C3 mov edi, [ebp+var_D8]
wwww:003B18C9 call $+5
wwww:003B18CE pop eax
wwww:003B18CF sub eax, 1ACAh
wwww:003B18D4 add eax, [ebp+var_34]
wwww:003B18D7 push [ebp+var_4]
wwww:003B18DA push esi
wwww:003B18DB push edi
wwww:003B18DC push dword ptr [eax]
wwww:003B18DE call DecryptAPIAndCall
wwww:003B18E3 add esp, 10h
wwww:003B18E6 cmp [ebp+var_2C], 0
wwww:003B18EA jnz loc_3B17F6
wwww:003B18F0 call sub_3B3098
wwww:003B18F5 ; wwww:003B18F5
wwww:003B1904 pop edi
wwww:003B1905 pop esi
wwww:003B1906 pop ebx
wwww:003B1907 leave
wwww:003B1908 retn
wwww:003B1908 ZProcess_Debug_OwerProcess endp
六、利用OutputDebugStringA、IsDebuggerPresent、GetProcessHeap、VirtualProtect、FindWindowA、GetStartupInfoA、CreateFileA等函数来检测是否被调试;
七、运行任何DLL函数都要检测CC标记(INT3断点),就连其自身设置的AddressOfEntryPoint也不例外;
wwww:003B1191 jianCe_Funtion_CC proc near
wwww:003B1191 push ebx
wwww:003B1192 push esi
wwww:003B1193 push edi
wwww:003B1194 mov esi, ecx
wwww:003B1196 ; wwww:003B1196
wwww:003B11A5 push dword ptr [esi+28h]
wwww:003B11A8 lea edi, [esi+28h]
wwww:003B11AB call Xor_P3B00A4_ARG_0_To_Eax
wwww:003B11B0 mov ebx, eax
wwww:003B11B2 movzx eax, byte ptr [ebx]
wwww:003B11B5 lea eax, [eax+eax*2]
wwww:003B11B8 cmp eax, 264h ; CC指令*3
wwww:003B11BD jnz short loc_3B11C5
wwww:003B11BF push ebx
wwww:003B11C0 call Chuli_JianCe_JieGuo ;
wwww:003B11C5
wwww:003B11C5 loc_3B11C5:
wwww:003B11C5 mov eax, [esi]
wwww:003B11C7 mov [eax+1], edi
wwww:003B11CA mov eax, [esi]
wwww:003B11CC mov ecx, [esi+24h]
wwww:003B11CF mov [eax+6], ecx
wwww:003B11D2 mov eax, [esi]
wwww:003B11D4 mov [esi+24h], ebx
wwww:003B11D7 mov [edi], eax
wwww:003B11D9 ; wwww:003B11D9
wwww:003B11E8 pop edi
wwww:003B11E9 pop esi
wwww:003B11EA pop ebx
wwww:003B11EB retn
wwww:003B11EB jianCe_Funtion_CC endp
八、通过运行某一程序段才能调用引入表函数;
九、抽取了部分运行代码到某一低于400000的内存段,并进行了花指令及代码替换处理
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课