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

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

缺陷编号:wooyun-2014-053841

漏洞标题:hdwiki注入导致任意文件下载

相关厂商:互动在线(北京)科技有限公司

漏洞作者: phith0n

提交时间:2014-03-17 09:25

修复时间:2014-06-12 09:26

公开时间:2014-06-12 09:26

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

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

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

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

简要描述:

RT。为一个朋友找的。

详细说明:

hdwiki上传附件处文件名过滤不严,导致可以注入:

function douploadimg() {
$imgname=$_FILES['photofile']['name'];
$extname=file::extname($imgname);
$destfile=$_ENV['attachment']->makepath($extname);
$arrupload=file::uploadfile($_FILES['photofile'],$destfile);

if($arrupload['result']==true){
if(isset($this->setting['watermark'])){
$_ENV['watermark']->image($destfile,$destfile);
}
$uid=intval($this->user['uid'])?$this->user['uid']:0;
$did=intval($this->get['2'])?$this->get['2']:0;
$_ENV['attachment']->add_attachment($uid ,$did,$imgname ,$destfile ,htmlspecialchars($this->post['picAlt']) ,$extname);


直接将$imgname插入attachment表。
但前台没有输出点,只能够盲注。
但因为是附件上传处,我们可以通过注入控制附件文件位置。
下载的时候即可读取该文件,产生一个任意文件读取:

function dodownload(){
if(!isset($this->get[2]) || !is_numeric($this->get[2])){
$this->message($this->view->lang['parameterError'],'BACK');
}
$result=$_ENV['attachment']->get_attachment('id',$this->get[2],0);
if(!(bool)$attachment=$result[0]){
$this->message($this->view->lang['attachIsNotExist'],'BACK');
}
if($this->user['uid'] != $attachment['uid']) {
// 判断金币
$credit1 = $this->user['credit1']; // 拥有金币数
$coindown = $attachment['coindown']; // 下载此附件需要消耗金币数
if(0 > $credit1 - $coindown) {
// 金币不足
$this->message($this->view->lang['goldNotEnough'],"index.php?doc-view-".$attachment['did'],0);
}
// 扣除金币
$_ENV['user']->add_credit($this->user['uid'],'attachment-down',0,-$coindown);
// 增加金币
$_ENV['user']->add_credit($attachment['uid'],'attachment-down',0,$coindown);
}
$_ENV['attachment']->update_downloads($attachment['id']);
file::downloadfile($attachment['attachment'],$attachment['filename']);
}

漏洞证明:

本地搭建最新版5.1。
注册用户,新增或编辑词条。上传图片:

01.jpg


中途抓包改包:

02.jpg


其中config.php即为我要下载的文件。(最好用hex)
附件上传完成后,来到:localhost/wiki/index.php?attachment-download-xx
其中xx是刚才上传的附件的id,这个id不知道,但肯定是最后一个id,所以穷举一遍id值即可。

03.jpg


下载后打开即为config.php的内容:

04.jpg

修复方案:

过滤$_FILE变量

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


漏洞回应

厂商回应:

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

忽略时间:2014-06-12 09:26

厂商回复:

最新状态:

暂无