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

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

缺陷编号:wooyun-2015-0146188

漏洞标题:蝉知CMS注入漏洞官网演示

相关厂商:chanzhi.org

漏洞作者: pang0lin

提交时间:2015-10-12 18:38

修复时间:2016-01-11 15:32

公开时间:2016-01-11 15:32

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-10-12: 细节已通知厂商并且等待厂商处理中
2015-10-13: 厂商已经确认,细节仅向厂商公开
2015-10-16: 细节向第三方安全合作伙伴开放(绿盟科技唐朝安全巡航
2015-12-07: 细节向核心白帽子及相关领域专家公开
2015-12-17: 细节向普通白帽子公开
2015-12-27: 细节向实习白帽子公开
2016-01-11: 细节向公众公开

简要描述:

蝉知CMS注入漏洞一枚,官网演示

详细说明:

1.蝉知的整体防注入还是真心做得很不错的,看了很久,都没找到什么可以利用的点。但是人无完人,程序员也总有疏忽的时候,这个时候,终于被我发现了。首先定位到漏洞system/module/message/model.php文件。

public function getByObject($type, $objectType, $objectID, $pager = null)
{
$userMessages = $this->cookie->cmts;
$userMessages = trim($userMessages, ',');
if(empty($userMessages)) $userMessages = '0';
return $this->dao->select('*')->from(TABLE_MESSAGE)
->where('type')->eq($type)
->beginIf(RUN_MODE == 'front' and $type == 'message')->andWhere('public')->eq(1)->fi()
->andWhere('objectType')->eq($objectType)
->andWhere('objectID')->eq($objectID)
->andWhere("(id in ({$userMessages}) or (status = '1'))")//这里是漏洞点
->orderBy('id_desc')
->page($pager)
->fetchAll();
}


2.可以看出这里蝉知的逻辑是这样的,首先接收一个cookie:cmts,然后把这个cookie经过处理之后传入了sql语句中的in中,从上面的代码可以看出,$userMessage直接进入了in,而没有进行防注入的过滤。这就造成了注入漏洞。我们接着来看哪里调用了该函数。
system/module/message/control.php文件中。

public function index($pageID = 1)
{
$recPerPage = !empty($this->config->site->messageRec) ? $this->config->site->messageRec : $this->config->message->recPerPage;
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal = 0, $recPerPage, $pageID);
$this->view->messages = $this->message->getByObject($type = 'message', $objectType = 'message', $objectID = 0, $pager);//这里第一处调用漏洞函数
$this->view->pager = $pager;
$this->view->title = $this->lang->message->list;
$this->view->startNumber = ($pageID - 1) * 10;
$this->display();
}


public function comment($objectType, $objectID, $pageID = 1)
{
$recPerPage = !empty($this->config->site->commentRec) ? $this->config->site->commentRec : $this->config->message->recPerPage;
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal = 0 , $recPerPage, $pageID);
$this->view->objectType = $objectType;
$this->view->objectID = $objectID;
$this->view->comments = $this->message->getByObject($type = 'comment', $objectType, $objectID, $pager);//这是第二处调用漏洞函数
$this->view->pager = $pager;
$this->view->startNumber = ($pageID - 1) * 10;
$this->lang->message = $this->lang->comment;
$this->display();
}


3.我们构造一个名称为cmts的cookie,值为测试代码所示
然后访问http://localhost/chanzhieps/www/message-index.html

1.png


4.同样的方法去官网看一下,话说官网demo好卡,你们应该检查一下是不是已经中招了

2.png


亲,你竟然和我一样,用root连接,我是本地,你可是官网demo啊

漏洞证明:

2.png

修复方案:

过滤

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


漏洞回应

厂商回应:

危害等级:中

漏洞Rank:10

确认时间:2015-10-13 08:09

厂商回复:

非常感谢。:)

最新状态:

暂无