72
Introduction Clavier et al.’s Paper This Paper Conclusion Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations Aurélie Bauer Éliane Jaulmes Emmanuel Prouff Justine Wild ANSSI Session ID: CRYP-T18 Session Classification: Advanced Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 1 / 17

Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Embed Size (px)

Citation preview

Page 1: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Horizontal and Vertical Side-Channel Attacksagainst Secure RSA Implementations

Aurélie Bauer Éliane Jaulmes Emmanuel ProuffJustine Wild

ANSSI

Session ID: CRYP-T18Session Classification: Advanced

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 1 / 17

Page 2: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

1 Introduction

2 Clavier et al.’s PaperAttack: Horizontal Correlation AnalysisCountermeasures against Horizontal Attacks

3 This PaperAttacks on Clavier et al. CountermeasuresNew Countermeasure against Horizontal AttacksSimulation Results of Our Attacks

4 Conclusion

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 2 / 17

Page 3: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

1 Introduction

2 Clavier et al.’s PaperAttack: Horizontal Correlation AnalysisCountermeasures against Horizontal Attacks

3 This PaperAttacks on Clavier et al. CountermeasuresNew Countermeasure against Horizontal AttacksSimulation Results of Our Attacks

4 Conclusion

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 3 / 17

Page 4: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Side-Channel Analysis On RSA

consumption time emanations

m= cd mod N

SPA DPA

CPA MIATiming Attack

Big Mac

HorizontalCorrelationAnalysis

Big Mac

HorizontalCorrelationAnalysis

Big Mac

HorizontalCorrelationAnalysis

exploited leak

Attacks

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 3 / 17

Page 5: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Side-Channel Analysis On RSA

consumption time emanations

m= cd mod N

SPA DPA

CPA MIATiming Attack

Big Mac

HorizontalCorrelationAnalysis

Big Mac

HorizontalCorrelationAnalysis

Big Mac

HorizontalCorrelationAnalysis

exploited leak

Attacks

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 3 / 17

Page 6: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Side-Channel Analysis On RSA

consumption time emanations

m= cd mod N

SPADPACPA

TAMIA

Big MacHCA

Vertical

Horizontal

exploited leak

Attacks

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 3 / 17

Page 7: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

A Unified Framework [This paper]

Vertical Analysis

1st execution

2nd execution

Nth execution

...

Ï several acquisitionsÏ traces treatment

Horizontal Analysis

1 stperiod

2 ndperiod

N thperiod

. . .

Ï a single acquisitionÏ sub-traces treatment

SPA, DPA, CPA, Big Mac, MIA, Template, Timing, HCA,. . .

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 4 / 17

Page 8: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Exponentiation: c =md mod N, secret d = (1,d`−2, . . . ,d0)2

Square & Multiply AtomicR0 = 1, R1 =m, i = l −1, k = 0while i ≤ 0 do

R0 =R0×Rkk = k ⊕dii = i −¬k

Return R0

Example: d = 1011Ï R0 = 1×1, d3 = 1, k = 1, i = 3

Ï R0 = 1×m, d3 = 1, k = 0, i = 2Ï R0 =m×m, d2 = 0, k = 0, i = 1

Ï R0 =m2×m2, d1 = 1, k = 1, i = 1

Ï R0 =m4×m, . . .

R R ×R

R×M

R ×R

. . .

. . .di = 0

di = 1di = 1

di+1 = 0

di+1 = 1

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 5 / 17

Page 9: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Exponentiation: c =md mod N, secret d = (1,d`−2, . . . ,d0)2

Square & Multiply AtomicR0 = 1, R1 =m, i = l −1, k = 0while i ≤ 0 do

R0 =R0×Rkk = k ⊕dii = i −¬k

Return R0

Example: d = 1011Ï R0 = 1×1, d3 = 1, k = 1, i = 3Ï R0 = 1×m, d3 = 1, k = 0, i = 2

Ï R0 =m×m, d2 = 0, k = 0, i = 1

Ï R0 =m2×m2, d1 = 1, k = 1, i = 1

Ï R0 =m4×m, . . .

R R ×R

R×M

R ×R

. . .

. . .di = 0

di = 1di = 1

di+1 = 0

di+1 = 1

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 5 / 17

