DROWN 中间人劫持漏洞
漏洞描述:
国外安全专家发现了一种名为“DROWN”的中间人攻击方式,漏洞编号为CVE-2016-0800。若服务器支持以“SSLv2”协议和“EXPORT”加密算法进行安全连接时,攻击者通过截获客户端和服务端的通信数据,利用穷举的方式破解出被加密的原文,实现中间人劫持。
解决方法:openssl升级
当前系统openssl版本为1.0.1e
选择升级版本为1.0.2g
1,下载openssl升级包
[[email protected] ~]# wget http://www.openssl.org/source/openssl-1.0.2g.tar.gz
[[email protected] ~]# tar zxf openssl-1.0.2g.tar.gz
[[email protected] ~]# cd openssl-1.0.2g
执行文件夹中的config文件,这里openssl的安装目录默认是/usr/local/ssl(由于系统环境差异路径可能不一致,下同),注意添加zlib参数,使其编译成动态库
查看zlib是否安装
[[email protected] ~/openssl-1.0.2g]# rpm -q zlib
zlib-1.2.3-29.el6.x86_64
[[email protected] ~/openssl-1.0.2g]# ./config shared zlib
[[email protected] ~/openssl-1.0.2g]# make && make install && echo ok!!!
编译完成
替换模块
[[email protected] ~/openssl-1.0.2g]# mv /usr/bin/openssl /usr/bin/openssl.old
[[email protected] ~/openssl-1.0.2g]# mv /usr/include/openssl /usr/include/openssl.old
[[email protected] ~/openssl-1.0.2g]# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
[[email protected] ~/openssl-1.0.2g]# ln -s /usr/local/ssl/include/openssl /usr/include/openssl
修改系统自带的openssl库文件
[[email protected] ~/openssl-1.0.2g]# ln -s /usr/local/ssl/lib/libssl.so /usr/local/lib64/libssl.so
查看openssl以来库是不是1.0.2g
[[email protected] ~/openssl-1.0.2g]# strings /usr/local/lib64/libssl.so |grep OpenSSL
OpenSSLDie
SSLv3 part of OpenSSL 1.0.2g 1 Mar 2016
TLSv1 part of OpenSSL 1.0.2g 1 Mar 2016
DTLSv1 part of OpenSSL 1.0.2g 1 Mar 2016
OpenSSL 1.0.2g 1 Mar 2016
在/etc/ld.so.conf文件中写入openssl库文件的搜索路径
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
[[email protected] ~/openssl-1.0.2g]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/lib
/lib64
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/usr/local/ssl/lib
使修改后的/etc/ld.so.conf生效
[[email protected] ~/openssl-1.0.2g]# ldconfig
[[email protected] ~/openssl-1.0.2g]# ldconfig -v
/usr/local/ssl/lib:
libssl.so.1.0.0 -> libssl.so.1.0.0
libcrypto.so.1.0.0 -> libcrypto.so.1.0.0
Centos6.5 的是在/usr/lib64/libssl.so 和/usr/lib64/libssl.so.1.0.1e
其中/usr/lib/libssl.so是/usr/lib/libssl.so.1.0.1e的软连接
[[email protected] /usr/lib64]# ll libssl.so
lrwxrwxrwx 1 root root 16 12月 12 23:54 libssl.so -> libssl.so.1.0.1e
只需要把/usr/local/ssl/lib/libssl.so.1.0.0替换为/usr/lib/libssl.so.1.0.2g即可
[[email protected] /usr/lib64]# mv libssl.so.1.0.1e libssl.so.1.0.1eold
[[email protected] /usr/lib64]# cp /usr/local/ssl/lib/libssl.so.1.0.0 /usr/lib64/libssl.so.1.0.1e
[[email protected] /usr/lib64]# ldconfig
查看openssl版本
[[email protected] /usr/lib64]# openssl version
OpenSSL 1.0.2g 1 Mar 2016
查看openssl对nginx时动态库还是静态
[[email protected] /usr/lib64]# ldd /usr/sbin/nginx
linux-vdso.so.1 => (0x00007fff165f0000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00000036cbe00000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00000036cde00000)
libpcre.so.0 => /lib64/libpcre.so.0 (0x00000036cfe00000)
libssl.so.10 => /usr/lib64/libssl.so.10 (0x000000306e600000)
libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x000000306e200000)
有libssl.so.10 => /usr/lib64/libssl.so.10 (0x000000306e600000)就是动态库依赖,反之静态
也可以查看nginx编译模块
[[email protected] /usr/lib64]# nginx -V
nginx version: nginx/1.0.15
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-debug --with-cc-opt=‘-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic‘ --with-ld-opt=-Wl,-E
如果不存在--with-openssl就是动态编译ssl,反之为静态
动态更新openssl,直接重启nginx apache等webserver