zyp 发表于 2007-7-15 22:22:10

BMFourm Path Disclosure Vulnerability

作者:<br/>Dreamage from www.cnsst.net<br/>Email:flyingupward_at_126.com<br/>测试环境:<br/>XP+Apache/1.3.31+ PHP/4.3.7+BMF5.5RC1<br/>漏洞说明:<br/>BMF对$language处理不当,导致在sell.php 、topic.php等多个文件中利用该变量提交一个不存在的页面,就可以使PHP脚本发生错误而泄露实际绝对路径。下面是登陆后测试的抓图: <br/><br/><img srchttp://www.2456.org.cn/myblog/attachments/200610/06_095534_6_1926_ea6bf2a0c009601.jpg" classinsertimage" alt点击在新窗口中浏览此图片" title点击在新窗口中浏览此图片" border0"/><br/>反思:<br/>这类漏洞本质就是文件包含漏洞,只是由于程序的过滤不能上传任意脚本,然而泄露网站绝对路径危害有多大呢?我不知道,呵呵。其实的解决很简单,就是先判断language类形是否存在再进行Include。或者更严格地,使用数组对可Include的文件作出规定。看以下一段简单的示例代码:<br/>$languagelist=array(&quot;test1.php&quot;,&quot;test2.php&quot;,&quot;test3.php&quot;); //这里规定可进行include的文件<br/>if(isset($_GET[&quot;language&quot;])) //判断是否有$language{ <br/>$language=$_GET[&quot;language&quot;];<br/>foreach($languagelist as $prelanguage)<br/>{ <br/>if($language==$prelanguage) //检查文件是否在允许列表中<br/>{ <br/>include($prelanguage);<br/>$checkfind=true;<br/>break;<br/>}<br/>}<br/>//没有这部分就要泄露信息咯<br/>if($checkfind==true){ unset($checkfind); }<br/>else{ die(&quot;出错鸟!&quot;); }<br/>}<br/>这样就可以很好地解决问题了。
页: [1]
查看完整版本: BMFourm Path Disclosure Vulnerability