DL·SYS
Contact ↗

CSCTF 2026 · Crypto · 182 pts

Rollback Pair.

Eight ECDSA signatures over secp256k1. Two of them share the same nonce, and that's the whole private key.

ECDSANonce reuse
EventCSCTF 2026, Operation Dawn (online jeopardy)
CategoryCrypto
Points182
StatusSolved during the event
TargetEight signed records, offline

TL;DR. ECDSA security depends on every signature using a fresh random nonce k. Two of the eight given signatures (R-6103 and R-6107) share the same r value, which means they share k. That one coincidence gives two linear equations in the two unknowns k and the private key d, solvable directly.

Challenge

The task gives eight signed records and asks whether the signing key leaked, and if so, to recover it. signature_format states secp256k1 with SHA-256 message hashing — standard ECDSA.

First look

ECDSA signatures are pairs (r, s). r is derived from the nonce k as the x-coordinate of k·G mod the curve order n. If two signatures from the same key reuse k, their r values are identical. Comparing all eight r values across the eight records, R-6103 and R-6107 match exactly — the rest are all distinct.

Solution

With a shared nonce, the two signature equations are:

s1 = k^-1 (z1 + r*d) mod n
s2 = k^-1 (z2 + r*d) mod n

Subtracting eliminates d and solves for k:

k = (z1 - z2) * inverse(s1 - s2, n) mod n

Then d falls out of either original equation:

d = (s1*k - z1) * inverse(r, n) mod n

I wrote the curve arithmetic in pure Python (modular inverse via pow(x, -1, n), point multiplication by double-and-add) rather than trusting a library blindly, since the whole point is to self-verify. The self-check: recompute d·G and confirm it equals the record's published public key. It matched, so d is certainly correct.

Flag

FlagCSCTF{3b5789e468dadf358d375bb08dcd19b977c5715364a709326b43a35b0d5eaab1}

What I took from it