From 338ffc5adb294002641b4332318406fd2b30fd7f Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Thu, 5 Nov 2020 20:29:39 -0500 Subject: [PATCH] Fixed crash when receiving unexpected response during host key test. --- README.md | 1 + src/ssh_audit/hostkeytest.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f37f485..b209a54 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,7 @@ For convenience, a web front-end on top of the command-line tool is available at ## ChangeLog ### v2.4.0-dev (???) - Added version check for OpenSSH user enumeration (CVE-2018-15473). + - Fixed crash when receiving unexpected response during host key test. ### v2.3.1 (2020-10-28) - Now parses public key sizes for `rsa-sha2-256-cert-v01@openssh.com` and `rsa-sha2-512-cert-v01@openssh.com` host key types. diff --git a/src/ssh_audit/hostkeytest.py b/src/ssh_audit/hostkeytest.py index c6b6cfe..c220c3f 100644 --- a/src/ssh_audit/hostkeytest.py +++ b/src/ssh_audit/hostkeytest.py @@ -135,9 +135,12 @@ class HostKeyTest: # Do the initial DH exchange. The server responds back # with the host key and its length. Bingo. We also get back the host key fingerprint. kex_group.send_init(s) - host_key = kex_group.recv_reply(s, variable_key_len) - if host_key is not None: - server_kex.set_host_key(host_key_type, host_key) + try: + host_key = kex_group.recv_reply(s, variable_key_len) + if host_key is not None: + server_kex.set_host_key(host_key_type, host_key) + except Exception: + pass hostkey_modulus_size = kex_group.get_hostkey_size() ca_modulus_size = kex_group.get_ca_size()