Search code examples
sslhttpscertificatessl-certificateman-in-the-middle

Man in the middle attack using Https and a second valid certificate


It is possible to perform a man in the middle attack considering this situation:

  1. The communication use the HTTPS protocol
  2. The attacker sniffs a request from the client, and sends to the client itself a valid certificate signed by a CA (not the real server's certificate, but a own certificate signed by a CA - not a self signed certificate)
  3. The attacker redirects the client's request to a URL of his server

    Does the client notice something? And eventually what is the solution for this problem?

Solution

  • This is not possible if the client is checking the certificate properly. Proper validation not only checks if the certificate is signed by a trusted CA but also includes a check if the target of the request matches the subject of the certificate. In case of HTTP this means to check if the hostname in the URL is contained in the subject of the certificate.