Minerva:
The curse of ECDSA nonces
Jan Jancar, Vladimir Sedlacek, Petr Svenda, Marek Sys
Minerva: The curse of ECDSA nonces Jan Jancar , Vladimir Sedlacek, - - PowerPoint PPT Presentation
Minerva: The curse of ECDSA nonces Jan Jancar , Vladimir Sedlacek, Petr Svenda, Marek Sys Minerva: The curse of ECDSA nonces Jan Jancar , Vladimir Sedlacek, Petr Svenda, Marek Sys Systematic analysis of lattice attacks on noisy leakage of
The curse of ECDSA nonces
Jan Jancar, Vladimir Sedlacek, Petr Svenda, Marek Sys
The curse of ECDSA nonces
Jan Jancar, Vladimir Sedlacek, Petr Svenda, Marek Sys
○
JavaCards
○
Software libraries (15 supported)
contain bugs
Jan Jancar Minerva: The curse of ECDSA nonces 2 / 17
ECDSA
P Q −(P + Q) (P + Q) x y
y2 ≡ x3 + ax + b
G ∈ E(Fp), |G| = n (prime) Sign(message m, private key x)
1 k $
← Zn (nonce)
2 r ≡ ([k]G)x mod n 3 s ≡ k−1(H(m) + rx) mod n 4 Output (r, s) as ASN.1 DER SEQUENCE
Jan Jancar Minerva: The curse of ECDSA nonces 3 / 17
ECDSA tests
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Let’s test timing as well!
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Let’s test timing as well!
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Let’s test timing as well!
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Let’s test timing as well!
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Let’s test timing as well!
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Let’s test timing as well!
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Let’s test timing as well!
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Let’s test timing as well!
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Timing
Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Timing
1 5
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Timing
1 5 TPM-FAIL 2
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
ECDSA tests
~
Timing
1 5 TPM-FAIL 2 Déjà Vu 1 ...
Jan Jancar Minerva: The curse of ECDSA nonces 4 / 17
Tested
Type Name Version/Model Scalar multiplier Leakage Library OpenSSL 1.1.1d Montgomery ladder no BouncyCasle 1.58 Comb method no SunEC JDK 7 - JDK 12 Window-NAF no Lopez-Dahab ladder yes* WolfSSL 4.0.0 Sliding window yes BoringSSL 974f4dddf Window method no libtomcrypt v1.18.2 Sliding window no libgcrypt 1.8.4 Double-and-add yes* Botan 2.11.0 Window method no Microsoft CNG 10.0.17134.0 Window method no mbedTLS 2.16.0 Comb method no MatrixSSL 4.2.1 Sliding window yes Intel PP Crypto 2020 Window-NAF no Crypto++ 8.2 unknown yes Card Athena IDProtect 010b.0352.0005 unknown yes* NXP JCOP3 J2A081, J2D081, J3H145 unknown no Infineon JTOP 52GLA080AL, SLE78 unknown no G+D SmartCafe v6, v7 unknown no Jan Jancar Minerva: The curse of ECDSA nonces 5 / 17
Leak
Jan Jancar Minerva: The curse of ECDSA nonces 6 / 17
Leak
Jan Jancar Minerva: The curse of ECDSA nonces 6 / 17
Leak
248 249 250 251 252 253 254 255 256
nonce bit-length
148500 149000 149500 150000 150500 151000 151500 152000
signature time ( s)
20 40 60 80 Jan Jancar Minerva: The curse of ECDSA nonces 6 / 17
Leak
L = base + iter_time · B + N B ∼ Geom(p = 1/2, (256, 255, . . . , 0)) N ∼ Norm(0, sdev2)
3570000 3600000 3630000 3660000 3690000 3720000 3750000 3780000 3810000 time (ns) 200 400 600 800 1000 1200 1400 count all 256b 255b 254b 253b 252b 251b 250b 249b
base iter_time sdev // secp256r1 curve
Jan Jancar Minerva: The curse of ECDSA nonces 6 / 17
Hidden Number Problem
Jan Jancar Minerva: The curse of ECDSA nonces 7 / 17
Hidden Number Problem
[1]
Jan Jancar Minerva: The curse of ECDSA nonces 7 / 17
Hidden Number Problem
Hidden Number Problem (HNP) [1]
Given an oracle computing: Ob,t() = MSBl(at + b mod n) with t u.i.d. in Z∗
n, find a.
Jan Jancar Minerva: The curse of ECDSA nonces 7 / 17
Hidden Number Problem
Hidden Number Problem (HNP) [1]
Given an oracle computing: Or,s() = MSBl(k mod n)
Jan Jancar Minerva: The curse of ECDSA nonces 7 / 17
Hidden Number Problem
Hidden Number Problem (HNP) [1]
Given an oracle computing: Or,s() = MSBl(xs−1r + H(m)s−1 mod n) find x.
Jan Jancar Minerva: The curse of ECDSA nonces 7 / 17
Basic attack [2]
Jan Jancar Minerva: The curse of ECDSA nonces 8 / 17
Basic attack [2]
i
ri + H(mi)s−1
i
| < n/2li
Jan Jancar Minerva: The curse of ECDSA nonces 8 / 17
Basic attack [2]
i
ri + H(mi)s−1
i
| < n/2li
B =
2l1n . . . 2l2n . . . . . . . . . . . . 2ldn 2l1t1 2l2t2 2l3t3 . . . 2ldtd 1
Jan Jancar Minerva: The curse of ECDSA nonces 8 / 17
Basic attack [2]
i
ri + H(mi)s−1
i
| < n/2li
B =
2l1n . . . 2l2n . . . . . . . . . . . . 2ldn 2l1t1 2l2t2 2l3t3 . . . 2ldtd 1
Jan Jancar Minerva: The curse of ECDSA nonces 8 / 17
Basic attack [2]
i
ri + H(mi)s−1
i
| < n/2li
B =
2l1n . . . 2l2n . . . . . . . . . . . . 2ldn 2l1t1 2l2t2 2l3t3 . . . 2ldtd 1
Jan Jancar Minerva: The curse of ECDSA nonces 8 / 17
Basic attack [2]
i
ri + H(mi)s−1
i
| < n/2li
B =
2l1n . . . 2l2n . . . . . . . . . . . . 2ldn 2l1t1 2l2t2 2l3t3 . . . 2ldtd 1
Jan Jancar Minerva: The curse of ECDSA nonces 8 / 17
○
for each N from 500 to 10 000 (steps 100) and
○
d from 50 to 140 (steps 2)
after BKZ reduction with β ∈ {15, 20, . . . , 55}
Dataset base (µs) iter_time (µs) sdev (µs) sim ○ 1 sw ○ 453.4 12.7 17.2 tpm ○ 27047.3 236.1 211.3 card ○ 43578.4 371.5 451.3
Jan Jancar Minerva: The curse of ECDSA nonces 9 / 17
Bounds li
○
Constant (li = c for c ∈ {1, 2, 3, 4}) based on d
Jan Jancar Minerva: The curse of ECDSA nonces 10 / 17
Bounds li
10 20 30 40 50 60 70 80 90 100 index 2 2 4 6 8 10 bound sim (sample) sim - geom geom
○
Constant (li = c for c ∈ {1, 2, 3, 4}) based on d
○
Geometric based on N ( new)
Jan Jancar Minerva: The curse of ECDSA nonces 10 / 17
Bounds li
500 2000 4000 6000 8000 10000 60 80 100 120 140 Dimension of matrix (D)
card
500 2000 4000 6000 8000 10000 60 80 100 120 140
sim
500 2000 4000 6000 8000 10000 Number of signatures (N) 60 80 100 120 140 Dimension of matrix (D)
sw
500 2000 4000 6000 8000 10000 Number of signatures (N) 60 80 100 120 140
tpm
1 2 3 4 5
constant c = 3 ○ ○ ○ ○
500 2000 4000 6000 8000 10000 60 80 100 120 140 Dimension of matrix (D)
card
500 2000 4000 6000 8000 10000 60 80 100 120 140
sim
500 2000 4000 6000 8000 10000 Number of signatures (N) 60 80 100 120 140 Dimension of matrix (D)
sw
500 2000 4000 6000 8000 10000 Number of signatures (N) 60 80 100 120 140
tpm
1 2 3 4 5
geometric ○ ○ ○ ○
○
Constant (li = c for c ∈ {1, 2, 3, 4}) based on d
○
Geometric based on N ( new)
Jan Jancar Minerva: The curse of ECDSA nonces 10 / 17
Bounds li
1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Number of signatures (N) 0.0 0.2 0.4 0.6 0.8 1.0 Success probability card const3 card geom sim const3 sim geom sw const3 sw geom tpm const3 tpm geom
○
Constant (li = c for c ∈ {1, 2, 3, 4}) based on d
○
Geometric based on N ( new)
Jan Jancar Minerva: The curse of ECDSA nonces 10 / 17
CVP vs SVP
1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Number of signatures (N) 0.0 0.2 0.4 0.6 0.8 1.0 Success probability card np card svp sim np sim svp sw np sw svp tpm np tpm svp
C =
u n
Minerva: The curse of ECDSA nonces 11 / 17
Recentering
1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Number of signatures (N) 0.0 0.2 0.4 0.6 0.8 1.0 Success probability card no recentering card recentering sim no recentering sim recentering sw no recentering sw recentering tpm no recentering tpm recentering
|ki − n/2li+1| < n/2li+1
Jan Jancar Minerva: The curse of ECDSA nonces 12 / 17
Random subsets
1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Number of signatures (N) 0.0 0.2 0.4 0.6 0.8 1.0 Success probability card 1 card 1.5 sim 1 sim 1.5 sw 1 sw 1.5 tpm 1 tpm 1.5
Jan Jancar Minerva: The curse of ECDSA nonces 13 / 17
Nonce differences
1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Number of signatures (N) 0.0 0.2 0.4 0.6 0.8 1.0 Successes card no differences card differences sim no differences sim differences sw no differences sw differences tpm no differences tpm differences
|ki − kj| < n/2min(li,lj)
Jan Jancar Minerva: The curse of ECDSA nonces 14 / 17
u-bitflips
Jan Jancar Minerva: The curse of ECDSA nonces 15 / 17
u-bitflips
500 2000 4000 6000 8000 10000 60 80 100 120 140 Dimension of matrix (D)
card
500 2000 4000 6000 8000 10000 60 80 100 120 140
sim
500 2000 4000 6000 8000 10000 Number of signatures (N) 60 80 100 120 140 Dimension of matrix (D)
sw
500 2000 4000 6000 8000 10000 Number of signatures (N) 60 80 100 120 140
tpm
0.0 0.5 1.0 1.5 2.0 2.5 3.0
○ ○ ○ ○ errors fixed for success
Jan Jancar Minerva: The curse of ECDSA nonces 15 / 17
u-bitflips
1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Number of signatures (N) 0.0 0.2 0.4 0.6 0.8 1.0 Success probability card 0 card 3 sim 0 sim 3 sw 0 sw 3 tpm 0 tpm 3
Jan Jancar Minerva: The curse of ECDSA nonces 15 / 17
lowers min(N) for attack success
solving via Nearest Plane algorithm
success rate
promising, but pays the cost of using Nearest Plane algorithm
the TPM-FAIL paper [3], with only 900 signatures, instead of 40 000
jan@neuromancer.sk The paper: minerva.crocs.fi.muni.cz Icons from & Font Awesome Photos from
1
2
3
Timing and Lattice Attacks 4
Jesús-Javier Chi-Domínguez, Alejandro Cabrera Aldaya, Billy Bob Brumley; Déjà Vu: Side-Channel Analysis of Mozilla’s NSS 5
ECDSA Signatures in Cryptocurrencies 6