I've read other some articles (including this: https://medium.com/@technospace/tls-handshake-under-the-hood-79d20c0020de) and similar questions but none exactly like this hypothetical scenario.
What if there is a "man in the middle" between the client and the certification authority and the same MITM is also between Client and server?
Consider the following scenario:
Client <--> MITM <--> Server
- MITM gets the authentic certificate from the Server with Server's public Key
- MITM uses the authentic certificate to create a new version of the certificate containing its own (MITM) public key and sends it to the client.
Client <--> MITM <--> Certification Authority
- Then Client send request to Certification Authority to validate the forged certificate.
- MITM intercepts it this request, sends the original (authentic) version it received from the server to the Certification Authority.
- Certification Authority responds saying that the certificate is valid.
- Client now believes the public key of the MITM is the server public key.
- Since client will now use the MITM public key to encrypt the messages to the server, MITM can use its private key to decrypt all the messages from client to server.
Since this obviously does not happen, what am I missing?
Thanks