0

I am very confused about the way of sending the CA's certificate to another party. What if some hacker is monitoring the network in the moment you send a certificate to other party and hacks the public key from that certificate? He could then pretend that he is you and encrypt the messages using that public key...If anybody can explain a matter of this issue, I would be very grateful!

3

The public key is contained in the certificate which gets sent from the server to the client inside the TLS handshake, so that the client can check if it speaks to the correct server to prevent man in the middle attacks. The certificate is signed by the issuer CA. This signature also includes the public key.

If the public key gets replaced by an attacker the signature of the certificate will therefore be invalid. In this case certificate validation fails and the TLS handshake will be aborted. This means the attacker not also needs to replace the public key but also needs to recreate the signature of the certificate so that it gets valid again. But, to do this he would need to have the private key of a CA which is trusted by the client, i.e. needs to have either compromised such a CA to get to the private key or needs to have compromised the client to install a new trusted CA.

|improve this answer|||||
  • Re "needs to recreate the signature of the certificate" and "to do this he would need to have the private key of a CA". Why would he need to have the private key of a CA? If he had his own public and private key, why could he just create his own certificate that he's digitally signed, intercept messages sent back, and use his own private key to decrypt them? – gkeenley Jun 23 '19 at 16:21
  • 1
    @gkeenley: the answer assumed that the OP is asking about the transfer of CA certificates inside the TLS handshake. In this context usually no root CA are transferred and even if they are transferred they get ignored for verification since the TLS client will not trust arbitrary certificates send during the TLS handshake but trusts only its local trust store. It might be that the OP had a completely different use case (outside TLS) in mind but this one is unknown since the OP never adjusted its question to be more precise about the context. – Steffen Ullrich Jun 23 '19 at 20:06
  • I believe OP is asking about an attacker intercepting the CSR... – ThoriumBR Nov 26 '19 at 22:08
0

I assume that "the way of sending the CA's certificate to another party" is the process where you sent the CSR to the CA to be signed.

What if some hacker is monitoring the network in the moment you send a certificate to other party and hacks the public key from that certificate?

He will most likely intercept the encrypted SSL connection. No CA that deserves its name would accept a CSR from a plain unencrypted unprotected HTTP connection.

If somehow he managed to MiTM the connection, change the public key and send its own, the owner of the original certificate would receive the CA certificate, install it, see every connection failing, test the certificate, and realize they received a certificate that isn't its own. He would proceed to revoke the certificate and request another one.

It's easier to attack the CA instead. Attacking the network infrastructure, changing data in flight and change the CSR to fool the CA and the certificate owner is way harder than to exploit countless possible vulnerabilities on the CA infrastructure and issue your own counterfeit certificate.

This kind of attack already happened a couple times: DigiNotar, Comodo and Gemnet are few examples.

Bonus point: managing to execute the attack you asked gives you access to one certificate. Breaching a CA gives you the power to create any certificate you want.

|improve this answer|||||
  • I believe the CSR is self-signed using the private key corresponding to the public key in the CSR (see serverfault.com/questions/686147/…). So, if an attacker were to intercept the CSR in-route to the CA and modify the public key in the CSR, this would break the signature on the CSR. – mti2935 Nov 26 '19 at 22:40
  • He would not just replace the public key, but the entire CSR. – ThoriumBR Nov 27 '19 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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