Bug 2810 - Broken compatibility with old SSH clients sending 1.99 identification
Summary: Broken compatibility with old SSH clients sending 1.99 identification
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 7.6p1
Hardware: Other Linux
: P5 enhancement
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks: V_7_7
  Show dependency treegraph
 
Reported: 2017-12-13 23:30 AEDT by Jakub Jelen
Modified: 2021-04-23 15:02 AEST (History)
3 users (show)

See Also:


Attachments
don't refuse SSH-1.99 clients (627 bytes, patch)
2018-01-05 13:42 AEDT, Damien Miller
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelen 2017-12-13 23:30:59 AEDT
The git commit 97f4d30 [1] introduced a the following change that I suspect is wrong:

-	if (remote_major == 2 ||
-	    (remote_major == 1 && remote_minor == 99)) {
-		enable_compat20();
-	} else {
+	if (remote_major != 2 ||
+	    (remote_major == 1 && remote_minor != 99)) { 

The first part of condition is correctly negated to leave the same behavior for 2.0 clients, but not the second part. The correct result should look like this:

+	if (remote_major != 2 &&
+	    !(remote_major == 1 && remote_minor == 99)) { 

So we will not bail out on comparing 2.0 with 1.99 protocol versions.

Additionally, if I read the RFC 4253, Section 5.1 [1] correctly, the client should not send the 1.99 identification and therefore it is also a bug of a client. But it worked before OpenSSH 7.6 and the above change is clearly wrong.

This was initially discussed in Red Hat bugzilla [3].

[1] https://github.com/openssh/openssh-portable/commit/97f4d3083b036ce3e68d6346a6140a22123d5864#diff-4035368a40ab0fedd413faefcbf832d7
[2] https://tools.ietf.org/html/rfc4253#section-5.1
[3] https://bugzilla.redhat.com/show_bug.cgi?id=1524392#c26
Comment 2 Damien Miller 2018-01-05 13:42:20 AEDT
Created attachment 3109 [details]
don't refuse SSH-1.99 clients

doh, you're quite right
Comment 3 Damien Miller 2018-01-23 16:09:22 AEDT
Fix applied, will be in OpenSSH 7.7
Comment 4 Damien Miller 2021-04-23 15:02:27 AEST
closing resolved bugs as of 8.6p1 release