这个文件是DLL文件,但是用IDA打开文件后停在了WinMain处,而不是DllMain,并且整个文件里也没有这个函数。既然是DLL文件就先看看导出函数吧。下面是该函数后面一部分:
loc_401D2F: ; CODE XREF: start+F7j
.text:00401D2F mov [ebp+StartupInfo.dwFlags], ebx
.text:00401D32 lea eax, [ebp+StartupInfo]
.text:00401D35 push eax ; lpStartupInfo
.text:00401D36 call ds:GetStartupInfoA ;获取进程创建时它的main window的一些信息
.text:00401D3C test byte ptr [ebp+StartupInfo.dwFlags], 1
.text:00401D40 jz short loc_401D53
.text:00401D42 movzx eax, [ebp+StartupInfo.wShowWindow]
.text:00401D46 jmp short loc_401D56
.text:00401D48 ; ---------------------------------------------------------------------------
.text:00401D53
.text:00401D53 loc_401D53: ; CODE XREF: start+10Ej
.text:00401D53 push 0Ah
.text:00401D55 pop eax
.text:00401D56
.text:00401D56 loc_401D56: ; CODE XREF: start+114j
.text:00401D56 push eax ; nShowCmd
.text:00401D57 push esi ; lpCmdLine
.text:00401D58 push ebx ; hPrevInstance
.text:00401D59 push ebx ; lpModuleName
.text:00401D5A call ds:GetModuleHandleA
.text:00401D60 push eax ; hInstance
.text:00401D61 call _WinMain@16 ; WinMain(x,x,x,x)在这个函数里做点事
.text:00401D66 mov [ebp+var_68], eax
.text:00401D69 push eax ; Code
.text:00401D6A call ds:exit
WinMain是一个函数,该函数的功能是被系统调用,作为一个32位应用程序的入口点。(摘自百度百科)为什么会在DLL里出现?不明白看看它要做什么,谁知道请指点一下:)。
mov ecx, [ebp+var_4]
.text:00401071 push ecx
.text:00401072 call sub_40133B ;**1**接下来分析这个例程
.text:00401077 add esp, 4
.text:0040107A push offset FileName ;**2** "C:\\Windows\\system32\\Instell.exe"
.text:0040107F call ds:DeleteFileA
在1处的函数调用其他函数:
push ecx
.text:00401181 push offset Format ; "[%s] - %s\r\n"
.text:00401186 lea edx, [ebp+Dest]
.text:0040118C push edx ; Dest
.text:0040118D call ds:sprintf
.text:00401193 add esp, 10h
.text:00401196 push 104h ; uSize
.text:0040119B lea eax, [ebp+FileName]
.text:004011A1 push eax ; lpBuffer
.text:004011A2 call ds:GetSystemDirectoryA
.text:004011A8 push offset Source ; "\\httpcom.log"
.text:004011AD lea ecx, [ebp+FileName]
.text:004011B3 push ecx ; Dest
.text:004011B4 call strcat
.text:004011B9 add esp, 8
.text:004011BC push 0 ; hTemplateFile
.text:004011BE push 80h ; dwFlagsAndAttributes
.text:004011C3 push 4 ; dwCreationDisposition
.text:004011C5 push 0 ; lpSecurityAttributes
.text:004011C7 push 1 ; dwShareMode
.text:004011C9 push 40000000h ; dwDesiredAccess
.text:004011CE lea edx, [ebp+FileName]
.text:004011D4 push edx ; lpFileName
.text:004011D5 call ds:CreateFileA
.text:004011DB mov [ebp+hFile], eax
.text:004011DE cmp [ebp+hFile], 0FFFFFFFFh
.text:004011E2 jnz short loc_4011E9
.text:004011E4 jmp loc_40128D
.text:004011E9 ; ---------------------------------------------------------------------------
.text:004011E9
.text:004011E9 loc_4011E9: ; CODE XREF: sub_4010CD+115j
.text:004011E9 push 2 ; dwMoveMethod
.text:004011EB push 0 ; lpDistanceToMoveHigh
.text:004011ED push 0 ; lDistanceToMove
.text:004011EF mov eax, [ebp+hFile]
.text:004011F2 push eax ; hFile
.text:004011F3 call ds:SetFilePointer
.text:004011F9 push 0 ; lpOverlapped
.text:004011FB lea ecx, [ebp+NumberOfBytesWritten]
.text:00401201 push ecx ; lpNumberOfBytesWritten
.text:00401202 lea edx, [ebp+Dest]
.text:00401208 push edx ; Str
.text:00401209 call strlen
.text:0040120E add esp, 4
.text:00401211 push eax ; nNumberOfBytesToWrite
.text:00401212 lea eax, [ebp+Dest]
.text:00401218 push eax ; lpBuffer
.text:00401219 mov ecx, [ebp+hFile]
.text:0040121C push ecx ; hFile
.text:0040121D call ds:WriteFile
.text:00401223 lea edx, [ebp+SystemTime]
.text:00401229 push edx ; lpSystemTime
.text:0040122A call ds:GetSystemTime
.text:00401230 mov [ebp+SystemTime.wYear], 7D6h
.text:00401239 lea eax, [ebp+FileTime]
.text:0040123F push eax ; lpFileTime
.text:00401240 lea ecx, [ebp+SystemTime]
.text:00401246 push ecx ; lpSystemTime
.text:00401247 call ds:SystemTimeToFileTime
.text:0040124D lea edx, [ebp+FileTime]
.text:00401253 push edx ; lpLastWriteTime
.text:00401254 lea eax, [ebp+FileTime]
.text:0040125A push eax ; lpLastAccessTime
.text:0040125B lea ecx, [ebp+FileTime]
.text:00401261 push ecx ; lpCreationTime
.text:00401262 mov edx, [ebp+hFile]
.text:00401265 push edx ; hFile
.text:00401266 call ds:SetFileTime
它的主要操作就是在系统文件目录下创建了一个httpcom.log 的文件好像是记录相关时间和这个文件里的代码是否执行成功。
在2处可以看出了程序要删除install.exe文件,说明这个DLL文件可能要通过它来将自己加载到某个地方,然后才能执行里面的代码。可惜没有它的安装文件。到这里没有发现它有什么恶意的行为,接着往下看了看有一段指令(没有在那个函数范围里,不清楚这段指令是怎么被执行的???):
push 104h
.text:0040162B lea eax, [ebp-20Ch]
.text:00401631 push eax
.text:00401632 mov ecx, [ebp+8]
.text:00401635 push ecx
.text:00401636 call ds:GetModuleFileNameA
.text:0040163C lea edx, [ebp-104h]
.text:00401642 push edx
.text:00401643 push 104h
.text:00401648 call ds:GetTempPathA
.text:0040164E lea eax, [ebp-104h]
.text:00401654 push eax
.text:00401655 lea ecx, [ebp-310h]
.text:0040165B push ecx
.text:0040165C call strcpy
.text:00401661 add esp, 8
.text:00401664 mov edx, [ebp+0Ch]
.text:00401667 push edx
.text:00401668 lea eax, [ebp-310h]
.text:0040166E push eax
.text:0040166F call strcat
.text:00401674 add esp, 8
.text:00401677 push offset a_exe ; ".exe"
.text:0040167C lea ecx, [ebp-310h]
.text:00401682 push ecx
.text:00401683 call strcat
.text:00401688 add esp, 8
.text:0040168B lea edx, [ebp-310h]
.text:00401691 push edx
.text:00401692 call ds:DeleteFileA
.text:00401698 push 3E8h
.text:0040169D call ds:Sleep
.text:004016A3 lea eax, [ebp-310h]
.text:004016A9 push eax
.text:004016AA lea ecx, [ebp-20Ch]
.text:004016B0 push ecx
.text:004016B1 call ds:MoveFileA
上面这段指令是单独存在的,因此不清楚一些参数是什么,但是可以看出它要干吗。GetModuleFileName获取包含特定模块的文件的完整路径;GetTempPath获取临时文件路径,然后合成了一个以exe结尾的文件路径并删除了该路径指定的文件;接下来将当前线程挂起了一小会儿,通过MoveFile将GetModuleFileName获得路径指定的文件移到刚被删除文件的地方。在看看这个样本的名字(wmighost.dll),ghost不是和备份还原联系在一起吗?可能这就是它的目的吧。有些地方还不懂,能力有限先分析到这吧:)。