dedecms安全漏洞大全

后台文件任意上传漏洞   /dede/media_add.php的解决方案 

搜索$fullfilename = $cfg_basedir.$filename;(大概在69行左右)     换成:

if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)[^a-zA-Z0-9]+$#i', trim($filename))) { ShowMsg("你指定的文件名被系统禁止!",'java script:;'); exit(); } 
$fullfilename = $cfg_basedir.$filename;

 

任意文件上传漏洞解   /include/dialog/select_soft_post.php决办法(大概在71行左右) 

$fullfilename = $cfg_basedir.$activepath.'/'.$filename;

换成:

if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)[^a-zA-Z0-9]+$#i', trim($filename))) { ShowMsg("你指定的文件名被系统禁止!",'java script:;'); exit(); }
$fullfilename = $cfg_basedir.$activepath.'/'.$filename;

 

全局变量覆盖漏洞,文件/include/common.inc.php  (大概在101行左右)

foreach(Array('_GET','_POST','_COOKIE') as $_request)
{
         foreach($$_request as $_k => $_v) ${$_k} = _RunMagicQuotes($_v);
}

换为:

foreach(Array('_GET','_POST','_COOKIE') as $_request)
    {
         foreach($$_request as $_k => $_v) {
                    if( strlen($_k)>0 && eregi('^(cfg_|GLOBALS)',$_k) ){
                            exit('Request var not allow!');
                   }
                    ${$_k} = _RunMagicQuotes($_v);
        }
    }

 

 

SESSION变量覆盖导致SQL注入,文件/include/common.inc.php  (大概在68行左右)

if( strlen($svar)>0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE)#',$svar) )

换为:

if( strlen($svar)>0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE|_SESSION)#',$svar) )

 

 

 

dedecms支付模块注入漏洞,/include/payment/alipay.php文件中存在SQL注入漏洞,(大约在136行) /* 取得订单号 */

$order_sn = trim($_GET['out_trade_no']);

改为:

$order_sn = trim(addslashes($_GET['out_trade_no']));

 

dedecms留言板注入漏洞之    /plus/guestbook/edit.inc.php        (大概在55行左右)

1 $dsql->ExecuteNoneQuery("UPDATE `#@__guestbook` SET `msg`='$msg', `posttime`='".time()."' WHERE id='$id' ");

改为:

1 $msg  = addslashes($msg);
2 $dsql->ExecuteNoneQuery("UPDATE `#@__guestbook` SET `msg`='$msg', `posttime`='".time()."' WHERE id='$id' ");

 

dede上传漏洞    /include/uploadsafe.inc.php    (大概在 42行 和 53行 2个地方)

${$_key.'_size'} = @filesize($$_key);

42行的地方,改为:

${$_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 !'); }

53行地方的

$image_dd = @getimagesize($$_key);

改为:

$image_dd = @getimagesize($$_key); if($image_dd == false){ continue; }

 

后台文件任意上传漏洞   /dede/media_add.php的解决方案 

搜索$fullfilename = $cfg_basedir.$filename;(大概在69行左右)     换成:

if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)[^a-zA-Z0-9]+$#i', trim($filename))) { ShowMsg("你指定的文件名被系统禁止!",'java script:;'); exit(); } 
$fullfilename = $cfg_basedir.$filename;

 

任意文件上传漏洞解   /include/dialog/select_soft_post.php决办法(大概在71行左右) 

$fullfilename = $cfg_basedir.$activepath.'/'.$filename;

换成:

if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)[^a-zA-Z0-9]+$#i', trim($filename))) { ShowMsg("你指定的文件名被系统禁止!",'java script:;'); exit(); }
$fullfilename = $cfg_basedir.$activepath.'/'.$filename;

 

全局变量覆盖漏洞,文件/include/common.inc.php  (大概在101行左右)

foreach(Array('_GET','_POST','_COOKIE') as $_request)
{
         foreach($$_request as $_k => $_v) ${$_k} = _RunMagicQuotes($_v);
}

换为:

foreach(Array('_GET','_POST','_COOKIE') as $_request)
    {
         foreach($$_request as $_k => $_v) {
                    if( strlen($_k)>0 && eregi('^(cfg_|GLOBALS)',$_k) ){
                            exit('Request var not allow!');
                   }
                    ${$_k} = _RunMagicQuotes($_v);
        }
    }

 

 

SESSION变量覆盖导致SQL注入,文件/include/common.inc.php  (大概在68行左右)

if( strlen($svar)>0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE)#',$svar) )

换为:

if( strlen($svar)>0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE|_SESSION)#',$svar) )

 

 

 

dedecms支付模块注入漏洞,/include/payment/alipay.php文件中存在SQL注入漏洞,(大约在136行) /* 取得订单号 */

$order_sn = trim($_GET['out_trade_no']);

改为:

$order_sn = trim(addslashes($_GET['out_trade_no']));

 

dedecms留言板注入漏洞之    /plus/guestbook/edit.inc.php        (大概在55行左右)

1 $dsql->ExecuteNoneQuery("UPDATE `#@__guestbook` SET `msg`='$msg', `posttime`='".time()."' WHERE id='$id' ");

改为:

1 $msg  = addslashes($msg);
2 $dsql->ExecuteNoneQuery("UPDATE `#@__guestbook` SET `msg`='$msg', `posttime`='".time()."' WHERE id='$id' ");

 

dede上传漏洞    /include/uploadsafe.inc.php    (大概在 42行 和 53行 2个地方)

${$_key.'_size'} = @filesize($$_key);

42行的地方,改为:

${$_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 !'); }

53行地方的

$image_dd = @getimagesize($$_key);

改为:

$image_dd = @getimagesize($$_key); if($image_dd == false){ continue; }

 

1622769785-9148256b89e79e5

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
徐闹闹 » dedecms安全漏洞大全

提供最优质的资源集合

立即查看 了解详情