Assume that a man-in-the-middle attack on the Diffie-Hellman key exchange protocol is possible, for which the adversary generates two public–private key pairs for the attack.
Could the same attack be accomplished with one pair?
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It only takes a minute to sign up.Sign up to join this community
For the attack to work the attacker - say Malory - needs to establish a secret with the party that starts the key agreement, say Alice. After that Malory needs to establish a secret with the party providing the intended service, say Bob.
Assuming that we are talking about ephemeral (non-static) keys then there is nothing preventing Malory to use the same Diffie-Hellman key pair for both Alice and Bob. The established secrets will still differ of course, as the secret also depends on the key pairs generated by Alice and Bob.
Alice was already expecting to use the same domain parameters and key size as Bob. Otherwise she would not be able to establish a secret with Bob directly.
So yes, Malory - the man-in-the-middle - can use a single key pair for this. Malory could even use a single static key pair for all the connections to Bob (assuming that Bob accepts the same public value for multiple connections and doesn't keep a log).
Note that we presume here that the key pair of Alice or Bob is not also used for authentication, because that would prevent man-in-the-middle attacks in the first place.