查看Kexalgorithms-此举操作是确认客户端支持的kexalgorithms
[root@localhost ~]# ssh -Q kex
![](https://img-blog.csdnimg.cn/img_convert/16d00873de4249c49f3e7fcceb2967ec.png)
查看Kexalgorithms-此举操作是确认客户端支持的kexalgorithms
[root@localhost ~]# sshd -T | grep -w kexalgorithms
![](https://img-blog.csdnimg.cn/img_convert/b99526eb11e847d9b041ef56fdf070d5.png)
修复方法
通过修改sshd_config配置文件,屏蔽掉不安全的KexAlgorithjms,其中具体的sshd_config配置参数可以从man文档中查看
通过man文档查看当前openssh版本支持的算法列表和参数用法。
[root@localhost ~]# man sshd_config |grep -A 40 -w KexAlgorithms
![](https://img-blog.csdnimg.cn/img_convert/a2f09f71014d479e8686d9ac22250fa5.png)
未禁用diffie-hellman算法之前,可用正常使用ssh连接登录
[root@localhost ~]# ssh -v -oKexAlgorithms=diffie-hellman-group1-sha1 root@10.105.22.242
![](https://img-blog.csdnimg.cn/img_convert/8e4fb4f67ae74249b94bebfdff4a9ae4.png)
![](https://img-blog.csdnimg.cn/img_convert/b68dad15ea2847d7a71cb644f05969cb.png)
使用漏扫可以扫出该漏洞
![](https://img-blog.csdnimg.cn/img_convert/938c5c4183f14704ab1fba2ae0194404.png)
禁用diffie-hellman算法
[root@localhost ~]# echo "KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521" >> /etc/ssh/sshd_config
[root@localhost ~]# systemctl restart sshd
[root@localhost ~]# sshd -T | grep -w kexalgorithms
![](https://img-blog.csdnimg.cn/img_convert/f72ecc3e70164f1cb7c8f71b1e6f1dd4.png)
再次使用禁用了diffie-hellman算法之后,带上被禁用的密钥算法登录,显示不能正常使用ssh登录
[root@localhost ~]# ssh -v -oKexAlgorithms=diffie-hellman-group1-sha1 root@10.105.22.242
![](https://img-blog.csdnimg.cn/img_convert/1c5dfc4af8944ebfaea34e7af5469565.png)
使用奇安信漏扫,已无法扫出,漏洞修复
![](https://img-blog.csdnimg.cn/img_convert/4ad26617ed2c4c6aa662f9d17ea09191.png)
不加任何加密算法,正常使用ssh也可以登录
![](https://img-blog.csdnimg.cn/img_convert/2348c5e2ddf74cc1a7efc51e5f341345.png)