Skip to content

Commit

Permalink
Recognize LANcom LCOS software and support extraction of ssh-ed448 ke…
Browse files Browse the repository at this point in the history
…y type

LANcom router devices appear to be primarily used in Germany (see [1]
for examples on the public Internet), and they appear to support the
`ssh-ed448` key type which is documented in [2], but which has never
been supported by any as-yet-released version of OpenSSH.

[1] https://www.shodan.io/search?query=ssh+%22ed448%22
[2] https://datatracker.ietf.org/doc/html/rfc8709#name-public-key-format
  • Loading branch information
dlenskiSB committed Jun 29, 2024
1 parent df8f238 commit 3361b17
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/ssh_audit/hostkeytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ class HostKeyTest:

'ssh-ed25519': {'cert': False, 'variable_key_len': False},
'[email protected]': {'cert': True, 'variable_key_len': False},

'ssh-ed448': {'cert': False, 'variable_key_len': False},
# '[email protected]': {'cert': True, 'variable_key_len': False},
}

TWO2K_MODULUS_WARNING = '2048-bit modulus only provides 112-bits of symmetric strength'
Expand Down
3 changes: 3 additions & 0 deletions src/ssh_audit/kexdh.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ def recv_reply(self, s: 'SSH_Socket', parse_host_key_size: bool = True) -> Optio
if self.__hostkey_type == 'ssh-ed25519':
self.out.d("%s has a fixed host key modulus of 32." % self.__hostkey_type)
self.__hostkey_n_len = 32
elif self.__hostkey_type == 'ssh-ed448':
self.out.d("%s has a fixed host key modulus of 57." % self.__hostkey_type)
self.__hostkey_n_len = 57
else:
# Here is the modulus size & actual modulus of the host key public key.
hostkey_n, self.__hostkey_n_len, ptr = KexDH.__get_bytes(hostkey, ptr)
Expand Down
4 changes: 4 additions & 0 deletions src/ssh_audit/software.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,8 @@ def parse(cls, banner: 'Banner') -> Optional['Software']:
mx = re.match(r'^PuTTY_Release_(.*)', software)
if mx:
return cls(None, Product.PuTTY, mx.group(1), None, None)
mx = re.match(r'^lancom(.*)', software)
if mx:
v, p = 'LANcom', 'LCOS sshd'
return cls(v, p, mx.group(1), None, None)
return None
3 changes: 2 additions & 1 deletion src/ssh_audit/ssh2_kexdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class SSH2_KexDB: # pylint: disable=too-few-public-methods
INFO_DEPRECATED_IN_OPENSSH88 = 'deprecated in OpenSSH 8.8: https://www.openssh.com/txt/release-8.8'
INFO_DISABLED_IN_DBEAR67 = 'disabled in Dropbear SSH 2015.67'
INFO_DISABLED_IN_OPENSSH70 = 'disabled in OpenSSH 7.0: https://www.openssh.com/txt/release-7.0'
INFO_RFC8709_NOT_OPENSSH = 'described in RFC8709 but never implemented in OpenSSH'
INFO_NEVER_IMPLEMENTED_IN_OPENSSH = 'despite the @openssh.com tag, this was never implemented in OpenSSH'
INFO_REMOVED_IN_OPENSSH61 = 'removed since OpenSSH 6.1, removed from specification'
INFO_REMOVED_IN_OPENSSH69 = 'removed in OpenSSH 6.9: https://www.openssh.com/txt/release-6.9'
Expand Down Expand Up @@ -245,7 +246,7 @@ class SSH2_KexDB: # pylint: disable=too-few-public-methods
'[email protected]': [[], [FAIL_1024BIT_MODULUS]],
'ssh-ed25519': [['6.5,d2020.79,l10.7.0']],
'[email protected]': [['6.5']],
'ssh-ed448': [[]],
'ssh-ed448': [[], [], [], [INFO_RFC8709_NOT_OPENSSH]],
'[email protected]': [[], [], [], [INFO_NEVER_IMPLEMENTED_IN_OPENSSH]],
'ssh-gost2001': [[], [FAIL_UNTRUSTED]],
'ssh-gost2012-256': [[], [FAIL_UNTRUSTED]],
Expand Down

0 comments on commit 3361b17

Please sign in to comment.