diffie-hellman - 如何利用Diffie-hellman进行中间人攻击

标签 diffie-hellman man-in-the-middle

我正在做一个项目,Alice 和 Bob 使用 Diffie-Hellman key 交换相互发送消息。让我陷入困境的是如何将他们正在使用的证书合并到其中,以便我可以获得他们的 secret 消息。

根据我对 MIM attakcs 的理解,MIM 充当冒名顶替者,如下图所示:

enter image description here

以下是我的项目的详细信息。我知道他们在交流之前都同意了 g 和 p ,但是我如何能够在他们都有证书来验证他们的签名的情况下实现这一点?

Alice 准备 ⟨signA(NA, Bob), pkA, certA⟩ 其中 signA 是 Alice 使用的数字签名算法,“Bob”是 Bob 的名字,pkA 是 Alice 的公钥,它等于根据 X 编码的 gx mod p。 509 对于固定的 g,在 Diffie-Hellman key 交换中指定的 p,certA 是 Alice 的证书,其中包含 Alice 验证签名的公钥;最后,NA 是一个 8 字节长的随机数(随机字符串)。

Bob 检查 Alice 的签名,并使用 ⟨signB{NA,NB,Alice},pkB,certB⟩ 进行响应。 Alice 得到消息,她检查她的 nonce NA,并根据 Diffie-Hellman key 交换基于 pkA、pkB 计算联合 key 。然后 Alice 将消息 ⟨signA{NA,NB,Bob},EK(MA),certA⟩ 提交给 Bob,Bobrespondswith⟨SignB{NA,NB,Alice},EK(MB),certB⟩。

其中 MA 和 MB 是它们对应的 secret 消息。

最佳答案

提供 the Wikipedia answer :

In the original description, the Diffie–Hellman exchange by itself does not provide authentication of the communicating parties and is thus vulnerable to a man-in-the-middle attack. A person in the middle may establish two distinct Diffie–Hellman key exchanges, one with Alice and the other with Bob, effectively masquerading as Alice to Bob, and vice versa, allowing the attacker to decrypt (and read or store) then re-encrypt the messages passed between them.

A method to authenticate the communicating parties to each other is generally needed to prevent this type of attack. Variants of Diffie-Hellman, such as STS, may be used instead to avoid these types of attacks.


你可以考虑通过讨论 the variants of Diffie-Hellman that are more secure 给你的教授留下深刻印象.现在,鉴于您已经注意到原始实现,这将起作用。
祝你好运!

关于diffie-hellman - 如何利用Diffie-hellman进行中间人攻击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9953187/

相关文章:

security - 使用 oauth2 客户端凭据防止中间人攻击

Java 安全性从 SecretKeySpec 正确初始化 Cipher

Python——中间人

javascript - 使用 WebCrypto 从 PBKDF2 生成 ECDH key

encryption - 如何生成带有 DH 参数的证书

ssl - TLS 握手期间中间人攻击的可能性

https - 鱿鱼 SSL 碰撞 3.5.4 : error - Error negotiating SSL connection on FD 10: Success (0)

ssh - diffie-hellman ssh key 交换

javascript - 使用 Diffie-Hellman key 交换和 AES 通过 HTTP 进行客户端加密