纵有疾风起
人生不言弃

qibocms下载系统 注入&另外一个老问题 – 网站

RT.

详细说明:

下载地址 http://bbs.qibosoft.com/down2.php?v=download1.0#down

0x01 老问题

在download/inc/job/down_encode.php中

if(eregi('.php',$url)){
header("location:$true_url");
exit;
}
$webdb[upfileType] = str_replace(' ','|',$webdb[upfileType]);
if(file_exists(ROOT_PATH."$webdb[updir]/$url") && eregi("($webdb[upfileType])$",$url) && filesize(ROOT_PATH."$webdb[updir]/$url")<1024*1024*10)
{
$filetype=substr(strrchr($url,'.'),1);
ob_end_clean();
header('Last-Modified: '.gmdate('D, d M Y H:i:s',time()).' GMT');
header('Pragma: no-cache');
header('Content-Encoding: none');
header('Content-Disposition: attachment; filename='."$true_name.$filetype");
header('Content-type: '.$filetype);
header('Content-Length: '.filesize(ROOT_PATH."$webdb[updir]/$url"));
readfile(ROOT_PATH."$webdb[updir]/$url");
exit;

厂商对上次我爆的那个洞做了修补

eregi(“($webdb[upfileType])$”,$url 白名单验证。

但是在download/inc/down_encode.php 中

$true_url=tempdir($url);
if(eregi('.php',$url)){
header("location:$true_url");
exit;
}

if(file_exists(ROOT_PATH."$webdb[updir]/$url")&&filesize(ROOT_PATH."$webdb[updir]/$url")<1024*1024*10)
{
$filetype=substr(strrchr($url,'.'),1);
ob_end_clean();
header('Last-Modified: '.gmdate('D, d M Y H:i:s',time()).' GMT');
header('Pragma: no-cache');
header('Content-Encoding: none');
header('Content-Disposition: attachment; filename='."$true_name.$filetype");
header('Content-type: '.$filetype);
header('Content-Length: '.filesize(ROOT_PATH."$webdb[updir]/$url"));
readfile(ROOT_PATH."$webdb[updir]/$url");
exit;

却没有做白名单验证 只是黑名单验证是否含有.php 按照上次发的那个可以绕过。

然后这个涉及到了个入库出库 然后在发布软件的时候图片地址写要下载的就行了

绕过黑名单参照这个。及剩下的参照下面这个 我就不多说了。

WooYun: qibocmsV7整站系统任意文件下载导致无限制注入多处(可提升自己为管理 Demo演示)

____________________________________________________________________

0x02 注入

在全局文件中

$_POST=Add_S($_POST);
$_GET=Add_S($_GET);
$_COOKIE=Add_S($_COOKIE);

function Add_S($array){
foreach($array as $key=>$value){
if(!is_array($value)){
$value=str_replace("&#x","& # x",$value);//过滤一些不安全字符
$value=preg_replace("/eval/i","eva l",$value);//过滤不安全函数
!get_magic_quotes_gpc() && $value=addslashes($value);
$array[$key]=$value;
}else{
$array[$key]=Add_S($array[$key]);
}
}
return $array;
}

这里调用了这个函数来对get post cookie来转义 如果gpc off的话 就addslashes对数组中的value进行转义 这里没有对数组中的key进行过滤。

在download/member/post.php中

elseif($job=='manage')
{
if(!$atc_power)showerr("你没权限");
if($rsdb[pages]<2){
header("location:post.php?job=edit&aid=$aid");exit;
}
if($step==2){
asort($orderDB);
$i=0;
foreach( $orderDB AS $key=>$value){
$i++;
$db->query("UPDATE {$_pre}reply SET orderid=$i WHERE aid='$aid' AND rid='$key'");
}
refreshto("$FROMURL","排序成功",1);
}

if($lfjid){
if($web_admin||$lfjuid==$rsdb[uid]){
$atc_power=1;
}
}

这个只要是你自己发布的就有权限了。 所以我们自己先发布一个。

foreach( $orderDB AS $key=>$value){
$i++;
$db->query("UPDATE {$_pre}reply SET orderid=$i WHERE aid='$aid' AND rid='$key'

这里把数组中的key循环出来后 没有做任何的过滤就带入到了查询当中

造成了注入。

漏洞证明:

qibocms下载系统 注入&另外一个老问题 – 网站插图

首先注册一个会员 投稿 因为if($rsdb[pages]<2){

header(“location:post.php?job=edit&aid=$aid”);exit;

}

验证了两页 所以得发两页。

qibocms下载系统 注入&另外一个老问题 – 网站插图1

然后就成功注入了。

修复方案:

对于第一个问题 做白名单

第二个 $key=intval($key);

    上一篇: B2Bbuilder设计缺陷导致整站重装 – 网站安全 – 自学

    下一篇: DedeCMS-V5.7-UTF8-SP1 新绕过思路+sql注入+任意订单支
未经允许不得转载:起风网 » qibocms下载系统 注入&另外一个老问题 – 网站
分享到: 生成海报

评论 抢沙发

评论前必须登录!

立即登录