2014-03-17:细节已通知厂商并且等待厂商处理中
2014-03-27:厂商主动忽略漏洞,细节向第三方安全合作伙伴开放
2014-04-03:细节向核心白帽子及相关领域专家公开
2014-04-13:细节向普通白帽子公开
2014-05-03:细节向实习白帽子公开
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。
注册用户,新增或编辑词条。上传图片:

中途抓包改包:

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

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

修复方案:
过滤$_FILE变量
版权声明:转载请注明来源 phith0n@乌云 漏洞回应 厂商回应:危害等级:无影响厂商忽略
忽略时间:2014-03-27 09:26
厂商回复: 最新状态:暂无
版权与免责声明:
凡注明稿件来源的内容均为转载稿或由网友用户注册发布,本网转载出于传递更多信息的目的;如转载稿涉及版权问题,请作者联系我们,同时对于用户评论等信息,本网并不意味着赞同其观点或证实其内容的真实性;

![英雄棋士团(预下载)?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/shouyoupic/yingxiongqishituanyuxiazai.jpg)
![美食小当家?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/shouyoupic/meishixiaodangjia.png)
![2047?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/shouyoupic/2047.jpg)
![荣誉指挥官(预下载)?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/shouyoupic/rongyuzhihuiguanyuxiazai.png)
![繁荣美食市场物语?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/shouyoupic/fanrongmeishishichangwuyu.jpg)
![夸克浏览器 v4.2.1.138 好用的手机浏览器?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/appimg/202007/kuakezuolanqi.jpg)
![移动办公软件 OfficeSuite Premium v10.18.28716 内购解锁版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/appimg/202007/yidongbangongruanjian.jpg)
![乐秀视频编辑器 VideoShow v8.8.4 内购解锁版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/appimg/202007/lexiushipinbianjiqi.png)
![X 浏览器 v3.3.9 一款小巧的安卓浏览器?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/appimg/202007/x.jpg)
![安卓密码管理软件 Enpass v6.4.5.368 内购解锁版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/appimg/202007/anzhuomimaguanliruanjian.jpg)
![差分复制同步 FastCopy-M v3.6.3.51 绿色便携版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/softimg/FastCopy3.png)
![多标签页拓展 Clover v3.5.2 Build 19809 精简绿色版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/softimg/Clover.png)
![文件重命名 Advanced Renamer v3.85 Lite 绿色便携版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/softimg/Advanced_Renamer.png)
![网络防火监控 GlassWire Elite v2.1.166 绿色便携版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/softimg/GlassWire.png)
![影音播放器 Daum Potplayer v1.7.20538 美化便携版?=$bqr['banben']?>](http://shouyouimg.cnzzla.com/d/file/softimg/PotPlayer.png)