$ cat writeup.md…
$ cat writeup.md…
fortid2026
Task: a flag is Koblitz-encoded to EC points, then each point is run through the Dragon-Crypto dragon_render turtle routine with a secret key; output is the turtles' end coordinates. Solution: exploit a shared-turtle bug where heading persists across calls so each point's x shift is size*ux_i with ux_i small and fully determined by the iteration count; simulate the deterministic turn sequence, pin size from valid-Koblitz-x constraints on the large points, and decode using x only.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Hic Sunt Dracones
English summary: The handout contains chall.py, patch.py, output.txt and a Dockerfile. The Dockerfile clones awnonbhowmik/Dragon-Crypto (commit 046ad8d) and applies patch.py. chall.py encodes the flag onto an elliptic curve with Koblitz encoding, pushes each point through the library's "dragon curve" turtle renderer using a random private key, and prints the end coordinates of every rendered point. The goal is to recover the flag (format FortID{...}) from output.txt.
p with p % 4 == 3 and random curve parameters a, b are chosen.koblitz_encoder(flag, a, b, p) maps every plaintext character m (its ord) to an EC point (x_m, y_m) where x_m = m*k + j with k = 20 and j the first value in 1..19 that yields a point on the curve y² = x³ + a·x + b (mod p).private_key = (size, iterations, angle, a, b) with:
size = randrange(1<<127, 1<<128) — a huge ~128-bit integer,iterations = randrange(10, 15) — i.e. one of {10,11,12,13,14},angle = randrange(2) * 180 — i.e. 0 or 180.dragon.dragon_render(point, private_key), which drives a turtle to draw a dragon curve and returns the turtle's end coordinates (x_end, y_end).point_to_character(encrypted) → "X" + x-values joined by "X" followed by "Y" + y-values joined by "Y".patch.py edits koblitz.py to:
p (instead of the library's hardcoded p = 751), andpow(n, (p+1)//4, p), which is a valid square root when p % 4 == 3....
$ grep --similar