When you are connected to another computer over SSH, is all data transferred between the two computers encrypted? Or is any data sent in plaintext or any other "easy to intercept" format?
-
Note: Look up the Diffie–Hellman key exchange method for an example that builds a shared secret upon a non-secured channel in the presence of an eavesdropper.– user47081Commented May 22, 2014 at 14:27
-
No. - The public keys that are established are not encrypted. This is intentional and isn't a security risk.– Ten BitcombCommented May 22, 2014 at 23:34
1 Answer
For any protocol, you could come up with a definition of "all data" that would necessarily imply that something isn't sent encrypted.
For example, during the initialization and key exchange, the algorithm selection is public. Your average cryptographer will give you little more than a raised eyebrow if you complain about that fact though, since obviously it can't be encrypted as you haven't selected an algorithm yet.
Obviously something has to be sent unencrypted if for no other purpose than to set up encryption. But once the connection is secure, everything is secure. Once you have an encrypted channel, nothing from that point on is sent outside that channel. Furthermore, the protocol is extremely cautious to avoid sending any sensitive data before encryption is available. No username, no password, no identification of any sort, no indication of purpose, or any of that.
What little there is to decode is readily decode-able using common free tools such as wireshark. Fire up a packet capture, start an SSH session, and examine the exchange yourself. You'll see immediately what can be seen and what can't. Wireshark does a great job at decoding the protocol to allow you to view the internals of how it works.... to the extent that it's visible to someone watching the network traffic.
The typical flow looks like this:
- SSH version/software identification
- Key exchange init (algorithm selection)
- Diffie-Hellman key exchange (uses SSH host key to prevent MITM)
Everything after this is encrypted - User authentication (including user key-based authentication)
- SSH Session now activate
-
1What if a password is used for authentication instead of logging in with a public key? Commented May 22, 2014 at 7:00
-
7@IQAndreas the encrypted session is set up before any authentication is attempted.– tylerlCommented May 22, 2014 at 7:09
-
14@IQAndreas: Your login key is not the same as the server's SSH key. No matter how you login, the SSH session has already been established. Commented May 22, 2014 at 9:23
-
1
-
@tylerl Actually the public key of the server is encrypted. That's not because the public key needs to be kept secret, but rather because the SSH protocol is designed to negotiate a session key and enable encryption, before it does anything else.– kasperdCommented May 23, 2014 at 6:23