Skip to main content
Challenges Small subgroup attack
Cryptography Expert DH attacks Solves: 7

Small subgroup attack

Author: CyberSamSU
Points
150

The server operates with a static secret number b and calculates s = A^b mod p for each client. However, it does not check at all the A received from the client — it does not ask whether it belongs to the valid subgroup. This opens the way for a small subgroup attack.

Attack idea. For each small prime divisor q of p-1, it is easy to find an element whose order is exactly q: h = x^((p-1)/q) mod p. If we send such a h to the server as a "public key", it will return h^b mod p — and this value will be just one of q variants.

So for each q we find b mod q by a simple brute force search. Once several qs have been collected, the Chinese Remainder Theorem fully recovers b.

p = 40167493143745308581148297108932034641207127923
p - 1 = 2 * 64433 * 101599 * 115303 * 171539 * 172633 * 898503240609530729603
g = 2
B = 7085201723015972897117026080381749830131540601

Here q₁..q₅ are the five small prime factors in the expansion above; the last large factor is useless for an attack (the subgroup in it is too large). The server's random number generator is weak: the secret number lies in the range b < q₁·q₂·q₃·q₄·q₅, which means the five small moduli together completely determine it. The attack log is in the file jurnal.txt: each line contains the sent h and the s = h^b mod p returned by the server.

Find the server's static secret number b.

Flag: BAYROQ{DH_kichik_guruh_<b>}. Check: must be pow(g, b, p) == B.

Attached files
jurnal.txt Log in to download
SHA-256 checksums
jurnal.txt: 88b1f9f511ecfeb66cf0749b5eb45c1a0e5ad753166871d03d072abb78729660
Hints 3
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −15 pts Log in
Hint 2 −30 pts Log in
Hint 3 −45 pts Log in
To submit a flag, log in.

First solvers

1. W.o.X 09.09.2026
2. Абдул 15.09.2026
3. Лазиз 01.10.2026
4. testrejim 09.10.2026
5. 11111tttt 09.10.2026
6. Mirjaxon Qaxxarov 26.10.2026
7. Odam 04.11.2026