用的阿里云服务器这个云盾一直提示我这个织梦程序有漏洞,烦人,今天没事,就给他修复下,省的老发短信发邮件提示,阿里云修复此漏洞还需要收费。
修复涉及修改的文件有以下:
/install/index.php dedecms重装漏洞
/include/uploadsafe.inc.php dedecms上传漏洞
/dede/media_add.php dedecms后台文件任意上传漏洞
/dede/media_add.php dedecms模板SQL注入漏洞
/include/common.inc.php dedecms SESSION变量覆盖导致SQL注入
/include/dialog/select_soft_post.php dedecms任意文件上传漏洞
/include/filter.inc.php dedecms(SQL)注入漏洞
/member/mtypes.php dedecms(SQL)注入漏洞
/member/pm.php dedecms(SQL)注入漏洞
/member/soft_add.php dedecms模板SQL注入漏洞
/plus/search.php dedecms(SQL)注入漏洞
/plus/guestbook/edit.inc.php dedecms(SQL)注入漏洞
/include/payment/alipay.php dedecms支付模块注入漏洞New
修复方案:
1、/include/dialog/select_soft_post.php文件,搜索(大概在72行的样子)
$fullfilename = $cfg_basedir.$activepath.'/'.$filename;
修改为
if (codeg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)[^a-zA-Z0-9]+$#i', trim($filename))) { ShowMsg("你指定的文件名被系统禁止!",'javascript:;'); exit(); } $fullfilename = $cfg_basedir.$activepath.'/'.$filename;;
2、 /include/filter.inc.php文件,搜索(大概在46行的样子)
return $svar;
修改为
return addslashes($svar);
3、/member/mtypes.php文件,搜索(大概在71行的样子)
$query = "UPDATE `dede_mtypes` SET mtypename='$name' WHERE mtypeid='$id' AND mid='$cfg_ml->M_ID'";
修改为
$id = intval($id); $query = "UPDATE `dede_mtypes` SET mtypename='$name' WHERE mtypeid='$id' AND mid='$cfg_ml->M_ID'";
4、 /member/pm.php文件,搜索(大概在65行的样子)
$row = $dsql->GetOne("SELECT * FROM `dede_member_pms` WHERE id='$id' AND (fromid='{$cfg_ml->M_ID}' OR toid='{$cfg_ml->M_ID}')");
修改为
$id = intval($id); $row = $dsql->GetOne("SELECT * FROM `dede_member_pms` WHERE id='$id' AND (fromid='{$cfg_ml->M_ID}' OR toid='{$cfg_ml->M_ID}')");
5、 /plus/guestbook/edit.inc.php文件,搜索(大概在55行的样子)
$dsql->ExecuteNoneQuery("UPDATE `dede_guestbook` SET `msg`='$msg', `posttime`='".time()."' WHERE id='$id' ");
修改为
$msg = addslashes($msg); $dsql->ExecuteNoneQuery("UPDATE `dede_guestbook` SET `msg`='$msg', `posttime`='".time()."' WHERE id='$id' ");;
6、 /plus/search.php文件,搜索(大概在109行的样子)
$keyword = addslashes(cn_substr($keyword,30));
修改为
$typeid = intval($typeid); $keyword = addslashes(cn_substr($keyword,30));
7、/install/index.php文件,打开install文件
找到index.php
删除或者重命名
8、/include/common.inc.php文件,搜索(大概在68行左右)
if( strlen($svar)>0 && codeg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE)#',$svar) )
修改为
if( strlen($svar)>0 && codeg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE|_SESSION)#',$svar) )
9、 /dede/media_add.php文件,搜索(大概在69行左右)
$fullfilename = $cfg_basedir.$filename;
替换成
if (codeg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)[^a-zA-Z0-9]+$#i', trim($filename))) { ShowMsg("你指定的文件名被系统禁止!",'javascript:;'); exit(); } $fullfilename = $cfg_basedir.$filename;
10、/member/soft_add.php文件,搜索(大概在154行左右)
$urls .= "{dede:link islocal='1' text='{$servermsg1}'} $softurl1 {/dede:link}\r\n";
替换成
if (codeg_match("#}(.*?){/dede:link}{dede:#sim", $servermsg1) != 1) { $urls .= "{dede:link islocal='1' text='{$servermsg1}'} $softurl1 {/dede:link}\r\n"; }
11、/include/uploadsafe.inc.php文件,搜索(大概在42和43行左右)
${$_key.'_size'} = @filesize($$_key);
}
替换成
${$_key.'_size'} = @filesize($$_key);
} $imtypes = array("image/pjpeg", "image/jpeg", "image/gif", "image/png", "image/xpng", "image/wbmp", "image/bmp"); if(in_array(strtolower(trim(${$_key.'_type'})), $imtypes)) { $image_dd = @getimagesize($$_key); if($image_dd == false){ continue; } if (!is_array($image_dd)) { exit('Upload filetype not allow !'); } }
12、/include/uploadsafe.inc.php文件,搜索(大概在53行左右)
$image_dd = @getimagesize($$_key);
替换成
$image_dd = @getimagesize($$_key); if($image_dd == false){ continue; }
13、include/payment/alipay.php文件,搜索(大概在137行的样子)
$order_sn = trim($_GET['out_trade_no']);
修改为
$order_sn = trim(addslashes($_GET['out_trade_no']));;
本文链接地址: 织梦CMS漏洞修复大全(已更新)