1

When an SSH session is rekeyed, does the new key exchange take place within the existing encrypted channel, or does it take place outside of the existing encrypted channel?

1

Key re-exchange is performed using whatever encryption was in effect when the exchange was started

rfc4253

  1. Key Re-Exchange

    Key re-exchange is started by sending an SSH_MSG_KEXINIT packet when not already doing a key exchange (as described in Section 7.1). When this message is received, a party MUST respond with its own SSH_MSG_KEXINIT message, except when the received SSH_MSG_KEXINIT already was a reply. Either party MAY initiate the re-exchange, but roles MUST NOT be changed (i.e., the server remains the server, and the client remains the client).

    Key re-exchange is performed using whatever encryption was in effect when the exchange was started. Encryption, compression, and MAC methods are not changed before a new SSH_MSG_NEWKEYS is sent after the key exchange (as in the initial key exchange). Re-exchange is processed identically to the initial key exchange, except for the session identifier that will remain unchanged. It is permissible to change some or all of the algorithms during the re-exchange. Host keys can also change. All keys and initialization vectors are recomputed after the exchange. Compression and encryption contexts are reset.

    It is RECOMMENDED that the keys be changed after each gigabyte of
    transmitted data or after each hour of connection time, whichever
    comes sooner. However, since the re-exchange is a public key
    operation, it requires a fair amount of processing power and should
    not be performed too often.

    More application data may be sent after the SSH_MSG_NEWKEYS packet has been sent; key exchange does not affect the protocols that lie
    above the SSH transport layer.

  • Thank you, but I think I am trying to find an answer to a slightly different question than the one addressed in that RFC. What I'm trying to determine is whether the new key exchange is encrypted. In other words, is the new key exchange taking place in the existing encrypted session such that an attacker would not be able to even see that new key exchange unless they had obtained the existing ephemeral symmetric key for the SSH session? Thank you. – SSH Question Mar 8 '17 at 12:40
  • as I highlighted in the very first line of my post "Key re-exchange is performed using whatever encryption was in effect when the exchange was started" ... so yes, they key re-exchange is entirely encrypted – CaffeineAddiction Mar 8 '17 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.