DEDECMS 鸡肋2次安装漏洞

2013-05-01 17:10:21 68 6911 2


我怕ban。。。。。。
黑阔们 51 快乐
测试版本:5.7
漏洞文件1
dede/login.php
//检测安装目录安全性
if( is_dir(dirname(__FILE__).'/../install') )
{
    if(!file_exists(dirname(__FILE__).'/../install/install_lock.txt') )
    {
      $fp = fopen(dirname(__FILE__).'/../install/install_lock.txt', 'w') or die('安装目录无写入权限,无法进行写入锁定文件,请安装完毕删除安装目录!');
      fwrite($fp,'ok');
      fclose($fp);
    }
    //为了防止未知安全性问题,强制禁用安装程序的文件
    if( file_exists("../install/index.php") ) { //问题就出现在这里 如果 install/index.php 文件存在
        @rename("../install/index.php", "../install/index.php.bak"); //就重命名 index.php 为 index.php.bak 到这里你应该明白了点什么吧(apache 某些版本会解析 index.php.bak)
    }
    if( file_exists("../install/module-install.php") ) { //同上
        @rename("../install/module-install.php", "../install/module-install.php.bak");
    }
        $fileindex = "../install/index.html";
        if( !file_exists($fileindex) ) {
                $fp = @fopen($fileindex,'w');
                fwrite($fp,'dir');
                fclose($fp);
        }
}
漏洞文件2
install/index.php.bak
@set_time_limit(0);
//error_reporting(E_ALL);
error_reporting(E_ALL || ~E_NOTICE);

$verMsg = ' V5.7 UTF8SP1';
$s_lang = 'utf-8';
$dfDbname = 'dedecmsv57utf8sp1';
$errmsg = '';
$install_demo_name = 'dedev57demo.txt';
$insLockfile = dirname(__FILE__).'/install_lock.txt';
$moduleCacheFile = dirname(__FILE__).'/modules.tmp.inc';

define('DEDEINC',dirname(__FILE__).'/../include');
define('DEDEDATA',dirname(__FILE__).'/../data');
define('DEDEROOT',preg_replace("#[\\\\\/]install#", '', dirname(__FILE__)));
header("Content-Type: text/html; charset={$s_lang}");

require_once(DEDEROOT.'/install/install.inc.php');
require_once(DEDEINC.'/zip.class.php');

foreach(Array('_GET','_POST','_COOKIE') as $_request)
{
    foreach($$_request as $_k => $_v) ${$_k} = RunMagicQuotes($_v); //变量覆盖。。。。
}
/*
/install/install.inc.php 文件的
function RunMagicQuotes(&$str)
{
    if(!get_magic_quotes_gpc()) {
        if( is_array($str) )
            foreach($str as $key => $val) $str[$key] = RunMagicQuotes($val);
        else
            $str = addslashes($str);
    }
    return $str;
}

*/
require_once(DEDEINC.'/common.func.php');

if(file_exists($insLockfile)) // 覆盖前面定义的$insLockfile 成功绕过file_exists的检测  install/index.php.bak?insLockfile=1&
{
    exit(" 程序已运行安装,如果你确定要重新安装,请先从FTP中删除 install/install_lock.txt!");
}
附上几张图吧

关于作者

冰封35篇文章787篇回复

评论68次

要评论?请先  登录  或  注册