您的位置:首页 > 运维架构 > Nginx

关于centos7和centos6中平滑升级nginx到新版本v1.12.1修复nginx最新漏洞CVE-2017-7529的解决方案

2017-07-29 09:17 1101 查看
关于centos7和centos6中平滑升级nginx到新版本v1.12.1修复CVE-2017-7529漏洞的解决方案
漏洞描述

2017年7月11日,Nginx官方发布最新的安全公告,在Nginx范围过滤器中发现了一个安全问题(CVE-2017-7529),通过精心构造的恶意请求可能会导致整数溢出并且不正确处理范围,从而导致敏感信息泄漏。

当使用Nginx标准模块时,如果文件头从缓存返回响应,允许攻击者获取缓存文件头。在某些配置中,缓存文件头可能包含后端服务器IP地址或其他敏感信息。

此外,如果使用第三方模块有潜在的可能导致拒绝服务。

影响版本

Nginx 0.5.6-1.13.2

漏洞等级

中危

受影响网站:

安全指数分析中国互联网共有713651个网站受到影响。

修复建议

1、升级Nginx到最新无漏洞版本,当前1.13.3,1.12.1版本中已修复了这个问题。
2、临时方案:配置 max_ranges 1;
3、使用百度云加速WAF防火墙进行防御。
4、添加网站至安全指数,及时了解网站组件突发/0day漏洞。

1.添加nginx官方yum源

# vim /etc/yum.repos.d/nginx.repo

centos7:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1


 

centos6:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1


 

看到有最新的1.12.1版本在yum列表中了

# yum list |grep nginx
nginx.x86_64 1:1.10.2-1.el7 @epel
nginx-all-modules.noarch 1:1.10.2-1.el7 @epel
nginx-filesystem.noarch 1:1.10.2-1.el7 @epel
nginx-mod-http-geoip.x86_64 1:1.10.2-1.el7 @epel
nginx-mod-http-image-filter.x86_64 1:1.10.2-1.el7 @epel
nginx-mod-http-perl.x86_64 1:1.10.2-1.el7 @epel
nginx-mod-http-xslt-filter.x86_64 1:1.10.2-1.el7 @epel
nginx-mod-mail.x86_64 1:1.10.2-1.el7 @epel
nginx-mod-stream.x86_64 1:1.10.2-1.el7 @epel
collectd-nginx.x86_64 5.7.1-2.el7 epel
munin-nginx.noarch 2.0.33-1.el7 epel
nextcloud-nginx.noarch 10.0.4-2.el7 epel
nginx.x86_64 1:1.12.1-1.el7.ngx nginx
nginx-debug.x86_64 1:1.8.0-1.el7.ngx nginx
nginx-debuginfo.x86_64 1:1.12.1-1.el7.ngx nginx
nginx-module-geoip.x86_64 1:1.12.1-1.el7.ngx nginx
nginx-module-geoip-debuginfo.x86_64 1:1.12.1-1.el7.ngx nginx
nginx-module-image-filter.x86_64 1:1.12.1-1.el7.ngx nginx
nginx-module-image-filter-debuginfo.x86_64
1:1.12.1-1.el7.ngx nginx
nginx-module-njs.x86_64 1:1.12.1.0.1.10-1.el7.ngx nginx
nginx-module-njs-debuginfo.x86_64 1:1.12.1.0.1.10-1.el7.ngx nginx
nginx-module-perl.x86_64 1:1.12.1-1.el7.ngx nginx
nginx-module-perl-debuginfo.x86_64 1:1.12.1-1.el7.ngx nginx
nginx-module-xslt.x86_64 1:1.12.1-1.el7.ngx nginx
nginx-module-xslt-debuginfo.x86_64 1:1.12.1-1.el7.ngx nginx
nginx-nr-agent.noarch 2.0.0-12.el7.ngx nginx
owncloud-nginx.noarch 9.1.5-1.el7 epel
pcp-pmda-nginx.x86_64 3.11.3-4.el7 base
python2-certbot-nginx.noarch 0.14.1-1.el7 epel


 

2.平滑升级nginx

# yum update nginx -y


 

可以看到已经成功升级到v1.12.1了

# nginx -v
nginx version: nginx/1.12.1


升级以后发现nginx语法检测无法通过

# nginx -t
nginx: [emerg] module "/usr/lib64/nginx/modules/ngx_http_perl_module.so" version 1010002 instead of 1012001 in /usr/share/nginx/modules/mod-http-image-filter.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed


 

解决办法:
vim /etc/nginx/nginx.conf
将这行注释掉

#include /usr/share/nginx/modules/*.conf;


分析:是因为modules指向了新的路径/usr/lib64/nginx/modules

[root@test11_ckmusic_test nginx]# ll
total 40
drwxr-xr-x 2 root root 114 Jul 13 10:47 conf.d
drwxr-xr-x 2 root root 6 Oct 31 2016 default.d
-rw-r--r-- 1 root root 1007 Jul 11 21:50 fastcgi_params
-rw-r--r-- 1 root root 2837 Jul 11 21:50 koi-utf
-rw-r--r-- 1 root root 2223 Jul 11 21:50 koi-win
-rw-r--r-- 1 root root 3957 Jul 11 21:50 mime.types
lrwxrwxrwx 1 root root 29 Jul 13 10:47 modules -> ../../usr/lib64/nginx/modules
-rw-r--r-- 1 root root 1178 Jul 13 11:12 nginx.conf
-rw-r--r-- 1 root root 1979 Jun 19 09:47 nginx.conf.bak
-rw-r--r-- 1 root root 643 Jul 11 21:47 nginx.conf.rpmnew
-rw-r--r-- 1 root root 636 Jul 11 21:50 scgi_params
-rw-r--r-- 1 root root 664 Jul 11 21:50 uwsgi_params
-rw-r--r-- 1 root root 3610 Jul 11 21:50 win-utf


 

3.平滑重启

# systemctl reload nginx


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: