Path: blob/main/foundations/05-discrete-log-diffie-hellman/break/pohlig-hellman-smooth-order.ipynb
483 views
Break: Pohlig-Hellman Attack on Smooth-Order DH
Module 05 | Breaking Weak Parameters
When is smooth, an eavesdropper can recover both DH secret exponents.
Why This Matters
The Pohlig-Hellman attack (explored in 05f for abstract DLP) becomes devastating when applied to a full Diffie-Hellman key exchange. If the group order is smooth (factors into only small primes), an eavesdropper who sees the public keys and can:
Recover Alice's secret exponent from
Recover Bob's secret exponent from
Compute the shared secret
Unlike the small subgroup attack, this is a passive attack --- Eve only needs to eavesdrop, not modify any messages.
The Scenario
Alice and Bob perform a DH exchange with a prime where is smooth. Eve intercepts both public keys and and recovers the shared secret.
We'll use where . The largest prime factor is just 7.
Step 3: Eve Applies Pohlig-Hellman to Recover
The Pohlig-Hellman algorithm:
Factor
For each prime power : project and into the subgroup of order , and solve the DLP there by brute force
Combine results using the Chinese Remainder Theorem
Since each is small, each sub-DLP is trivially solvable.
Cost Analysis: Smooth vs. Safe Primes
The Pohlig-Hellman attack cost is --- the sum of the prime power factors of . Compare:
Smooth : all factors small attack is cheap
Safe : with prime attack costs
For the smooth prime, the attack cost grows as (essentially free). For a safe prime, the attack cost is (no better than brute force).
The Fix: Use Safe Primes or Standardized Groups
Two defenses:
Safe primes: with prime. Then has only one large factor, making Pohlig-Hellman useless.
Standardized groups: Use the groups from RFC 3526 (IKE) or RFC 7919 (TLS). These are carefully chosen safe primes with vetted generators.
Real-world note: In 2015, researchers showed that many deployed systems used common DH primes. The Logjam attack demonstrated that if a nation-state precomputed the discrete log for a single 1024-bit prime, they could passively decrypt a significant fraction of Internet traffic. This drove the move to 2048-bit groups and safe primes.
Exercises
Bigger smooth prime: Try where . Run the full attack. How does the cost scale?
Baby-step giant-step on the largest subgroup: In the safe prime case, you can apply BSGS to the subgroup of order . What is the BSGS cost? (Hint: .)
Partially smooth: What if where is a large prime? How much does Pohlig-Hellman help? How much of the secret does Eve learn?
Summary
| Aspect | Detail |
|---|---|
| Attack type | Passive eavesdropping (no message modification) |
| Prerequisite | is smooth (factors into small primes) |
| What Eve learns | Both secret exponents and , and the shared secret |
| Cost | where |
| Fix | Safe primes () or standardized groups |
Key takeaways:
Pohlig-Hellman is a passive attack: Eve only eavesdrops.
The attack decomposes the DLP into independent sub-problems via CRT.
Attack cost depends on the largest prime factor of , not on itself.
Safe primes ensure has a large prime factor, rendering the attack useless.
Real-world standards mandate safe primes for exactly this reason.