漏洞修复建议 配置webserver关闭cgi.fix_pathinfo为0
今天一个织梦源码的客户找到我们维护织梦,说网站跳到菠菜网站了,百度给停了推广.
要进入sao.baidu.com 进行网站扫描,发现有漏洞
漏洞修复建议
-
漏洞信息
-
问题详情
-
解决方案
实际上,我们去php.ini 里面把 cgi.discard_path=0 设置之后,网站根本无法打开php了,提示access denyed.
既然不能关,那只好对它进行过滤了,去网站配置文件nginx 里面添加过滤 ,下面红色的部分是过滤后的结果.
server {
listen 80;
server_name www.qrsun.cn qrsun.cn;
root "C:/wwwroot/qrsun";
location / {
index index.html index.htm index.php;
#autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
location ~ /(data|uploads|templets|datadir|a|images)/.*\.(php|php5)?$ {
deny all;
}
if ( $fastcgi_script_name ~ ..*/.*php ) {
return 403;
}
}
过滤之后访问 http://www.qrsun.cn/tz.jpg/tz.php 将会出现403 ,访问织梦会员系统上传假的jpg文件,执行php指令.后果很严重喔.
提示:我们主营主机、域名,并做网站搬家、源码安装、服务器搭建、网站建设等网站相关工作。 QQ号:76963956 微信号:76963956