Implement OpenSSH strict key exchange extension#1366
Merged
Rob-Hague merged 19 commits intosshnet:developfrom Apr 24, 2024
Merged
Implement OpenSSH strict key exchange extension#1366Rob-Hague merged 19 commits intosshnet:developfrom
Rob-Hague merged 19 commits intosshnet:developfrom
Conversation
is only valid in the initial SSH2_MSG_KEXINIT and MUST be ignored if they are present in subsequent SSH2_MSG_KEXINIT packets.
Closed
Rob-Hague
reviewed
Apr 8, 2024
Collaborator
Rob-Hague
left a comment
There was a problem hiding this comment.
It looks good so far. I know that the integration tests are testing this in the positive case (i.e. they are using strict KEX), but it would make sense to add some tests in the negative cases assuming a bad actor, e.g.
- When we have strict KEX established, and we receive SSH_MSG_IGNORE (or other) during the key exchange. We should check that the connection fails.
- Conversely, when we don't have strict KEX established, we should not fail when receiving SSH_MSG_IGNORE (or other) during the key exchange
- When we have strict KEX established, and the peer does not reset the sequence number. We should check that the connection fails.
- Maybe some other cases?
test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs is probably a good starting point for simulating connections (either deriving from that or copying stuff out)
Strictly disable non-kex massages in strict kex mode.
scott-xu
commented
Apr 16, 2024
Rob-Hague
reviewed
Apr 16, 2024
Collaborator
Rob-Hague
left a comment
There was a problem hiding this comment.
Thanks for all the tests. I will run this in production for a week or two
...hNet.Tests/Classes/SessionTest_Connecting_ServerSendsDebugMessageAfterKexInit_NoStrictKex.cs
Outdated
Show resolved
Hide resolved
...nci.SshNet.Tests/Classes/SessionTest_Connecting_ServerSendsMaxIgnoreMessagesBeforeKexInit.cs
Outdated
Show resolved
Hide resolved
…s about to wrap during init kex.
Rob-Hague
reviewed
Apr 24, 2024
Rob-Hague
approved these changes
Apr 24, 2024
Collaborator
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR implements the algorithm described in section 1.10 of https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.
All integration tests passed, especially
*-etm@openssh.comHMAC variants.Resolves #1285
Terrapin Scanner report without this PR:
Terrapin Scanner report with this PR: