Challenges › Cryptography

Inspect Weak Curve Parameters

medium · 100 XP · machine with a lab · free · solves: 0

A toy service holds a private scalar d with 0 <= d < 100. You send it a curve point P and it returns R = dP. The curve is y^2 = x^3 + x + 1 mod 101. Its whole group has order 105 = 3 * 5 * 7, a smooth order. The service uses this whole group. It checks only that P is on the curve. It does not check which subgroup P is in.

Three points on the curve have small orders:

Run python3 curve.py to verify these orders. It also has point addition, scalar multiplication and enumeration of multiples.

Start the lab. The service runs on host oracle, TCP port 9000.

Protocol. The service sends four banner lines when you connect. Points are JSON: [x, y] with integers from 0 to 100, and null for the point at infinity. Send one command per line:

client.py gives you Oracle.mul(point) and Oracle.check(d) for your scripts.

Your task.

  1. Send each small-order point P and get R = dP.
  2. Find j with jP = R. This gives d mod 3, d mod 5 and d mod 7.
  3. Combine the three residues with the CRT. 3 * 5 * 7 = 105 is larger than the bound 100, so the result is d.
  4. Validate d with another mul query: compare the reply with your own dP.
  5. Send check <d> to get the flag.

Why this fails. Real systems use a curve group of prime order or a prime-order subgroup with a small cofactor. They validate every received point: it is on the curve, it is not the point at infinity, and it is in the prime-order subgroup.

Tags: learn

Try next