乌云(WooYun.org)历史漏洞查询---http://wy.zone.ci/
乌云 Drops 文章在线浏览--------http://drop.zone.ci/
2014-09-19: 积极联系厂商并且等待厂商认领中,细节不对外公开 2014-12-18: 厂商已经主动忽略漏洞,细节向公众公开
过滤不完全导致任意文件包含
先看过滤函数:function inject_check($sql){ return preg_match("/(select|insert|delete|\.\.\/|\.\/|union|into|load_file|outfile|\'|%27|{|\()/i", $sql);// 进行过滤 }function magic(){ if(!get_magic_quotes_gpc()&&isset($_POST)) { foreach($_POST as $key=>$v) { if(!is_array($v)) $_POST[$key]=addslashes($v); else { foreach($v as $skey=>$sv) { $_POST[$key][$skey]=addslashes($sv); } } } } //===========GET if(inject_check(implode('',$_GET))) { die('Invalid URL !'); } //===========POST if(isset($_POST)) { foreach($_POST as $key=>$v) { if(!is_array($v)) { if(strpos($v,'eval(')or(strpos($v,'$_POST['))) die('Invalid POST'); } } }}
在这里,对POST的数据进行了转义。 而对get的数据只是做了判断。 其中只是判断了get请求中是否有../ ,在windows环境下,可以使用..\来作为目录。
在看b2bbuilder.php 文件中的代码:if(!empty($_GET['m'])){ $_GET['s']=!empty($_GET['s'])?$_GET['s']:'index'; $s=str_replace('/','',$_GET['s']); $m=$_GET['m']; if(file_exists($config['webroot'].'/module/'.$m.'/'.$s.'.php')) { if(file_exists($config['webroot'].'/config/module_'.$m.'_config.php')) { @include($config['webroot'].'/config/module_'.$m.'_config.php'); $mcon='module_'.$m.'_config'; @$config = array_merge($config,$$mcon); } @include('module/'.$m.'/lang/'.$config['language'].'.php'); include('module/'.$m.'/'.$s.'.php'); } elseif(file_exists($m.'.html')) include($m.'.html'); else header("Location: 404.php");
先看$config['webroot'].'/module/'.$m.'/'.$s.'.php', 当m=.. 就会被重定向到网站根目录,由于没有过滤掉\ 这样利用s可以包含任意的php文件。利用%00截断功能,可以包含任意类型的文件。也可以通过include($m.'.html'); 这个来包含,其没有过滤..\这种格式。
过滤\
未能联系到厂商或者厂商积极拒绝