is ssl secure on both ways?

2020-02-07 05:03发布

问题:

I know that certificates that are sent by the server cant be faked (still there is MD5 collisions but costy) but what about faking the client .. in man in the middle attack: cant we tell the server that we are the legitimate client and take data from that server manipulate it then encrypt it again with legitimate client public key ? how does the client be sure that the data came really from the server ?

in theory .. can we inject any data into the response sent by the server to the client ?..

回答1:

How are you authenticating the client? SSL client certificates? Or some application level system (cookies etc)?

Here's what SSL does in a nutshell:

  • Negotiates a Diffie-Helmann shared session key between the two parties
  • Has the server sign the session key and send the result to the client. Once the client verifies this, the client knows there is no MITM, and the server is who they say they are.
  • If client certificates are enabled, has the client sign the session key and send the signature to the server. The server now knows there is no MITM and the client is who they say they are.
  • Encrypts all data in both directions using the shared session key

Typically when you use SSL you won't use client certificates. Strictly speaking, the server does not know if the connection is MITM'd. However, most clients will disconnect if the server certificate is bad. The server assumes that if the client pushes forward with the connection, there is no MITM. Even if Mallory, doing the MITM, chooses not to propagate the disconnect from the client, he has no new information now; all he's done is connected to the server himself. Without intercepting the client's session cookie or other authentication information (which is only sent by the client after verifying the connection is secure) the MITM is useless.

So in short, as long as one end or the other verifies the certificate of the other end before initiating any high-level communication of sensitive information, SSL is secure in both directions.



回答2:

You're right -- without secure certificate authentication on the client and server there is an opening for a man in the middle attack.

SSL can be "secure both ways" if you use mutual authentication also called two-way SSL.



标签: ssl https