-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kex: allow SNTRU-Prime #8
Conversation
I think you are making a point here. I do agree AES-GCM sucks, and if it is not for migrating the Terrapin attack, I always preferred ChaCha20-Poly1305 rather than AES-GCM.
[1]:
https://terrapin-attack.com/ |
OpenSSH 9.0 and later supports SNTRU-Prime (source), although I did misread about the ChaCha20-Poly1305 being involved in the Terrapin vulnerability so I'll remove that from the PR. |
I believe it's fine, the connection should just automatically fall back to one of the other algorithms, but the additional security for users who do have OpenSSH 9.0+ would greatly reduce the risk of "harvest now, decrypt later". |
How about arranging it to the beginning? |
It seems the issue with Chacha20-Poly1305 has been addressed so I'll only focus on the KEX here. Given that the "newer & better" post-quantum KEX algorithm may be preferred, I'd concur that we move it to the top of the list to give it a higher priority. While reviewing the The complete list looks something like this:
Let me know what you think of this. @brxken128 @IceCodeNew Also thanks for the PR. I didn't know this new algo came out. |
That looks pretty solid to me! Hybrid PQ for setups that can take advantage of it > The 2048-bit prime used by the group 14 variant raises concerns about its long-term security, especially given recent advancements in discrete logarithm solving. This doesn't necessarily mean immediate compromise of course, but I think it's definitely a risk to consider. Group 16 and 16 use larger primes, so they can probably stay in order to support the rare (but not unheard of) extremely outdated configurations, but I personally believe that group 14 should be removed. Most deployments, especially modern ones, will almost certainly support at least some of the stronger algorithms higher up in the chain (whether that's I'd love to hear your thoughts - these are just my two cents and you may have another angle that I've yet to consider! Again, I must apologise regarding the original ChaCha20 inclusion; I completely misread the Terrapin details and should have double checked - thank you for the correction. I'll wait for a response before changing this PR so that we're both/all on the same page! |
I agree 2048 bits is a bit too small in this day and age. The full revised list will be:
...or in sshd_config:
This looks sound to me. I'll await @IceCodeNew's input. |
There is a reason for removing those algorithms, not for vulnerabilities of the ECDH suites, but for serious misgivings about the very design in the NIST P-curves. Refer to: jtesta/ssh-audit#213 (comment)
To put my two cents in, I prefer to remove the following Kex algorithms:
|
Ah yes thanks @IceCodeNew. There's got to be a reason why they were originally excluded. I just couldn't remember. I'd agree with removing the NIST P-curves. In addition, perhaps add some comments so this is documented. @brxken128 do you wanna go ahead and update the PR? |
I just found out that the KEX algorithm "diffie-hellman-group17-sha512" is not supported by https://github.com/rapier1/hpn-ssh . It might also break on other implementations. # /usr/sbin/hpnsshd
Unsupported KEX algorithm "diffie-hellman-group17-sha512"
/etc/hpnssh/sshd_config.d/01-harden-by-icn.conf line 107: Bad SSH2 KexAlgorithms 'sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group18-sha512,diffie-hellman-group17-sha512,diffie-hellman-group16-sha512'. |
There hasn't be any activity from @brxken128. Given this is a security patch I'd like to not stall it for too long, so I'll go ahead and edit the commits. Given what we have discussed, I believe this is the list of algos that should be used:
If something isn't right we can reopen or create a new issue. |
I apologise for the lack of a response, and thank you for making the changes and finishing the PR off. I'm glad I could help and improve this config regardless - I've personally adopted it on all of my SSH servers and I feel better knowing that everything is well thought out and in good hands! |
This PR adds the SNTRU-Prime key exchange, and adds ChaCha20-Poly1305 back as a symmetric algorithm.
#7 (arguably incorrectly) removed ChaCha20-Poly1305 from the approved ciphers. It is an AEAD, similar in function to AES-GCM, however it is likely more secure in the grand scheme of things and isn't vulnerable to the Terrapin attack. This blog post mentions some of the shortcomings of AES-GCM, but more importantly highlights some of the benefits for (X)ChaCha20-Poly1305. XChaCha has the advantage of a 192-bit nonce, but the base ChaCha is not too far off.
SNTRU-Prime is a lattice-based post-quantum key exchange and aims to patch some of the shortcomings with current key exchanges, going into the post-quantum era. In the OpenSSH implementation, it's used in hybrid mode with x25519 - this way, if one fails (whether that's SNTRU-Prime or x25519), the other will likely still hold up.