Challenges
Replacing parameter g
Cryptography
Medium
DH attacks
Solves: 5
Replacing parameter g
Author: CyberSamSU
Points
45
In many protocols, the p and g parameters are transmitted within the message and the receiver uses them without verifying. A man-in-the-middle can replace g at exactly this point — then the shared secret becomes known in advance.
Three classic injections:
g = 1— any power of1is1.g = p—p ≡ 0 (mod p), meaning everything turns into zero.g = p-1— this element is equal to-1, its order is only 2; its power takes only one of two values.
Below are three recorded sessions of a single server. In each of them, Mallory replaced g. The secret numbers a and b are unknown — but they are not needed anyway.
p = 358495712203025531
g (haqiqiy) = 2
1-sessiya: g' = 1
A = 1
B = 1
2-sessiya: g' = p
A = 0
B = 0
3-sessiya: g' = p - 1
A = 358495712203025530
B = 358495712203025530
Find the shared secret of all three sessions: s₁, s₂, s₃.
Flag: BAYROQ{DH_g_ineksiya_<s1>_<s2>_<s3>}
To submit a flag, log in.