0

(shown in step 1): Is the initial process in public key encryption where the public key is transferred across the network done in plaintext? It seems like it must be, which essentially means that no matter if a victim is using HTTPS or a VPN on a public network, if the initial process is done in plain text, than a middleman who has full access to the network traffic can essentially just intercept that initial public key transfer process, steal the key, and effectively intercept the rest of the victims "secure" transmission in their "secure" internet session?

enter image description here

So if I am right, public networks are only secure as long as the device obtaining the public key was there before the attacker was?

2
  • A public key is public, the attacker doesn't need to intercept it, we already assume they have it. If the public key is used for messaging, then only the related private key owner can decrypt it. Of course, we want signatures on the sent messages, too. If the public key is used for verifying the signatures, that ok, we already wanted that, too...
    – kelalaka
    Oct 16, 2021 at 8:31
  • If the attacker introduces their public and private key to the communication, and the clients think that this public key is the servers' key then we have a problem. That is why we have CA as the only solution
    – kelalaka
    Oct 16, 2021 at 8:34

3 Answers 3

1

Yes. This is where PKI comes into play, where a trusted 3rd party (a trusted CA) ensures you: "yes, this is Mr. Smith/example.com, I personally issued a certificate to him, you can verify my signature under his X.509 certificate using my public key which you already know". It's basically how TLS works.

1

Yes, it is.

It's one of the core problems of the Public-Key Cryptography and there are several ways that this could be mitigated.

Web-of-Trust

The idea of the Web of Trust is that you verify - in person - who a key belongs to, and assign trust to it. So you can trust those, whom you verified personally. But you can also trust someone, who was verified by someone you trust. This way, trust propagates, because people each individually verify each other.

At least...in theory. In practice, this design doesn't work all too well, because most people don't ask you for your public key fingerprint and write it down, then manually trust it at home. No, they download your public key from your website and trust (no pun intended) that it will be fine.

Certificates and Certificate Authorities

A more common and arguably more successful approach is that of Certificates and Certificate Authorities (CAs). The basic idea is that a set of public keys of authorities are given to you out-of-band (e.g. when you install your OS). These public keys are then used to sign other public keys, and those again sign other public keys.

If you wish to check whether or not someone or something is "trustworthy", you check if their key has been signed by a Certificate Authority you trust, or by another key, which is signed by a Certificate Authority you trust.

1
  • 1
    Excellent answer, as usual. But, I believe OP's question is not about an attacker creating a fake public key or certificate for the server. It seems that OP is asking what prevents an attacker who is positioned between the client and the server from intercepting the connection, given that the attacker has knowledge of the public key, because the public key is sent from the server to the client in the clear.
    – mti2935
    Oct 15, 2021 at 13:13
1

a middleman who has full access to the network traffic can essentially just intercept that initial public key transfer process, steal the key, and effectively intercept the rest of the victims "secure" transmission

No.

The middleman would not have the private key associated with the public key that he has intercepted. Therefore, he would not be able to intercept the session key sent from the client to the server in step 2 of your diagram.

Related: Could a stolen certificate show as trusted?

20
  • 1
    Of course he can. If Alice sends her public key to Bob and Mallory intercepts it, then Mallory can exchange it for his public key. Bob would still believe the key he received is from Alice and trust it.
    – user163495
    Oct 15, 2021 at 12:54
  • 1
    @MechMK1, OP is describing a scenario where the attacker intercepts the server's public key then attempts to use it, not a scenario where the attacker attempts to create a fake public key / certificate for the server - i.e. a middleman who has full access to the network traffic can essentially just intercept that initial public key transfer process, steal the key,.
    – mti2935
    Oct 15, 2021 at 12:59
  • 1
    @twominds This is how asymmetric cryptography works. A message is encrypted with the recipient's public key, then the recipient uses his private key to decrypt the message. See en.wikipedia.org/wiki/Public-key_cryptography.
    – mti2935
    Oct 15, 2021 at 13:02
  • 1
    @twominds. Yes, that is correct. The public key is used to encrypt a message. The encrypted message is the 'ciphertext'. The public key cannot be used to decrypt the ciphertext. Only the private key can be used to decrypt the ciphertext. This is the way the algorithm works.
    – mti2935
    Oct 15, 2021 at 13:07
  • 1
    @mti2935 That's not how real life attacks work. An attacker will do whatever they can, not adhere to some arbitrary constraints set by a theoretical scenario. Sure, if they only read the key, then there's nothing the attacker can do. However, interception means being able to modify the network communication, and in this case, it's game over.
    – user163495
    Oct 15, 2021 at 13:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .