当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2014-061803

漏洞标题:Ecmall SQL注射一枚

相关厂商:ShopEx

漏洞作者: 路人甲

提交时间:2014-05-22 10:44

修复时间:2014-08-17 10:46

公开时间:2014-08-17 10:46

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

漏洞状态:漏洞已经通知厂商但是厂商忽略漏洞

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-05-22: 细节已通知厂商并且等待厂商处理中
2014-05-27: 厂商主动忽略漏洞,细节向第三方安全合作伙伴开放
2014-07-21: 细节向核心白帽子及相关领域专家公开
2014-07-31: 细节向普通白帽子公开
2014-08-10: 细节向实习白帽子公开
2014-08-17: 细节向公众公开

简要描述:

详细说明:

一同学提交该shopex下的一款ecmall的SQL注入,具体参考如下: WooYun: Ecmall SQL注射之一
我也来一发
缺陷文件:/app/article.app.php中

function system()
{
$code = empty($_GET['code']) ? '' : trim($_GET['code']);
if (!$code)
{
$this->show_warning('no_such_article');
return;
}
$article = $this->_article_mod->get("code='" . $code . "'");
if (!$article)
{
$this->show_warning('no_such_article');
return;
}
if ($article['link']){ //外链文章跳转
header("HTTP/1.1 301 Moved Permanently");
header('location:'.$article['link']);
return;
}


其中$code 只过滤了左右2边空格。
接下来跟踪该get函数
实例化了includes\models\article.model.php该类,该类又继承了父类BaseModel

class ArticleModel extends BaseModel
{
var $table = 'article';
var $prikey = 'article_id';
var $_name = 'article';
/* 添加编辑时自动验证 */
var $_autov = array(
'title' => array(
'required' => true, //必填
'min' => 1, //最短1个字符
'max' => 100, //最长100个字符
'filter' => 'trim',


继续跟踪BaseModel该类
发现get方法

function get($params)
{
$data = $this->find($params);
if (!is_array($data))
{
return array();
}
return current($data);
}


继续跟踪find方法

function find($params = array())
{
//var_dump($params);
extract($this->_initFindParams($params));
//var_dump($params);
//var_dump($fields);
/* 字段(SELECT FROM) */
$fields = $this->getRealFields($fields);
$fields == '' && $fields = '*';
$tables = $this->table . ' ' . $this->alias;
/* 左联结(LEFT JOIN) */
$join_result = $this->_joinModel($tables, $join);
/* 原来为($join_result || $index_key),忘了最初的用意,默认加上主键应该是只为了为获得索引的数组服务的,因此只跟索引键是否是主键有关 */
if ($index_key == $this->prikey || (is_array($index_key) && in_array($this->prikey, $index_key)))
{
/* 如果索引键里有主键,则默认在要查询字段后加上主键 */
$fields .= ",{$this->alias}.{$this->prikey}";
}
/* 条件(WHERE) */
$conditions = $this->_getConditions($conditions, true);
/* 排序(ORDER BY) */
$order && $order = ' ORDER BY ' . $this->getRealFields($order);
/* 分页(LIMIT) */
$limit && $limit = ' LIMIT ' . $limit;
if ($count)
{
$this->_updateLastQueryCount("SELECT COUNT(*) as c FROM {$tables}{$conditions}");
}
/* 完整的SQL */
$sql = "SELECT {$fields} FROM {$tables}{$conditions}{$order}{$limit}";
return $index_key ? $this->db->getAllWithIndex($sql, $index_key) :
$this->db->getAll($sql);
}


可发现该变量进入了sql查询语句当中,导致sql注射
如图:

M40)IG6FEG`ME2]HV%A{OCH.jpg


原来的ecmall团队人员变动就不修复漏洞了吗?shopex可是业界良心,好好修吧。

漏洞证明:

M40)IG6FEG`ME2]HV%A{OCH.jpg


修复方案:

版权声明:转载请注明来源 路人甲@乌云


漏洞回应

厂商回应:

危害等级:无影响厂商忽略

忽略时间:2014-08-17 10:46

厂商回复:

最新状态:

暂无