1.漏洞介绍Diffie-Hellman Key Agreement Protocol是一种密钥协商协议。它最初在 Diffie 和 Hellman 关于公钥密码学的开创性论文中有所描述。该密钥协商协议允许 Alice 和 Bob 交换公钥值并根据这些值和他们自己对应的私钥的知识安全地计算共享密钥K从而实现进一步的安全通信。仅知道交换的公钥值窃听者无法计算共享密钥。Diffie-Hellman Key Agreement Protocol 存在安全漏洞远程攻击者可以发送实际上不是公钥的任意数字并触发服务器端DHE模幂计算。2.修复方法查看服务端支持的kexalgorithmsroottest:/home/dev# sshd -T | grep -w kexalgorithmskexalgorithms curve25519-sha256,curve25519-sha256libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1查看可用的算法mansshd_config|grep-A40-wKexAlgorithms当前 OpenSSH 支持的密钥交换算法列表 默认启用的算法按优先级排序 curve25519-sha256 curve25519-sha256libssh.org ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 sntrup761x25519-sha512openssh.com量子安全算法 diffie-hellman-group-exchange-sha256 diffie-hellman-group16-sha512 diffie-hellman-group18-sha512 diffie-hellman-group14-sha256通过在sshd_config指定使用的算法来完全禁用diffie-hellman算法只使用椭圆曲线算法# 1. 备份配置文件重要sudocp/etc/ssh/sshd_config /etc/ssh/sshd_config.backup# 2. 添加新的配置完全禁用所有 DH 算法echoKexAlgorithms curve25519-sha256,curve25519-sha256libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521/etc/ssh/sshd_config# 3. 测试配置语法sudosshd-t# 4. 重启 SSH 服务sudosystemctl restart sshd# 5. 验证配置是否生效sudosshd-T|grep-wkexalgorithms3.参考文档https://www.cnblogs.com/autopwn/p/16363160.html