OpenSSH 安全漏洞,OpenSSH 用户枚举漏洞,OpenSSH CBC模式信息泄露漏洞

漏洞:

OpenSSH 安全漏洞(CVE-2017-15906) 

OpenSSH 用户枚举漏洞(CVE-2018-15473)【原理扫描】

OpenSSH 用户枚举漏洞(CVE-2018-15919)

OpenSSH CBC模式信息泄露漏洞(CVE-2008-5161)【原理扫描】

 

修复:漏洞太多,不知道怎么修复,勉强试着换个版本看看。

现在的版本是默认的7.4

将7.4版本升级到7.8

操作命令如下:

第一步:安装telnet

(以免openssh安装过程出现意外情况,导致无法远程操控服务器)

yum update openSSH
yum install -y xinetd telnet-server net-tools wget

ll /etc/xinetd.d/telnet   ##如此文件不存在,则继续下一步

cat >> /etc/securetty < pts/0
> pts/1
> pts/2
> pts/3
> EOF

tail -5 /etc/securetty

systemctl enable xinetd
systemctl enable telnet.socket
systemctl start telnet.socket
systemctl start xinetd

netstat -lunpt | grep 23

systemctl stop firewalld
systemctl disable firewalld

#检查telnet是否可用

OpenSSH 安全漏洞,OpenSSH 用户枚举漏洞,OpenSSH CBC模式信息泄露漏洞_第1张图片

OpenSSH 安全漏洞,OpenSSH 用户枚举漏洞,OpenSSH CBC模式信息泄露漏洞_第2张图片

 

第二步:安装openssl

yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel pam-devel pam* zlib*
openssl version   #初始版本:OpenSSL 1.0.2k-fips  26 Jan 2017

cd /opt/
wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-7.8p1.tar.gz
wget https://ftp.openssl.org/source/old/1.0.2/openssl-1.0.2r.tar.gz
tar zxvf openssl-1.0.2r.tar.gz 
mv /usr/bin/openssl /usr/bin/openssl_bak
mv /usr/include/openssl /usr/include/openssl_bak
cd /opt/openssl-1.0.2r
./config shared
make && make install

echo $?   #输出0则表示一切正常
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
/sbin/ldconfig 
openssl version   #已变为新版本 OpenSSL 1.0.2r  26 Feb 2019

第三步:安装openssh

cd /opt/
tar zxvf openssh-7.8p1.tar.gz 
cd openssh-7.8p1
chown -R root.root /opt/openssh-7.8p1
mv /etc/ssh /etc/ssh_bak
./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/ssl/include/ --with-ssl-dir=/usr/local/ssl --with-zlib --with-md5-passwords --with-pam
make && make install
echo $?  #输出0则表示一切正常

sed -i '/#PermitRootLogin/a PermitRootLogin yes' /etc/ssh/sshd_config
grep "^PermitRootLogin" /etc/ssh/sshd_config   ##PermitRootLogin yes
cp -a contrib/redhat/sshd.init /etc/init.d/sshd
cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
chmod +x /etc/init.d/sshd
chkconfig --add sshd
systemctl enable sshd

mv /usr/lib/systemd/system/sshd.service /opt/  ##挪走原来的文件,以免影响重启ssh服务
chkconfig sshd on
systemctl enable sshd.socket
/etc/init.d/sshd restart
netstat -lunpt 
ssh -V    ##变更后版本为:OpenSSH_7.8p1, OpenSSL 1.0.2r  26 Feb 2019
telnet 127.0.0.1 22

##关掉telnet
systemctl disable xinetd
systemctl stop xinetd
systemctl disable telnet.socket
systemctl stop telnet.socket
netstat -lunpt

OpenSSH 安全漏洞,OpenSSH 用户枚举漏洞,OpenSSH CBC模式信息泄露漏洞_第3张图片

你可能感兴趣的:(漏洞修复)