Slides Ladderleak
Slides Ladderleak
net/publication/343601182
LadderLeak: Breaking ECDSA With Less Than One Bit Of Nonce Leakage
CITATIONS READS
10 862
5 authors, including:
Diego F. Aranha
Aarhus University
165 PUBLICATIONS 1,607 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Diego F. Aranha on 12 August 2020.
Diego F. Aranha1 Felipe R. Novaes2 Akira Takahashi1 Mehdi Tibouchi3 Yuval Yarom4
August 12, 2020
1 Dept. of CS and DIGIT, Aarhus University, Denmark
1
Background: Attack on ECDSA
Nonces
ECDSA and Schnorr Signatures
2
Randomness in ECDSA/Schnorr-like Schemes
Alice Bob
Sign
Verify 0/1
101101 ・・・
Signed Message
Alice Bob
Sign
Verify 0/1
101101 ・・・
Signed Message
Bias
4
Risk of Biased/Leaky Randomness
Alice Bob
Leak
Sign
Verify 0/1
101101 ・・・
Signed Message
4
Risk of Biased/Leaky Randomness
Alice
Leak
Sign
101101 ・・・
Signed Message
4
Risk of Biased/Leaky Randomness
Alice
Leak
Sign
101101 ・・・
Signed Message
4
Randomness Failure in the Real World
5
Contributions
3. Implemented a full secret key recovery attack against OpenSSL ECDSA over
sect163r1 and NIST P-192.
6
Curve-based cryptography
Elliptic curves
An elliptic curve is the set of solutions (x, y) ∈ F × F that satisfy the Weierstrass
equation:
E : y2 + a1 xy + a3 y = x3 + a2 x2 + a4 x + a6
7
Elliptic curves
An elliptic curve is the set of solutions (x, y) ∈ F × F that satisfy the Weierstrass
equation:
E : y2 + a1 xy + a3 y = x3 + a2 x2 + a4 x + a6
Group law: The set of points under the operation ⊕ (chord and tangent) forms an
additive group of order q with ∞ as the identity.
8
ECDSA signing
Input: Signing key sk ∈ Zq , message msg ∈ {0, 1}∗ , group order q, base point G, and
cryptographic hash function H : 0, 1∗ → Zq .
Output: A valid signature (r, s)
1: k ←$ Z∗q
2: R = (rx , ry ) ← [k]G
3: r ← rx mod q
4: s ← (H(msg) + r · sk)/k mod q
5: return (r, s)
Modern CPUs have instructions (cflush) that can reveal secrets through cache data
eviction. When programs share a library, a Flush+Reload attack is possible:
10
Side-channel attacks in scalar multiplication
11
Side-channel attacks in scalar multiplication
For constant-time:
Algorithm 3 Left-to-right Montgomery ladder
Input: P = (x, y), k = (1, kt−2 , . . . , k1 , k0 ) • Fixed iterations by
Output: Q = [k]P adding 1 or 2 multiples
of q (preserves MSB of k
1: k′ ← Select (k + q, k + 2q)
in second MSB of k′ when
2: R0 ← P, R1 ← [2]P
q is just below power of 2.
3: for i ← lg(q) − 1 downto 0 do
4: Swap (R0 , R1 ) if k′i = 0 • Replace branch with
5: R0 ← R0 ⊕ R1 ; R1 ← [2]R1 conditional swap (ideally
6: Swap (R0 , R1 ) if k′i = 0 implemented in ASM).
7: end for • Careful implementation
8: return Q = R0 of group law!
12
Side-channel attacks in scalar multiplication
Target platforms:
Tooling:
14
Cache-timing attacks on prime curves
400
300
200
100
0
0 10 20 30 40 50 60 70 80 90 100 16
Sample number
Cache-timing attacks on binary curves
Coordinated disclosure: reported in December 2019, fixed in April 2020 with the first
countermeasure.
19
Main takeaways
20
LadderLeak: Breaking ECDSA With Less Than One Bit Of Nonce
Leakage
To appear in CCS’20
ePrint: 2020/615
Diego F. Aranha1 Felipe R. Novaes2 Akira Takahashi1 Mehdi Tibouchi3 Yuval Yarom4
August 12, 2020
1 Dept. of CS and DIGIT, Aarhus University, Denmark
1
How to Exploit Randomness
Bias/Leakage
Overview
2
The problem we tackle: 1-bit of nonce leakage
zi = ki − hi · sk mod q.
The HNP asks to find sk, given the pairs (hi , zi ) and MSB(ki ) for all i.
3
The problem we tackle: less than 1-bit of nonce leakage
zi = ki − hi · sk mod q.
The HNP with error rate ϵ ∈ [0, 1/2] asks to find sk, given the pairs (hi , zi ) and given
MSB(ki ) (resp. MSB(ki ) ⊕ 1) with probability 1 − ϵ (resp. ϵ). for all i.
The error rate ϵ models the attacker’s misdetection during the side-channel
acquisition.
3
How to attack the HNP
More bias/leakage
&
Fewer signatures Lattice
4
We set new records!
<1 1 2 3 4
6
The Fourier analysis-based attack?
6
The Fourier analysis-based attack?
6
The Fourier analysis-based attack?
6
The Fourier analysis-based attack?
6
Bleichenbacher’s Attack: High-level Overview
7
Bleichenbacher’s Attack: High-level Overview
7
Bleichenbacher’s Attack: High-level Overview
7
Step 1. Bias Function (Essentially DFT)
Definition
The sampled bias of a set of points K = {ki }i∈[1,M] in Z/qZ is defined by
1 ∑ 2πiki /q
Biasq (K) = e .
M
i∈[1,M]
8
Handy Form of the Bias Function
b 0 1 2 3 4
|Biasq (K)| 0 0.6366 0.9003 0.9745 0.9936
Lemma (informal)
If the randomness k’s top b bits are fixed, e.g.,
k1 = 011101 . . .
k2 = 010110 . . .
..
.
9
Step 2. Detecting the Bias Peak (Naïve Approach)
√1
M w
sk
10
Step 2. Detecting the Bias Peak (Naïve Approach)
√1
M w
sk
10
Step 2. Detecting the Bias Peak (Naïve Approach)
√1
M w
sk
10
Step 2. Detecting the Bias Peak (Naïve Approach)
√1
M w
sk
10
Problem: Naïve Approach is Inefficient!
• The peak only appears if you hit the exact solution, i.e., w = sk.
• Clearly infeasible for large q !
• For input table size q, FFT takes O(q) space & O(q log q) time
|Biasq (Kw )|
1
√1
M w
sk
11
Solution: Collision Search to Broaden the Peak
|Biasq (Kw )|
1
q
L
|Biasq (K)|K
√1
M′ w
sk
12
Collision Search Problem in Bleichenbacher’s Framework
Given: M signature pairs {(hi , zi )}i∈[1,M] and memory budget for FFT LFFT ≪ q
Find: sufficiently many (say M′ ) linear combinations
Initially
14
K-list Sum Algorithm for GBP (e.g., K = 4)
Initially
14
K-list Sum Algorithm for GBP (e.g., K = 4)
Initially
Find
14
Applying Howgrave-Graham and Joux’s K-list Sum Algorithm
• More flexible than Wagner’s original K-list algorithm for the GBP.
• Advantages:
, Configurable time-memory tradeoffs
, Highly parallelizable
• Question:
For given MSB info from HNP and the attacker’s budget for computational
resources, what would be the optimal balance between the time, memory, and
input data complexities?
15
Unified Time-Memory-Data Tradeoffs
where
We can estimate the optimal time-memory-data complexity balance together with the
constraints from Bleichenbacher!
16
Tradeoff Graphs for 1-bit Bias
*Paper has various tradeoff graphs and improved complexity estimates for 2-3 bits bias.
17
Experimental Results on Full Key Recovery
Target Facility Error rate Input Output Thread Time RAM LFFT Recovered
(Collision) (Collision) (Collision) MSBs
18
Conclusion
19
Conclusion
19
Conclusion
19
Conclusion
19
References i
Daniel Bleichenbacher.
Experiments with DSA.
Rump session at CRYPTO 2005, 2005.
Available from https://www.iacr.org/conferences/crypto2005/r/3.pdf.
Dan Boneh and Ramarathnam Venkatesan.
Hardness of computing the most significant bits of secret keys in
Diffie-Hellman and related schemes.
In Neal Koblitz, editor, CRYPTO’96, volume 1109 of LNCS, pages 129–142.
Springer, Heidelberg, August 1996.
References iii
Alejandro Cabrera Aldaya, Billy Bob Brumley, Sohaib ul Hassan, Cesar Pereida
García, and Nicola Tuveri.
Port contention for fun and profit.
In 2019 IEEE Symposium on Security and Privacy, pages 870–887. IEEE
Computer Society Press, May 2019.
Fergus Dall, Gabrielle De Micheli, Thomas Eisenbarth, Daniel Genkin, Nadia
Heninger, Ahmad Moghimi, and Yuval Yarom.
CacheQuote: Efficiently recovering long-term secrets of SGX EPID via
cache attacks.
IACR TCHES, 2018(2):171–191, 2018.
https://tches.iacr.org/index.php/TCHES/article/view/879.
References iv
Keegan Ryan.
Return of the hidden number problem.
IACR TCHES, 2019(1):146–168, 2018.
https://tches.iacr.org/index.php/TCHES/article/view/7337.
Keegan Ryan.
Hardware-backed heist: Extracting ECDSA keys from qualcomm’s
TrustZone.
In Lorenzo Cavallaro, Johannes Kinder, XiaoFeng Wang, and Jonathan Katz,
editors, ACM CCS 2019, pages 181–194. ACM Press, November 2019.
References vii
Given M = 4 × 2a samples
{hi }i∈[1,M] . For each
c ∈ [0, 2a ):
1. Search partial collisions
in top a bits, between 2
sorted lists with target
value c.
2. Search more collisions in
remaining bits, between
new sorted lists A(1) and
A(2) .