Centos7扫描漏洞及离线处理方法
工作网络的特殊性,服务器是不连互联网的,所以整个安装过程都是采用离线包安装的方式来安装。
漏洞
一、nginx 安 全 漏 洞 (CVE-2021-23017)
二、Apache Druid未授权访问【 原理扫 描 】
三、OpenSSH CBC模式信息泄露漏洞(CVE-2008-5161)【 原理扫 描 】
四、ICMP timestamp请求响应漏洞
五、允许Traceroute探测
六、SSH版本信息可被获取
七、探测到SSH服务器支持的算法
处理方法
nginx 安 全 漏 洞 (CVE-2021-23017)
下载需要安装的离线包
离线安装所需要的安装包: pcre、openssl、zlib、nginx-1.20.1.
下载后,把安装包解压到服务器上。
pcre安装
执行以下命令行:
tar -zxvf pcre-8.43.tar.gz
cd pcre-8.43/
./configure
make
make install
查看版本命令:
rpm -qa pcre
openssl安装
执行以下命令行:
tar -zxvf openssl-1.1.0h.tar.gz
cd openssl-1.1.0h/
./configure或者./config --prefix=/usr/local/ --openssldir=/usr/local/openssl -g3 shared zlib-dynamic enable-camellia (如果./configure提示上图错误,则使用./config)
./config --prefix=/usr/local/ --openssldir=/usr/local/openssl -g3 shared zlib-dynamic enable-camellia
make
make install
查看版本命令:
openssl version
zlib安装
执行以下命令行:
ar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
./configure
make
make install
查看版本命令:
ind /usr/ -name zlib.pc
cat /usr/local/lib/pkgconfig/zlib.pc
nginx升级安装
执行命令:
tar xf nginx-1.20.1.tar.gz -C /usr/local/src
cd /usr/local/src/nginx-1.20.1/
编译选项与旧版本的编译选项要一直,可以先用nginx -V 查看编译选项
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf
不做make install
make
上述完成以后,会在当前我解压缩nginx的objs下面产生一个nginx二进制文件
cd /usr/local/src/nginx-1.20.1/objs/
ll
输出:
total 7708
-rw-r--r-- 1 root root 18498 Jul 11 21:21 autoconf.err
-rw-r--r-- 1 root root 53134 Jul 11 21:21 Makefile
-rwxr-xr-x 1 root root 7724128 Jul 11 21:21 ==nginx==
-rw-r--r-- 1 root root 5517 Jul 11 21:21 nginx.8
-rw-r--r-- 1 root root 7914 Jul 11 21:21 ngx_auto_config.h
-rw-r--r-- 1 root root 657 Jul 11 21:21 ngx_auto_headers.h
-rw-r--r-- 1 root root 8868 Jul 11 21:21 ngx_modules.c
-rw-r--r-- 1 root root 60184 Jul 11 21:21 ngx_modules.o
drwxr-xr-x 9 root root 91 Jul 11 21:21 src
获取nginx的安装目录
ps -ef | grep nginx | grep master | awk -F" " '{print $11}'
备份旧版本nginx二进制文件
mv /usr/sbin/nginx /usr/sbin/nginx3.old
复制新版本的nginx二进制文件到就二进制文件路径,覆盖它,如果cp不行可用mv覆盖
mv nginx /usr/sbin/nginx
此时就可查询nginx的版本
nginx -V
输出:
nginx version: nginx/1.20.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf
重启nginx
/usr/sbin/nginx -s reload
查看nginx是够启动
ps -ef|grep nginx
Apache Druid未授权访问【 原理扫 描 】
由于Apache Druid 默认情况下缺乏授权认证,攻击者可直接构造恶意请求执行任意代码,控制服务器。
处理方法
为Druid监控配置访问权限(配置访问监控信息的用户与密码)
OpenSSH CBC模式信息泄露漏洞(CVE-2008-5161)【 原理扫 描 】
执行以下命令行:
vi /etc/ssh/sshd_config
查询找到 #Ciphers and keying 在其下面增加配置项,将默认的CBC加密模式改成CTR
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,arcfour
重启sshd,生效配置
systemctl restart sshd
ICMP timestamp请求响应漏洞
iptables -I INPUT -p ICMP --icmp-type timestamp-request -m comment --comment "deny ICMP timestamp" -j DROP
iptables -I INPUT -p ICMP --icmp-type timestamp-reply -m comment --comment "deny ICMP timestamp" -j DROP
允许Traceroute探测
iptables -I INPUT -p icmp --icmp-type 11 -m comment --comment "deny traceroute" -j DROP
SSH版本信息可被获取
描述:SSH服务允许远程攻击者获得ssh的具体信息,如版本号等等。这可能为攻击者发动进一步攻击提供帮助。
处理:无法处理。sshd_config中的Banner项只是ssh主机前输出的信息,源码处理机制就是telnet其端口就会返回版本信息。
探测到SSH服务器支持的算法
描述:本插件用来获取SSH服务器支持的算法列表
处理:无法处理。ssh协议协商过程就是服务端要返回其支持的算法列表。
记录下处理方法及步骤。1
解决记录一下 ↩︎