Skip to main content
Challenges Wiener attack
Cryptography Expert RSA attacks Solves: 9

Wiener attack

Author: CyberSamSU
Points
150

Because the decryption on the server was working very slowly, the engineer made an "optimization": the private exponent d was deliberately chosen to be small (since the speed of pow(c, d, n) depends on the length of d). Now e is very large, and d is up to 200 bits.

In 1990, Michael Wiener proved that if d < ⅓·n1/4, RSA is completely broken. Reason: from the relationship e·d − k·φ(n) = 1, the fraction k/d becomes very close to e/n, so it will be one of the convergents of the continued fraction expansion (continued fraction) of e/n.

Attack steps:

  1. Expand e/n into a continued fraction (the quotient parts of the Euclidean algorithm).
  2. For each convergent k/d, calculate φ = (e·d − 1) / k (must be an integer).
  3. Solve the equation x² − (n − φ + 1)·x + n = 0; if the discriminant is a perfect square — d is found.
  4. Now m = pow(c, d, n).

The public key and ciphertext are in the server.txt file: n, e, c. The decrypted bytes directly give the flag.

Check the discriminant with math.isqrt; float is useless here too.

Attached files
server.txt Log in to download
SHA-256 checksums
server.txt: 6600f23e181ce71dc0d88722332de1bdeacb546fdf61d162c20564a32fd35654
Theory: learn the topic
Learning paths: Cryptography 301
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. Stiv_084100 10.09.2026
2. W.o.X 11.09.2026
3. Абдул 15.09.2026
4. Лазиз 01.10.2026
5. testrejim 09.10.2026
6. 11111tttt 09.10.2026
7. Mirjaxon Qaxxarov 26.10.2026
8. Odam 04.11.2026
9. Furqat Turayev 11.11.2026