1. 程式人生 > 實用技巧 >SecureCRT SSH連線Kali 2020報錯Key exchange failed問題處理記錄

SecureCRT SSH連線Kali 2020報錯Key exchange failed問題處理記錄

Secure CRT 7.0遠端Kali 2020版本時,報錯
Key exchange failed.
No compatible key exchange method. The server supports these methods: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
錯誤原因是SecureCRT 7.0客戶端支援的和kali作為ssh服務端支援的SSH祕鑰交換演算法不匹配。
Secure CRT 7.0的預設支援key exchange演算法:

顯然是不在Kali 2020版本預設支援的dh-g1-sha256,dh-g16-sha512,dh-g18-sha512,dh-g14-sha256這些組合範圍內的。

處理辦法
修改
/etc/ssh/sshd_config配置檔案,增加如下一行,使新版本的Kali Linux支援老版本的祕鑰交換演算法。
KexAlgorithms [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
補充內容
檢視伺服器支援的祕鑰交換演算法
nmap --script ssh2-enum-algos -sV -p <port> <host>
root@kali:~# nmap --script ssh2-enum-algos -sV -p 22 localhost
Starting Nmap 7.80 ( https://nmap.org ) at 2020-08-10 02:08 CDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000064s latency).
Other addresses for localhost (not scanned): ::1
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.3p1 Debian 1 (protocol 2.0) | ssh2-enum-algos: | kex_algorithms: (8) | curve25519-[email protected] | ecdh-sha2-nistp256 | ecdh-sha2-nistp384 | ecdh-sha2-nistp521 | diffie-hellman-group-exchange-sha256 | diffie-hellman-group14-sha1 | diffie-hellman-group-exchange-sha1 | diffie-hellman-group1-sha1 | server_host_key_algorithms: (5) | rsa-sha2-512 | rsa-sha2-256 | ssh-rsa | ecdsa-sha2-nistp256 | ssh-ed25519 | encryption_algorithms: (6) | chacha20-[email protected] | aes128-ctr | aes192-ctr | aes256-ctr | aes128-[email protected] | aes256-[email protected] | mac_algorithms: (10) | umac-64-[email protected] | umac-128-[email protected] | hmac-sha2-256-[email protected] | hmac-sha2-512-[email protected] | hmac-sha1-[email protected] | umac-64@openssh.com | umac-128@openssh.com | hmac-sha2-256 | hmac-sha2-512 | hmac-sha1 | compression_algorithms: (2) | none |_ [email protected] Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel