SSH server key exchange fails with dropbear dbclient due to RFC4253 sec 7 "each side MAY guess" #8676
Labels
bug
Issue is reported as a bug
Planned
Focus issue added in sprint planning
priority:medium
stalled
waiting for input by the Erlang/OTP team
team:PS
Assigned to OTP team PS
Describe the bug
Using the SSH client from dropbear might fail to connect to the SSH server implementation of OTP, with following error:
The reason is that the dropbear client may send a guess KEXINIT and if the guess doesn't match it will send another KEXINIT which then fails the state machine. This is described in RFC4253 sec 7:
The initial guess send happens here:
https://github.com/mkj/dropbear/blob/2674736bce847bc51a30a07c191562047659ac1f/src/common-kex.c#L112
and depending on whether the first guess matches or not, another KEX might be send:
https://github.com/mkj/dropbear/blob/2674736bce847bc51a30a07c191562047659ac1f/src/common-kex.c#L1037
The OTP ssh code only seems to encode the
first_kex_packet_follows
in thessh_msg_kexinit
but doesn't appear to support it in the receiving part.To Reproduce
Use dropbear dbclient to connect to OTP SSH daemon and cause the
preferred_algorithms
kex
andpublic_key
to not match the order of what dropbear uses.dropbear should build easily:
change the order of the
kex
andpublic_key
values when starting the daemon:If the first entry doesn't match the first guess dropbear uses, it will send another KEXDH_INIT causing the connection to terminate.
Expected behavior
OTP SSH should support the key exchange guess as described in RFC4253 section 7.
Affected versions
tested on OTP SSH 5.1.1 and 5.2
Additional context
The dropbear code has a define to disable this code:
https://github.com/mkj/dropbear/blob/2674736bce847bc51a30a07c191562047659ac1f/src/sysoptions.h#L55
but this is ofcourse not a solution as one can't always control which client is used.
The text was updated successfully, but these errors were encountered: