Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL: How are certificates protected against man in the middle attacks?

My question is about certificates specifically in ssl but I think the questions should apply to all certificates. I have included the SSL procedure for the sake of clarity.

In SSL this is what I understand the procedure is:

1)Client

  • sends supported crypto algorithms
  • sends client nonce
  1. Server
  • chooses (and sends) a
  • symmetric algorithm
  • a public key algorithm
  • a MAC algorithm
  • sends it's certificate
  • sends server nonce
  1. Client
  • verifies certificate
  • Extracts public key
  • Generates a pre-master secret key (pms)
  • encrypts with servers public key and sends
  1. Client and Server
  • compute master secrete (MS) from PMS and nonces
  • PMS sliced to generate two encryption & two mac keys
  1. Client
  • sends a mac of all handshakes (to ensure they were not previously modifide)
  1. Server
  • sends a mac of all handshakes

Question

What stops a man in the middle attack from happening at step two? Why can't a man in the middle, say trudy, capture the certificate sent by the server and change the public key in it (to something it has the private key to).

I assume that the certificate is encrypted somehow.

However the server cannot encrypt the certificate because the client does not have the public key yet. When the server gets the key from an authority (like veri-sign) would the key be pre-encrypted using verisign's public key? I think this should work because all web browsers should have the public keys of most authorities.

like image 320
sixtyfootersdude Avatar asked Jan 21 '10 13:01

sixtyfootersdude


People also ask

How does SSL prevent man in the middle attacks?

The certificate is used to authenticate the server instead, i.e. make sure that the client is actually talking to the correct server and not to some man in the middle. This authentication is essential to protect the key exchange and thus the encryption build on this key exchange.

Is man-in-the-middle attack possible with SSL?

Another form of man-in-the-middle attack happens when a hacker manages to stage an SSL stripping scheme against the victim. As we mentioned previously, hackers can't break into legitimate HTTPS traffic between a client and a server even if they manage to intercept and relay the communications.

Does a self signed certificate provide protection from a man-in-the-middle attack?

While self-signed certificates serve their purpose for encrypting communications, relying on them in production invites Man in the Middle attacks as users are no longer able to verify the legitimacy of the system's identity.


1 Answers

No, the certificate is not encrypted. But it is signed by a certification authority (CA). Since those check the information included in the certificate (especially the URL to which the cert belongs), there shouldn't be a second valid certificate for a given URL.

The cert of the CA is checked against a trust store (e.g. in your browser). If this truststore is compromised, or if you trust not valid certificates, there is no protection against man in the middle attacks

like image 124
Jens Schauder Avatar answered Sep 22 '22 14:09

Jens Schauder