处理问题:Diffie-Hellman Ephemeral Key Exchange DoS Vulnerability (SSH, D(HE)ater)

为处理以下漏洞:

1、Diffie-Hellman Ephemeral Key Exchange DoS Vulnerability (SSH, D(HE)ater)

2、SSH 协议规范中的前缀截断攻击(Terrapin 攻击)

请在修改前多开几个 ssh 连接或打开 telnet 连接,以免修改失误导致无法远程!

1、查看 ssh 版本,确保最新
ssh -V

2、查看 ssh 文档,确认支持的密钥交换算法
man sshd_config |grep -A 40 -w KexAlgorithms

或者使用命令查询:

ssh -Q KexAlgorithms

整理密钥交换算法列表,将以 diffie-hellman- 开头的算法都移除,得到新的列表,如:

sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521

3、查看 ssh 文档,确认支持的加密算法

man sshd_config |grep -A 40 -w Ciphers

或者使用命令查询:

ssh -Q Ciphers

收集加密算法列表,移除 chacha20 开头的算法,得到新的列表,如:

aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com

4、查看 ssh 文档,确认支持的加密算法

man sshd_config |grep -A 40 -w MACs

或者使用命令查询:

ssh -Q MACs

收集加密算法列表,移除 *-etm@openssh.com 结尾的算法,得到新的列表,如:

hmac-sha1,hmac-sha1-96,hmac-sha2-256,hmac-sha2-512,hmac-md5,hmac-md5-96,umac-64@openssh.com,umac-128@openssh.com

5、修改 ssh 配置
vi /etc/ssh/sshd_config

根据以上修改后的新算法列表,添加对应配置,如:

KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com

MACs hmac-sha1,hmac-sha1-96,hmac-sha2-256,hmac-sha2-512,hmac-md5,hmac-md5-96,umac-64@openssh.com,umac-128@openssh.com

保存退出后,重启 ssh 服务,重新连接确认是否正常

systemctl daemon-reload
systemctl restart sshd

参考:https://blog.csdn.net/weixin_44920125/article/details/132271894

https://blog.csdn.net/miaodichiyou/article/details/120504344

https://docs.redhat.com/zh_hans/documentation/red_hat_enterprise_linux/9/html/securing_networks/configuring-and-starting-an-openssh-server_assembly_using-secure-communications-between-two-systems-with-openssh

posted @ 2024-09-04 15:21  不是豆豆  阅读(43)  评论(0编辑  收藏  举报
友情链接:迷途