任意文件上传漏洞修复
一、/include/dialog/select_soft_post.php文件,搜索(大概在72行的样子)
$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("你指定的文件名被系统禁止!",'javascript:;'); exit(); } $fullfilename = $cfg_basedir.$activepath.'/'.$filename;; 二、后台文件任意上传漏洞 /dede/media_add.php或者/你的后台名字/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("你指定的文件名被系统禁止!",'javascript:;'); exit(); } $fullfilename = $cfg_basedir.$filename; 三、 /include/uploadsafe.inc.php (有2个地方:) 1、搜索 ${$_key.'_size'} = @filesize($$_key);
}
(大概在42,43行左右)
替换成
${$_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 !'); } }
如果修改后出现文章页面空白页,请仔细查看代码是否多了或者少了大括号},本文件44行是空的,没有代码,请注意。
2、搜索 $image_dd = @getimagesize($$_key);(大概在53行左右)
替换成
$image_dd = @getimagesize($$_key); if($image_dd == false){ continue; }
老规矩大红色地方标记了修改的地方,然后保存,接着备份原文件,比如文件名变为uploadsafe.inc.php.16.08.09.bak。然后上传修改好的文件即可。
- 【渗透测试】PHPCMS9.6.0 任意文件上传漏洞+修复方案
- 网站漏洞修复之UEditor漏洞 任意文件上传漏洞
- 织梦DedeCms任意文件上传漏洞修复
- WEB安全系列之如何挖掘任意文件上传漏洞
- 【漏洞分析】WordPress任意文件上传漏洞
- WordPress 多个CMSMasters主题'upload.php'任意文件上传漏洞
- 关于finecms v5 会员头像 任意文件上传漏洞分析
- WordPress Think Responsive Themes ‘upload_settings_image.php’任意文件上传漏洞
- WordPress NextGEN Gallery ‘upload.php’任意文件上传漏洞
- WordPress User Photo ‘user-photo.php’任意文件上传漏洞
- Fckeditor 2.4.2 php任意上传文件漏洞
- ewebeditor for php任意文件上传漏洞
- WordPress Suco Themes ‘themify-ajax.php’任意文件上传漏洞
- F2blog XMLRPC 上传任意文件漏洞
- Fckeditor 2.4.2 php任意上传文件漏洞
- FCKeditor connector.php任意文件上传漏洞
- fckeditor <= 2.6.4 任意文件上传漏洞
- WordPress OptimizePress插件任意文件上传漏洞
- 织梦dedecms后台文件media_add.php任意上传漏洞解决办法
- 网狐6603棋牌网站程序后台部分任意文件上传漏洞