Skip to main content
Challenges ECDSA: nonce used twice
Cryptography Hard ECDSA Solves: 7

ECDSA: nonce used twice

Author: CyberSamSU
Points
95

ECDSA — digital signature on an elliptic curve. d — private key, Q = d·G — public key. For each signature, a one-time random number k (nonce) is chosen:

R = k*G
r = R.x mod n
s = k^(-1) * (h + r*d) mod n      # h = xabar heshi

The entire security relies on k being new and random every time. If a single k is used for two different messages, r will be the same in both signatures — this is immediately noticeable. And after that, recovering the private key becomes a simple system of linear equations:

s1 = k^(-1) * (h1 + r*d)
s2 = k^(-1) * (h2 + r*d)
  =>  s1 - s2 = k^(-1) * (h1 - h2)
  =>  k = (h1 - h2) * (s1 - s2)^(-1)  mod n
  =>  d = (s1*k - h1) * r^(-1)        mod n

This exact mistake caused the disclosure of Sony PlayStation 3 keys and the draining of several Bitcoin wallets in 2010.

The attached imzolar.txt file contains two signatures of a single wallet. Recover the private key d, then convert it to big-endian bytes and read it — the flag is there.

Curve — secp256k1:

p = 115792089237316195423570985008687907853269984665640564039457584007908834671663
a = 0
b = 7
n = 115792089237316195423570985008687907852837564279074904382605163141518161494337
G = (55066263022277343669578718895168534326250603453777594175500187360389116729240, 32670510020758816978083085130507043184471273380659243275938904335757337482424)

Converting to bytes: d.to_bytes((d.bit_length()+7)//8, 'big')

Attached files
imzolar.txt Log in to download
SHA-256 checksums
imzolar.txt: 0eb710005d8c8bf82cb1c7849a8eed3babfe7c496408afcd2f6f1f3fa1ff8849
Theory: learn the topic
Hints 3
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −9 pts Log in
Hint 2 −19 pts Log in
Hint 3 −28 pts Log in
To submit a flag, log in.

First solvers

1. W.o.X 17.09.2026
2. Лазиз 04.10.2026
3. testrejim 09.10.2026
4. 11111tttt 09.10.2026
5. Mirjaxon Qaxxarov 26.10.2026
6. Odam 04.11.2026
7. arcanum 11.11.2026