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

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

缺陷编号:wooyun-2014-064769

漏洞标题:xdcms 后台绕过文件上传限制直接getshell(测试最新版)

相关厂商:www.xdcms.cn

漏洞作者: hkAssassin

提交时间:2014-06-14 22:16

修复时间:2014-09-09 22:18

公开时间:2014-09-09 22:18

漏洞类型:文件上传导致任意代码执行

危害等级:高

自评Rank:15

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

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-06-14: 细节已通知厂商并且等待厂商处理中
2014-06-19: 厂商主动忽略漏洞,细节向第三方安全合作伙伴开放
2014-08-13: 细节向核心白帽子及相关领域专家公开
2014-08-23: 细节向普通白帽子公开
2014-09-02: 细节向实习白帽子公开
2014-09-09: 细节向公众公开

简要描述:

后台绕过文件过滤限制可shell

详细说明:

system/libs/upload.class.php 上传的核心验证文件
public function upload_process(){
$num=count($_FILES[ $this->upload_form_field ]['name']);
for($key=0;$key<$num;$key++){
$this->_clean_paths();
//创建存储路径
$save_path=$this->out_save_dir."uploadfile/".$this->upload_folder."/";
if (!file_exists($save_path)) {
mkdir($save_path);
}
$ymd = date("Ymd");
$save_path .= $ymd;
if (!file_exists($save_path)) {
mkdir($save_path);
}
$this->out_file_dir = $save_path;

//开始获取上传的文件
if ( ! function_exists( 'getimagesize' ) ){
$this->image_check = 0;
}

$FILE_NAME = isset($_FILES[ $this->upload_form_field ]['name'][$key]) ? $_FILES[ $this->upload_form_field ]['name'][$key] : '';
$FILE_SIZE = isset($_FILES[ $this->upload_form_field ]['size'][$key]) ? $_FILES[ $this->upload_form_field ]['size'][$key] : '';
$FILE_TYPE = isset($_FILES[ $this->upload_form_field ]['type'][$key]) ? $_FILES[ $this->upload_form_field ]['type'][$key] : '';
$FILE_TYPE = preg_replace( "/^(.+?);.*$/", "\\1", $FILE_TYPE );

//判断错误类型
if ( !isset($_FILES[ $this->upload_form_field ]['name'][$key])
or $_FILES[ $this->upload_form_field ]['name'][$key] == ""
or !$_FILES[ $this->upload_form_field ]['name'][$key]
or !$_FILES[ $this->upload_form_field ]['size'][$key]
or ($_FILES[ $this->upload_form_field ]['name'][$key] == "none") )
{
$this->error_no = 1;
return;
}
………………
if ( $this->make_script_safe ){
if ( preg_match( "/\.(cgi|pl|js|asp|php|html|htm|jsp|jar)(\.|$)/i", $FILE_NAME ) ){
$FILE_TYPE = 'text/plain';
$this->file_extension = 'txt';
$this->parsed_file_name = preg_replace( "/\.(cgi|pl|js|asp|php|html|htm|jsp|jar)(\.|$)/i", "$2", $this->parsed_file_name );

$renamed = 1;
}
}
主要是以上这段代码存在漏洞。很明显过滤有问题我们提交 php+空格 即可绕过 另外还有脚本也可以提交。具体见漏洞证明

漏洞证明:

1.jpg

2.jpg


抓包type修改为1 确保走文件上传分支

3.jpg


4.jpg

5.jpg

修复方案:

LUOLNZ3}]OOKHG@W]1DC(Z7.jpg

好好整啊,亲附送后台登陆sql注入一枚。貌似被某大神提交过了。但是你们为什么一直不修复。

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


漏洞回应

厂商回应:

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

忽略时间:2014-09-09 22:18

厂商回复:

最新状态:

暂无