Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do cryptography in SSH(2) work (secure channel establishment, authentication)?

Does key authentication in SSH(2) protect from MitM by providing authentication and integrity and why?

share|improve this question

I am sorry that I can not comment your post, and have to write this as answer...

But maybe you want to move this question to

And the security goal of key authentication is that both enities can be sure that the public key of the other person actually does belong to the other person. This should prevents a potential attacker from passing false keys to both parites in order to decipher their communication.

If by authentication and integrity you mean key authentication and key integrity, and by that you meant what i will just assume you meant, I would say yes, it protects from "this kind of" mitm attacks. But remember that there are still other methods to perform mitm attacks.

share|improve this answer
But maybe you want to move this question to - Why?… – Smit Johnth Apr 16 '13 at 9:57
Because there is a difference between cryptography and it security, just as there is between the question you linked, and the question you posted. If there wasn't, your linked question should also answer your posted question. If you are interested in the cryptographic aspects of SSH and performing MitM attacks, you should rephrase your question a bit ;) – user1451340 Apr 16 '13 at 11:04
Does someone else share the opinios of user1451340? – Smit Johnth Apr 17 '13 at 8:58

How do cryptography in SSH(2) work?

This is a very broad question. If you're interested in the details, then read the relevant RFCs that describe the SSH protocol. In particular:

Does key authentication in SSH(2) protect from MitM by providing authentication and integrity and why?

Assuming you're referring to Public Key Authentication (where a client authenticates by proving they hold the private key of a pre-shared public key), then not directly/entirely. Public key authentication is a feature of the SSH Authentication Protocol, which runs on top of the SSH Transport Protocol, and generally assumes that the transport protocol provides confidentiality and integrity.

The Public Key Authentication does provide some protection against mitm attacks (by associating the proof of the private key with the SSH session ID), which will prevent the mitm passing on the private key proof as an authentication credential, but won't prevent an attacker using other credentials to access the target system.

The primary mechanism for man-in-the-middle prevention in the SSH Transport Protocol is the verification of pre-shared (or otherwise verifiable via some trusted channel) host keys.

RFC 4251 - The Secure Shell (SSH) Protocol Architecture discusses potential Man-in-the-middle attacks on the SSH protocol and the approaches taken to prevent them.

share|improve this answer
Let's speak only about public key cryptography, as it's the one attacked by MitM. – Smit Johnth Apr 20 '13 at 16:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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