Page 10: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Exponentiation: c =md mod N, secret d = (1,d`−2, . . . ,d0)2

Square & Multiply AtomicR0 = 1, R1 =m, i = l −1, k = 0while i ≤ 0 do

R0 =R0×Rkk = k ⊕dii = i −¬k

Return R0

Example: d = 1011Ï R0 = 1×1, d3 = 1, k = 1, i = 3Ï R0 = 1×m, d3 = 1, k = 0, i = 2Ï R0 =m×m, d2 = 0, k = 0, i = 1

Ï R0 =m2×m2, d1 = 1, k = 1, i = 1

Ï R0 =m4×m, . . .

R R ×R

R×M

R ×R

. . .

. . .di = 0

di = 1di = 1

di+1 = 0

di+1 = 1

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 5 / 17

Page 11: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Exponentiation: c =md mod N, secret d = (1,d`−2, . . . ,d0)2

Square & Multiply AtomicR0 = 1, R1 =m, i = l −1, k = 0while i ≤ 0 do

R0 =R0×Rkk = k ⊕dii = i −¬k

Return R0

Example: d = 1011Ï R0 = 1×1, d3 = 1, k = 1, i = 3Ï R0 = 1×m, d3 = 1, k = 0, i = 2Ï R0 =m×m, d2 = 0, k = 0, i = 1

Ï R0 =m2×m2, d1 = 1, k = 1, i = 1

Ï R0 =m4×m, . . .

R R ×R

R×M

R ×R

. . .

. . .di = 0

di = 1di = 1

di+1 = 0

di+1 = 1

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 5 / 17

