Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the man in the middle attack work in Diffie–Hellman?

I'm having doubts about the mechanics of a man in the middle attack during a Diffie–Hellman key exchange. I have heard that it can happen during the key agreement communication. But in the presence of CA (Certificate Authority) the receiver can authenticate the sender as he received the sender's public key. Therefore, how is a man in the middle attack possible?

like image 810
Chanikag Avatar asked May 06 '12 13:05

Chanikag


People also ask

How man-in-the-middle attack takes place in Diffie-Hellman?

"The Diffie-Hellman key exchange is vulnerable to a man-in-the-middle attack. In this attack, an opponent Carol intercepts Alice's public value and sends her own public value to Bob. When Bob transmits his public value, Carol substitutes it with her own and sends it to Alice.

Does Diffie-Hellman protect against MITM?

So the common ephemeral-ephemeral Diffie-Hellman scheme does not protect against MITM attacks, and your premise is false. Some DH protocols where both parties are authenticated may actually prevent MITM attacks.

How does the Diffie-Hellman algorithm work?

The Diffie–Hellman (DH) Algorithm is a key-exchange protocol that enables two parties communicating over public channel to establish a mutual secret without it being transmitted over the Internet. DH enables the two to use a public key to encrypt and decrypt their conversation or data using symmetric cryptography.

Why Diffie-Hellman key exchange algorithm alone is not secure against man in the middle attacks briefly explain?

Authentication & the Diffie-Hellman key exchange In the real world, the Diffie-Hellman key exchange is rarely used by itself. The main reason behind this is that it provides no authentication, which leaves users vulnerable to man-in-the-middle attacks.


2 Answers

I think you're confusing the basic Diffe-Hellman, which is a key exchange protocol, with the 'authenticated version' which uses a certificate authority (CA).

Nice explanation of how the basic Diffe-Hellman is vulnerable to man-in-the-middle from RSA Labs.

"The Diffie-Hellman key exchange is vulnerable to a man-in-the-middle attack. In this attack, an opponent Carol intercepts Alice's public value and sends her own public value to Bob. When Bob transmits his public value, Carol substitutes it with her own and sends it to Alice. Carol and Alice thus agree on one shared key and Carol and Bob agree on another shared key. After this exchange, Carol simply decrypts any messages sent out by Alice or Bob, and then reads and possibly modifies them before re-encrypting with the appropriate key and transmitting them to the other party. This vulnerability is present because Diffie-Hellman key exchange does not authenticate the participants. Possible solutions include the use of digital signatures and other protocol variants."

and it follows with the authenticated version, also known as the Station-to-Station protocol:

"Roughly speaking, the basic idea is as follows. Prior to execution of the protocol, the two parties Alice and Bob each obtain a public/private key pair and a certificate for the public key. During the protocol, Alice computes a signature on certain messages, covering the public value ga mod p. Bob proceeds in a similar way. Even though Carol is still able to intercept messages between Alice and Bob, she cannot forge signatures without Alice's private key and Bob's private key. Hence, the enhanced protocol defeats the man-in-the-middle attack."

So the basic version is susceptible to a man-in-the-middle attack, the authenticated version that uses public key certificates is not.

like image 134
Peanut Avatar answered Sep 20 '22 10:09

Peanut


This is how Diffie-Hellman works:

Diffie-Hellman

And this is how the man-in-the-middle attack works in Diffie-Hellman:

mitm

There are two D-H key exchange, Alice and Attacker share the same key with k1, while Bob and Attacker share the other same key with k2.

Because Alice and Bob had no prior knowledge of each other.

But the Attacker must keep listening and forwarding.

like image 31
JZAU Avatar answered Sep 21 '22 10:09

JZAU