Recover an ECDSA Key
medium · 100 XP · flag · free · solves: 0
A firmware team signed two release notes with the same ECDSA key. Both signatures have the same r. That is a clue to a reused nonce k, not proof. Test the idea and keep only a key that matches the public key.
Files
signatures.json: the curvey^2 = x^3 + a*x + b (mod p)withp,a,b, base pointG, andn. It also holds the public keyQ = dGand two signatures(r, s1)and(r, s2)with their digest integersz1andz2. Usez1andz2as given. All numbers are decimal strings.ec_helpers.py:load,inv(modular inverse),add, andmul(scalar multiplication). Standard library only.verify.py: runpython3 verify.py <d>. It printscorrectonly whendG = Q.
Notes
nis the prime order ofG. It is not the curve order: the curve has8npoints. Do all signature arithmetic modulon, not modulop.- The signer publishes low-s signatures. When a computed
sis greater thann/2, it publishesn - sinstead. Both forms verify, so one publishedscan have the opposite sign from the one used withk.
Your task
- Subtract the two signing equations to get a candidate
k, then a candidated. - Test both sign choices: use
s2andn - s2. - Accept only a
dwithdG = Q. Confirm it withverify.py.
The private key is short text. Convert d to big-endian bytes and decode them as ASCII. Submit CSEMA{<that text>}.
Tags: learn
Try next
- A Centuries-Old Message (easy)
- The Board Nobody Read (easy)
- Trail of Ciphers (easy)