Page 12: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Exponentiation: c =md mod N, secret d = (1,d`−2, . . . ,d0)2

Square & Multiply AtomicR0 = 1, R1 =m, i = l −1, k = 0while i ≤ 0 do

R0 =R0×Rkk = k ⊕dii = i −¬k

Return R0

Example: d = 1011Ï R0 = 1×1, d3 = 1, k = 1, i = 3Ï R0 = 1×m, d3 = 1, k = 0, i = 2Ï R0 =m×m, d2 = 0, k = 0, i = 1

Ï R0 =m2×m2, d1 = 1, k = 1, i = 1

Ï R0 =m4×m, . . .

R R ×R

R×M

R ×R

. . .

. . .di = 0

di = 1di = 1

di+1 = 0

di+1 = 1

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 5 / 17

Page 13: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

1 Introduction

2 Clavier et al.’s PaperAttack: Horizontal Correlation AnalysisCountermeasures against Horizontal Attacks

3 This PaperAttacks on Clavier et al. CountermeasuresNew Countermeasure against Horizontal AttacksSimulation Results of Our Attacks

4 Conclusion

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 6 / 17

Page 14: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Attack: Horizontal Correlation Analysis

Horizontal Side-Channel Analysis [Clavier et al., HorizontalCorrelation Analysis on Exponentiation, (ICICS 2010)]

Square & MultiplyAtomicOnly multiplications:

R ←R ×Ror R ←R ×M (bit 1)

1 Multiplication

Ï Do we multiply by the message or not ?

Ï Horizontal core idea: distinguish R ×R from R ×M with a singletrace

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 6 / 17

Page 15: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Attack: Horizontal Correlation Analysis

Zoom on the Long Integer Multiplication

R = (rt−1, . . . ,r1,r0)2ω X = (xt−1, . . . ,x1,x0)2ω

Mult(R ,X )

leak trace

modeling

leak value

time

. . .

. . .

. . .

. . .

......

.... . .

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 7 / 17

Page 16: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Attack: Horizontal Correlation Analysis

Zoom on the Long Integer Multiplication

R = (rt−1, . . . ,r1,r0)2ω X = (xt−1, . . . ,x1,x0)2ω

Mult(R ,X )

leak trace modeling

leak value

time

. . .

. . .

. . .

. . .

......

.... . .

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 7 / 17

Page 17: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Attack: Horizontal Correlation Analysis

Zoom on the Long Integer Multiplication

R = (rt−1, . . . ,r1,r0)2ω X = (xt−1, . . . ,x1,x0)2ω

Mult(R ,X )

leak trace modeling

leak value

time

. . .

. . .

. . .

. . .

......

.... . .

`(r0 ·x0) `(r0 ·x1) `(r0 ·xt−1)

`(r1 ·x0) `(r1 ·x1) `(r1 ·xt−1)

`(rt−1 ·x0)`(rt−1 ·x1) `(rt−1 ·xt−1)

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 7 / 17

Page 18: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Attack: Horizontal Correlation Analysis

Horizontal Correlation Analysis

Ï M knownÏ Hypothesis: X =M

{X =M ⇒ bit = 1X 6=M ⇒ bit = 0

Simulation. . .

. . .

. . .

......

.... . .

`(r0 ·x0) `(r0 ·x1) `(r0 ·xt−1)

`(r1 ·x0) `(r1 ·x1) `(r1 ·xt−1)

`(rt−1 ·x0) `(rt−1 ·x1) `(rt−1 ·xt−1)

Observation. . .

. . .

. . .

......

.... . .

HW (r0 ·m0) HW (r0 ·m1) HW (r0 ·mt−1)

HW (r1 ·m0) HW (r1 ·m1) HW (r1 ·mt−1)

HW (rt−1 ·m0) HW (rt−1 ·m1) HW (rt−1 ·mt−1)

`(ri ·xj) HW (ri ·mj),ρ( )

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 8 / 17

Page 19: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Countermeasures against Horizontal Attacks

Ï Actual Countermeasures AnalysisÏ Single curve ⇒ Exposant/Message randomisation ineffective

Ï Clavier et al.’s countermeasures

Blind the ri ·xj

Replace ri ·xj by (ri −a1)(xj −a2)

Blind the xj , permute the riReplace ri ·xj by rα[i ] · (xj −a2)

Permute the ri and the xj

Replace ri ·xj by rα[i ] ·xβ[j]

`(r0 · x0) . . . `(r0 · xt−1)`(r1 · x0) . . . `(r1 · xt−1)

.... . .

...`(rt−1 · x0) . . . `(rt−1 · xt−1)

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 9 / 17

Page 20: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Countermeasures against Horizontal Attacks

Ï Actual Countermeasures AnalysisÏ Single curve ⇒ Exposant/Message randomisation ineffective

Ï Clavier et al.’s countermeasures

Blind the ri ·xj

Replace ri ·xj by (ri −a1)(xj −a2)

Blind the xj , permute the riReplace ri ·xj by sα[i ] · (xj −a2)

Permute the ri and the xj

Replace ri ·xj by rα[i ] ·xβ[j]

`(rα[0] · x0) . . . `(rα[0] · xt−1)`(rα[1] · x0) . . . `(rα[1] · xt−1)

.... . .

...`(rα[t−1] · x0) . . . `(rα[t−1] · xt−1)

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 9 / 17

Page 21: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Countermeasures against Horizontal Attacks

Ï Actual Countermeasures AnalysisÏ Single curve ⇒ Exposant/Message randomisation ineffective

Ï Clavier et al.’s countermeasures

Blind the ri ·xj

Replace ri ·xj by (ri −a1)(xj −a2)

Blind the xj , permute the riReplace ri ·xj by sα[i ] · (xj −a2)

Permute the ri and the xj

Replace ri ·xj by rα[i ] ·xβ[j]

`(rα[0] ·xβ[0]) . . . `(rα[0] ·xβ[t−1])`(rα[1] ·xβ[0]) . . . `(rα[1] ·xβ[t−1])

.... . .

...`(rα[t−1] ·xβ[0]) . . . `(rα[t−1] ·xβ[t−1])

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 9 / 17

Page 22: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

1 Introduction

2 Clavier et al.’s PaperAttack: Horizontal Correlation AnalysisCountermeasures against Horizontal Attacks

3 This PaperAttacks on Clavier et al. CountermeasuresNew Countermeasure against Horizontal AttacksSimulation Results of Our Attacks

4 Conclusion

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 10 / 17

Page 23: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Attacks on Clavier et al. Countermeasures

Attacks on the Clavier et al.’s countermeasures

Blind the ri ·xj (Replace ri ·xj by (ri −a1)(xj −a2))

R = (ri −a1)i X = (xj −a2)j

Mult(R × X )

r0 · x0 r0 · x1 . . . r0 · xt−1r1 · x0 r1 · x1 . . . r1 · xt−1...

......

rt−1 · x0 rt−1 · x1 . . . rt−1 · xt−1

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 10 / 17

Page 24: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Attacks on Clavier et al. Countermeasures

Attacks on the Clavier et al.’s countermeasures

Blind the ri ·xj (Replace ri ·xj by (ri −a1)(xj −a2))

R = (ri −a1)i X = (xj −a2)j

Mult(R × X )

r0 · x0 r0 · x1 . . . r0 · xt−1r1 · x0 r1 · x1 . . . r1 · xt−1...

......

rt−1 · x0 rt−1 · x1 . . . rt−1 · xt−1R R R

Ï Correlation between the ri · xj and the ri ·mj

Ï When t increases, R = R

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 10 / 17

Page 25: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Attacks on Clavier et al. Countermeasures

Attacks on the Clavier et al.’s countermeasures

Blind the xj and permute the ri

rα[0] · x0 . . . rα[0] · xt−1rα[1] · x0 . . . rα[1] · xt−1

......

rα[t−1] · x0 . . . rα[t−1] · xt−1

Permute the ri and the xj

rα[0] ·xβ[0] . . . rα[0] ·xβ[t−1]rα[1] ·xβ[0] . . . rα[1] ·xβ[t−1]

......

rα[t−1] ·xβ[0] . . . rα[t−1] ·xβ[t−1]Ï Exhaustive research on βÏ t! possibilities

Ï Weakness: α and β are independent

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 11 / 17

Page 26: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

New Countermeasure against Horizontal Attacks

New Countermeasure

Permute simultaneously the ri and the xj

Use a t2-size permutation in order to randomize simultaneouslythe ri and the xj

Ï Leak modelisation:

`(r1 ·x2) `(r1 ·x0) `(r2 ·x0)`(r0 ·x2) `(r2 ·x2) `(r1 ·x1)`(r2 ·x1) `(r0 ·x1) `(r0 ·x0)

Ï Find the permutation: t2! possibilitiesÏ Third countermeasure of Clavier et al.: t! possibilities

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 12 / 17

Page 27: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Simulation Results of Our Attacks

Attack on Architecture 8 bits

INSECURE

SECURERSA 1024

size

ofRandXin

base

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 13 / 17

Page 28: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Simulation Results of Our Attacks

Architecture 8 bits

INSECURE

SECURE

Architecture 16 bits

INSECURE

SECURE

Architecture 32 bits

INSECURE

SECURE

RSA 1024 RSA 2048

RSA 4096Ï t: size of R and X in base 2ω

Ï Works also on 16 and 32 bitsÏ When ω↗, security level ↗

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 14 / 17

Page 29: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

1 Introduction

2 Clavier et al.’s PaperAttack: Horizontal Correlation AnalysisCountermeasures against Horizontal Attacks

3 This PaperAttacks on Clavier et al. CountermeasuresNew Countermeasure against Horizontal AttacksSimulation Results of Our Attacks

4 Conclusion

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 15 / 17

Page 30: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Side-Channel Analysis Methods

Vertical Horizontal

Cou

ntermeasures

Exposant Blinding

Message Blinding

Regular Algorithm

Clavier et al.

Several traces One trace

Clavier et al.

New countermeasure

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 15 / 17

Page 31: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Side-Channel Analysis Methods

Vertical Horizontal

Cou

ntermeasures

Exposant Blinding

Message Blinding

Regular Algorithm

Clavier et al.

Several traces One trace

Clavier et al.

New countermeasure

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 15 / 17

Page 32: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

And more in our paper . . .Ï Framework: model both Horizontal and Vertical AttacksÏ Attacks on Square and Multiply AlwaysÏ More Simulations:

Ï Attacks on variant Clavier et al. first countermeasureÏ Variant of our attack (no average)Ï Test the robustness of our countermeasure

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 16 / 17

Page 33: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Introduction Clavier et al.’s Paper This Paper Conclusion

Thank you for your attention. Questions ?

Aurélie Bauer, Éliane Jaulmes, Emmanuel Prouff, Justine Wild ANSSI

Horizontal and Vertical Side-Channel Attacks against Secure RSA Implementations 17 / 17

Page 34: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

.

.

. ..

.

.

Timing Attack against protected RSA-CRTimplementation used in PolarSSL

Cyril Arnaud and Pierre-Alain Fouque

Defense Ministry and Rennes 1 University

February 26, 2013

C. Arnaud and P.A. Fouque Timing Attack 1/ 32

Page 35: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

.. Overview

.. .1 Detecting a Timing Bias on RSA implementation of POLARSSL

IntroductionFinding a biasis the set of extra bit observable ?

.. .2 Our timing attack

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. .3 Countermeasure

State of the ArtAlternatives to blinding

.. .4 Conclusion

C. Arnaud and P.A. Fouque Timing Attack 2/ 32

Page 36: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Overview

.. .1 Detecting a Timing Bias on RSA implementation of POLARSSL

IntroductionFinding a biasis the set of extra bit observable ?

.. .2 Our timing attack

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. .3 Countermeasure

State of the ArtAlternatives to blinding

.. .4 Conclusion

C. Arnaud and P.A. Fouque Timing Attack 3/ 32

Page 37: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. State of the Art.Related Work..

.

1996 : Timing Attacks on Implementations of Diffie-Hellman,RSA,DSS, and Other Systems [Kocher] at CRYPTO ’96

2000 : Timing attack on RSA-CRT [Schindler] at CHES ’00

2003 : Remote timing attacks are practical [Brumley et Boneh] atUsenix ’03

2005 : Improving Brumley and Boneh timing attack onunprotected SSL implementation [O. Aciiçmez, et al.] at CCS ’05

.Attacks..

.

Countermeasures of OPENSSL avoided

Exploit timing bias induced by RSA optimizations

Old monocore processors

C. Arnaud and P.A. Fouque Timing Attack 4/ 32

Page 38: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. State of the Art.Related Work..

.

1996 : Timing Attacks on Implementations of Diffie-Hellman,RSA,DSS, and Other Systems [Kocher] at CRYPTO ’96

2000 : Timing attack on RSA-CRT [Schindler] at CHES ’00

2003 : Remote timing attacks are practical [Brumley et Boneh] atUsenix ’03

2005 : Improving Brumley and Boneh timing attack onunprotected SSL implementation [O. Aciiçmez, et al.] at CCS ’05

.Attacks..

.

Countermeasures of OPENSSL avoided

Exploit timing bias induced by RSA optimizations

Old monocore processors

C. Arnaud and P.A. Fouque Timing Attack 4/ 32

Page 39: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Why using a Timing Attack ?

.Side-Channel Cryptanalysis..

.

Electromagnetic emanation and power consumption hard toapply on a computerComputation Time :

cannot be detectedallows to factor RSA modulus by measuring the time to decryptpossible on networkTiming measurement : 2 instructions

C. Arnaud and P.A. Fouque Timing Attack 5/ 32

Page 40: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Measurement of computation time

.Time Stamp Counter (TSC)..

.

64-bit counter that records cycle of the FSB bus

Common to each CPU core

Use of RDTSC instruction : do not use any privilege

.Performance Counter (PMC)..

.

Counter used in the CPU microarchitecture

Allow to measure each tick of a core

Reading using the RDMSR instruction : require privilege

Require a specific kernel module

C. Arnaud and P.A. Fouque Timing Attack 6/ 32

Page 41: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Target choice

.RSA of POLARSSL 1.1.4..

.

Opensource library developed in C

Operational version (Adobe flash player, ...)

Use countermeasures suggested by Boneh and Brumley andSchindler (One subroutine for multiplication and a dummysubstraction)

RSA decryption in constant time

Protected against timing attacks

C. Arnaud and P.A. Fouque Timing Attack 7/ 32

Page 42: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Goals and Results

.Goals..

.

Evaluate the countermeasure

Mount an attack

Determining efficient countermeasures

Work on recent processors (Intel Core 2 Duo and Core i7).

.Results..

.

Detection of an unknown bias

Attack verified on a chosen ciphertext attack for RSA 512, 1024and 2048 bits

Propose two countermeasures avoiding this attack

C. Arnaud and P.A. Fouque Timing Attack 8/ 32

Page 43: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Goals and Results

.Goals..

.

Evaluate the countermeasure

Mount an attack

Determining efficient countermeasures

Work on recent processors (Intel Core 2 Duo and Core i7).

.Results..

.

Detection of an unknown bias

Attack verified on a chosen ciphertext attack for RSA 512, 1024and 2048 bits

Propose two countermeasures avoiding this attack

C. Arnaud and P.A. Fouque Timing Attack 8/ 32

Page 44: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. RSA Implementation of POLARSSL

.RSA Decryption..

.

To decrypt c ∈ (Z/nZ) : modular exponentiation using the privateexponent :

m = cd mod n

.RSA decryption optimizations of POLARSSL..

.

Chinese Remainder Theorem using Garner recombination

Montgomery Multiplication using one countermeasure

Modular Exponentiation using the sliding window method

C. Arnaud and P.A. Fouque Timing Attack 9/ 32

Page 45: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Multiprecision Montgomery Modular Multiplication

.Number representations..

.

A = ∑i=s−1i=0 ai r i ,

size of words is denoted by w

s represents the number of required words of size w

r = 2w

R = r s

.⊗w..

.

w-bit multiplication to multiply a wordwith a large integer

C. Arnaud and P.A. Fouque Timing Attack 10/ 32

Page 46: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Schindler’s observation

.Extra reduction - Time variance in MULTIMONTMUL..

.

Montgomery representation A = AR mod P

Suppose B is uniformly distributed in ZP

P (extra-reduction in MULTIMONTMUL(X ,B,P)) = X mod P2R

P (extra-reduction in MULTIMONTMUL(B,B,P)) = P3R

C. Arnaud and P.A. Fouque Timing Attack 11/ 32

Page 47: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. PolarSSL’s Multiprecision Montgomery multiplication

.

.Running times to execute the branch condition is identical for all inputs

.

.

Dummy subtraction used in MULTIMONTMUL(A,B,P) makes the timeto perform the multiplication independent on the A and B

C. Arnaud and P.A. Fouque Timing Attack 12/ 32

Page 48: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Extra bit

.

.

The condition of MULTIMONTMUL isABR−1 ≤ Z < P +ABR−1

We suppose that R2 <P< R (key lengths multiple of world size)

Then Z < 2R.

Hence, if Z > R then zs = 1, this bit is called extra bit

.Extra bit in source code..

.

in the sth loop of MULTIMONTMUL, if Z > R then the extra bit is setby a carry propagation up to the top most significant word of Z .

is extra bit imply a timing variance ?

C. Arnaud and P.A. Fouque Timing Attack 13/ 32

Page 49: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. An attacker can observe a timing difference

.Methodology..

.

We generate :

Random numbers A, B with known size, converted inMontgomery representation

a prime number Q where R2 < Q < R.

We sort :

the time in CPU’s clock ticks to perform MULTIMONTMUL(A,B,Q)according to the size numbers

if an extra bit, an extra-reduction without extra bit or neither ofthem is carried out

C. Arnaud and P.A. Fouque Timing Attack 14/ 32

Page 50: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Results

504 505

506 507

508 509

510 511

512 504 505 506 507 508 509 510 511 512

1900 1910 1920 1930 1940 1950 1960 1970 1980 1990

Tim

e in

CP

U´ 

cycle

s

Z<QR<Z

Q<Z<R

A sizeB size

Tim

e in

CP

U´ 

cycle

s

FIGURE: |Q| = 512

1016 1017

1018 1019

1020 1021

1022 1023

1024 1016 1017 1018 1019 1020 1021 1022 1023 1024

4740

4760

4780

4800

4820

4840

4860

4880

4900

Tim

e in

CP

U´ 

cycle

s

Z<QR<Z

Q<Z<R

A sizeB size

Tim

e in

CP

U´ 

cycle

s

FIGURE: |Q| = 1024

.

.

A timing difference is observable when Z > R

Extra-reduction (Q ≤ Z < R) : masked by dummy subtraction

Bias is proportional to the bitsize of Q

C. Arnaud and P.A. Fouque Timing Attack 15/ 32

Page 51: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

IntroductionFinding a biasis the set of extra bit observable ?

.. Results of timing attacks against POLARSSL

.Kocher Attack (1996)...does not apply to RSA-CRT

.Schindler’s Attack (2000)...works only with the square-&-multiply algorithm

.Schindler’s Attack (2005)...does not work due to the window in the sliding windows exponentiation

.Brumley-Boneh Attacks (2003)...can work

C. Arnaud and P.A. Fouque Timing Attack 16/ 32

Page 52: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Overview

.. .1 Detecting a Timing Bias on RSA implementation of POLARSSL

IntroductionFinding a biasis the set of extra bit observable ?

.. .2 Our timing attack

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. .3 Countermeasure

State of the ArtAlternatives to blinding

.. .4 Conclusion

C. Arnaud and P.A. Fouque Timing Attack 17/ 32

Page 53: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Probability of an extra bit

.MULTIMONTMUL(A,B,P), 0 ≤ A,B < P..

.The probability of an extra bit is not null iff P >√

5−12 ×R

.Probability of an extra bit..

.

B is uniformly distributed and C is a fixed value :

PMULTIMONTMUL(B,B,P) = P3R +

2(R−P)√

(R−P)R3P2 − (R−P)

R

PC = PMULTIMONTMUL(C,B,P) = C2R + (R−P)2R

2CP2 − (R−P)R

.

.For P >

√5−12 ×R and X ,Y ∈

((R−P)R

P ,P)

, if X > Y then PX > PY

C. Arnaud and P.A. Fouque Timing Attack 18/ 32

Page 54: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.Attack Characteristics..

.

Allows to recover the |p|2 most significant bits of p or q

Search each bit gradually using an approximation of p or q

Use Coppersmith algorithm to complete the attack

.Recovering a 1024 key size with RDMSR instruction in inter-process..

.

Around ten minutes.

215200 queries.

C. Arnaud and P.A. Fouque Timing Attack 19/ 32

Page 55: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.Attack Characteristics..

.

Allows to recover the |p|2 most significant bits of p or q

Search each bit gradually using an approximation of p or q

Use Coppersmith algorithm to complete the attack

.Recovering a 1024 key size with RDMSR instruction in inter-process..

.

Around ten minutes.

215200 queries.

C. Arnaud and P.A. Fouque Timing Attack 19/ 32

Page 56: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Searching the pk bit

.

.

Assume the adversary knows the k most significant bits of p. He cangenerate the integers c1 and c2 :

c′1 = (p0,p1, ..,pk−1,0,0, ...,0)2

c′2 = (p0,p1, ..,pk−1,1,0, ...,0)2

pk = 0

. .c

.Decryption time

.p.q .c′1 .c′2

pk = 1

. .c

.Decryption time

.p.q .c′2.c′1

C. Arnaud and P.A. Fouque Timing Attack 20/ 32

Page 57: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Searching the pk bit

.

.

Assume the adversary knows the k most significant bits of p. He cangenerate the integers c1 and c2 :

c′1 = (p0,p1, ..,pk−1,0,0, ...,0)2

c′2 = (p0,p1, ..,pk−1,1,0, ...,0)2

pk = 0

. .c

.Decryption time

.p.q .c′1 .c′2

pk = 1

. .c

.Decryption time

.p.q .c′2.c′1

C. Arnaud and P.A. Fouque Timing Attack 20/ 32

Page 58: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Searching the pk bit

.

.

Assume the adversary knows the k most significant bits of p. He cangenerate the integers c1 and c2 :

c′1 = (p0,p1, ..,pk−1,0,0, ...,0)2

c′2 = (p0,p1, ..,pk−1,1,0, ...,0)2

pk = 0

. .c

.Decryption time

.p.q .c′1 .c′2

pk = 1

. .c

.Decryption time

.p.q .c′2.c′1

C. Arnaud and P.A. Fouque Timing Attack 20/ 32

Page 59: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Searching the pk bit

.

.

Assume the adversary knows the k most significant bits of p. He cangenerate the integers c1 and c2 :

c′1 = (p0,p1, ..,pk−1,0,0, ...,0)2

c′2 = (p0,p1, ..,pk−1,1,0, ...,0)2

pk = 0

. .c

.Decryption time

.p.q .c′1 .c′2

pk = 1

. .c

.Decryption time

.p.q .c′2.c′1

C. Arnaud and P.A. Fouque Timing Attack 20/ 32

Page 60: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Searching the pk bit.

.

Assume the adversary knows the k most significant bits of p. He cangenerate the integers c1 and c2 :

c′1 = (p0,p1, ..,pk−1,0,0, ...,0)2

c′2 = (p0,p1, ..,pk−1,1,0, ...,0)2

. .c

.Decryption time

.p.q .c′1 .c′2

. .c

.Decryption time

.p.q .c′2.c′1

.

.Two timing samples for values close to c1 + ε1 and c2 + ε2 : ζc1 and ζc2

C. Arnaud and P.A. Fouque Timing Attack 21/ 32

Page 61: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

How can we quantifythe difference between the two samples ζc1 and ζc2 ?

C. Arnaud and P.A. Fouque Timing Attack 22/ 32

Page 62: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

How can we check that the measureof the two samples ζc1 and ζc2 is correct ?

C. Arnaud and P.A. Fouque Timing Attack 22/ 32

Page 63: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Statistical Tests.T-test..

.

Allow to compare the means of two samples generated by 2populations with equal variance

If tobserved > tthreshold, pk = 0 otherwise pk = 1.

.Fisher-Snedecor Test..

.

Allows to compare the variances of two samples generated from 2populations

If Fobserved > Fthreshold : replay otherwise the value of tobserved allows todetermine pk

.In practice...Search the intervalle I or Fobserved is maximal then compute t-test on I

C. Arnaud and P.A. Fouque Timing Attack 23/ 32

Page 64: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Same process

Modulus size #query/bit ratio of replay # query

512 bits 600 2% 786001024 bits 800 18% 2416002048 bits 1000 50% 768000

TABLE: RDTSC instruction

Modulus size #query/bit ratio of replay # query

512 bits 600 2% 786001024 bits 800 10% 2256002048 bits 1000 15% 589000

TABLE: RDMSR instruction

C. Arnaud and P.A. Fouque Timing Attack 24/ 32

Page 65: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Inter-process via TCP IP

Modulus size #query/bit ratio of replay # query

512 bits 1000 2% 1310001024 bits 1100 21% 3410002048 bits 1200 55% 952800

TABLE: RDTSC instruction

Modulus size #query/bit ratio of replay # query

512 bits 1000 0% 1280001024 bits 1100 5% 2959002048 bits 1200 10% 675600

TABLE: RDMSR instruction

C. Arnaud and P.A. Fouque Timing Attack 25/ 32

Page 66: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Amplifying the bias by repetiting

.

.The bias in our case is very small and is consequently hard to detect

.Sliding Exponentiation..

.

PolarSSL uses a CLNW (Constant Length Non-Zero Window) methodwhereas OpenSSL uses a VLNW method (Variable)

.Precomputation phase..

.

As in the CCS ’05 paper, we use the precomputation phase

many multiplications are used with the same value c1 or c2 tocompute the precomputation table

31 multiplications with the same value if the window length is 5

C. Arnaud and P.A. Fouque Timing Attack 26/ 32

Page 67: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. Distribution of modulus

We generated randomly keys with PolarSSL’s key generation routine(p > q)

]0.5R;√

5−12 R] ]

√5−12 R,0.7R] ]0.7R;0.8R] ]0.8R;R]

Distribution of p size 0% 0.011% 13.33% 86.66%Distribution of q size 18.78% 24.46% 31.32% 25.44%

TABLE: Distribution of modulus.

Our attack is always feasible in practice

C. Arnaud and P.A. Fouque Timing Attack 27/ 32

Page 68: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

State of the ArtAlternatives to blinding

.. Overview

.. .1 Detecting a Timing Bias on RSA implementation of POLARSSL

IntroductionFinding a biasis the set of extra bit observable ?

.. .2 Our timing attack

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. .3 Countermeasure

State of the ArtAlternatives to blinding

.. .4 Conclusion

C. Arnaud and P.A. Fouque Timing Attack 28/ 32

Page 69: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

State of the ArtAlternatives to blinding

.. OPENSSL Countermeasure

.Blinding..

.

Use a random before each decryption

Efficient for all parameter size

Slow down performance by a factor between 10 to 25%

C. Arnaud and P.A. Fouque Timing Attack 29/ 32

Page 70: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

State of the ArtAlternatives to blinding

.. Cancelling out extra bit

.Use particular modulus size...if |Q| = kw , extra-bit is cancelling out

.Modify PolarSSL’s key generation routine..

.Generate keys where prime factors are less than√

5−12 ×R

C. Arnaud and P.A. Fouque Timing Attack 30/ 32

Page 71: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

.. Overview

.. .1 Detecting a Timing Bias on RSA implementation of POLARSSL

IntroductionFinding a biasis the set of extra bit observable ?

.. .2 Our timing attack

Cryptographic AnalysisStatistical ToolsResults against PolarSSL 1.1.4

.. .3 Countermeasure

State of the ArtAlternatives to blinding

.. .4 Conclusion

C. Arnaud and P.A. Fouque Timing Attack 31/ 32

Page 72: Horizontal and Vertical Side-Channel Attacks against ... · PDF fileHorizontal and Vertical Side-Channel Attacks against Secure RSA Implementations ... JustineWild ANSSI

Detecting a Timing Bias on RSA implementation of POLARSSLOur timing attackCountermeasure

Conclusion

.. Conclusion

.Conclusions..

.

Constant time cryptographic implementations are hard to achieve

Known attacks exploit the bias of the extra-reduction due to an extra bit

.Our contributions..

.

Practical Timing Attack against a protected implementation

Use statistical tests to reduce the number of chosen ciphertexts

Introduce a new bias

Propose 2 countermeasures for specific key sizes

C. Arnaud and P.A. Fouque Timing Attack 32/ 32