remote timing attacks are practical
play

Remote Timing Attacks are Practical by David Brumley and Dan Boneh - PowerPoint PPT Presentation

Remote Timing Attacks are Practical by David Brumley and Dan Boneh Presented by Seny Kamara in Advanced Topics in Network Security (600/650.624) Outline Traditional threat model in cryptography Side-channel attacks Kochers


  1. Remote Timing Attacks are Practical by David Brumley and Dan Boneh Presented by Seny Kamara in Advanced Topics in Network Security (600/650.624)

  2. Outline • Traditional threat model in cryptography • Side-channel attacks • Kocher’s timing attack • Boneh & Brumley timing attack • Experiments • Countermeasures S. Kamara (600/650.624) 02/10/05

  3. Traditional Crypto • Brute force attacks • large key • Mathematical attacks • reduction to hard problem • RSAP: ( m e mod n ) → m • DHP: ( g x , g y ) → g xy S. Kamara (600/650.624) 02/10/05

  4. Traditional Crypto • Attacker has access to: • Ciphertext • Algorithm S. Kamara (600/650.624) 02/10/05

  5. Real-Life Crypto • Attacker has access to: • Ciphertext • Algorithm • Physical observables from the device S. Kamara (600/650.624) 02/10/05

  6. Side Channel Attacks • Paul Kocher in 1996 • Recovers RSA and DSS signing key • Not taken seriously by cryptographers • Lot of attention from the press S. Kamara (600/650.624) 02/10/05

  7. Side Channel Attacks • Timing analysis • Fault analysis • Differential fault analysis • Simple power analysis • Differential power analysis • EM analysis S. Kamara (600/650.624) 02/10/05

  8. Side Channel Attacks m k Power time consumption c EM radiation S. Kamara (600/650.624) 02/10/05

  9. Side Channel Attacks m Encryption e m e mod n Side channel S. Kamara (600/650.624) 02/10/05

  10. Side Channel Attacks m Decryption/ d Signing m d mod n Side channel S. Kamara (600/650.624) 02/10/05

  11. Kocher Timing Attack • RSA signatures: sig ( m ) = m d mod n • Modular exponentiation is computed using square and multiply algorithm • Time of modular exponentiation is a function of the bits of the exponent • Use time to recover exponent (signing key) S. Kamara (600/650.624) 02/10/05

  12. Kocher Timing Attack • Recovers key bit by bit • Guesses key bit then verifies • Uses statistical analysis • Needs many samples of signing time S. Kamara (600/650.624) 02/10/05

  13. Kocher Attack Target sig ( m ) = m d mod n S. Kamara (600/650.624) 02/10/05

  14. Square and Multiply 1: INPUT: m, n, d 2: OUTPUT: x = m d mod n 3: x := m 4: for i = n − 1 downto 0 do x := x 2 5: if d i = 1 then 6: x := x · m mod n 7: end if 8: 9: end for 10: return x S. Kamara (600/650.624) 02/10/05

  15. Kocher Timing Attack Eve Bob m 1 T ( m 1 ) s 1 d m 2 ... T ( m 2 ) s 2 ... ... S. Kamara (600/650.624) 02/10/05

  16. Kocher Timing Attack Eve Eve m 1 T 0 ( m 1 ) s 1 0? m 2 ... T 0 ( m 2 ) s 2 ... ... S. Kamara (600/650.624) 02/10/05

  17. Kocher Timing Attack Eve Eve m 1 T 1 ( m 1 ) s 1 1? m 2 ... T 1 ( m 2 ) s 2 ... ... S. Kamara (600/650.624) 02/10/05

  18. Kocher Timing Attack • Compare • vs T 0 ( m i ) T ( m i ) • vs T 1 ( m i ) T ( m i ) • will be correlated with correct guess T ( m i ) S. Kamara (600/650.624) 02/10/05

  19. Kocher Timing Attack • 1998 UCL experimental results: Key size sample size 64 1 500-6 500 128 12 000-20 000 256 70 000-80 000 512 350 000 S. Kamara (600/650.624) 02/10/05

  20. Limit of Kocher Attack • Does not work when mod exp is optimized S. Kamara (600/650.624) 02/10/05

  21. RSA with Sun Ze Th. sig ( m ) = m d mod n • • Sun Ze Th. aka CRT • m, d and n are order of 1024 bits • exponentiation of 1024 bit number by another 1024 bit number taken modulo a third 1024 bit number S. Kamara (600/650.624) 02/10/05

  22. RSA with Sun Ze Th. • exponentiate mod q (512 bits) • exponentiate mod p (512 bits) • combine using SZT to get mod n (= pq) S. Kamara (600/650.624) 02/10/05

  23. RSA with Sun Ze Th. sig ( m ) = m d mod n • where n = pq • m 1 = m mod p • m 2 = m mod q • d 1 = d mod ( p − 1 ) d 2 = d mod ( q − 1 ) S. Kamara (600/650.624) 02/10/05

  24. RSA with Sun Ze Th. • s 1 = m d 1 1 mod p • s 2 = m d 2 2 mod q • CRT ( s 1 , s 2 ) = m d mod n S. Kamara (600/650.624) 02/10/05

  25. RSA with Sun Ze Th. • Modular exponentiation: • pre-processing • exponentiation mod p • exponentiation mod q • CRT S. Kamara (600/650.624) 02/10/05

  26. RSA with Sun Ze Th. • Kocher’s attack does not work • Cannot get precise timings • Cannot repeat pre-processing without factors • Most implementations use CRT • OpenSSL S. Kamara (600/650.624) 02/10/05

  27. OpenSSL • SSL establishes encrypted and authenticated channel between client and server • 1994 • SSL v1 completed but never released • SSL v2 released with Navigator 1.1 • SSL v2 PRNG broken S. Kamara (600/650.624) 02/10/05

  28. OpenSSL • 1995 • SSL v3 released (designed by Kocher) • SSL is ubiquitous • 1996 • IETF standardizes SSL S. Kamara (600/650.624) 02/10/05

  29. OpenSSL • 1998 • OpenSSL 0.9.1c is released (based on SSLeay) • mod_ssl for Apache is released S. Kamara (600/650.624) 02/10/05

  30. OpenSSL • Most popular open source SSL implementation • Most popular crypto library • 18% of all Apache servers use mod_ssl • stunnel • sNFS S. Kamara (600/650.624) 02/10/05

  31. RSA in OpenSSL • sig ( m ) = m d mod n • Sun Ze Theorem • Modular exponentiation: sliding window • Modular reduction: Montgomery • Multi-precision multiplication: Karatsuba S. Kamara (600/650.624) 02/10/05

  32. Sliding Window • Extension of square and multiply • uses multiple bits of the exponent at once • makes attack more difficult S. Kamara (600/650.624) 02/10/05

  33. Montgomery Reduction • Introduced in 1985 by Peter Montgomery • Performs modular multiplication efficiently • Transforms multiplication mod n to multiplication mod R S. Kamara (600/650.624) 02/10/05

  34. Montgomery Reduction Algorithm 1 Montgomery Reduction 1: INPUT: x , y and q 2: OUTPUT: x · y mod q 3: RR − 1 − qq ∗ = 1 4: Ψ ( x ) := xR mod q 5: Ψ ( y ) := yR mod q 6: z := Ψ ( x ) × Ψ ( y ) = abR 2 mod q 7: r := z × q ∗ mod R 8: s := z + rq R 9: if s > q then extra reduction s := s − q 10: 11: end if 12: return s S. Kamara (600/650.624) 02/10/05

  35. Montgomery Reduction Pr [ extra reduction ] = m mod q • 2R • m = q ⇒ Pr [ reduction ] = 0 • m → q ⇒ Pr [ reduction ] � m → q + ⇒ Pr [ reduction ] � S. Kamara (600/650.624) 02/10/05

  36. Karatsuba • Multi-precision multiplication • where and | x | = n | y | = n x · y • Runs in O ( n log 2 3 ) • As opposed to O ( n · m ) • worst case O ( n 2 ) S. Kamara (600/650.624) 02/10/05

  37. Karatsuba • Used only if inputs have same length • OpenSSL: • if |x| = |y| then Karatsuba O ( n log 2 3 ) • if |x| != |y| then normal O ( n 2 ) S. Kamara (600/650.624) 02/10/05

  38. Biases • What is the effect of these optimizations on the exponentiation time? S. Kamara (600/650.624) 02/10/05

  39. Montgomery Reduction • if m approaches q from below then slow • if m approaches q from above then fast S. Kamara (600/650.624) 02/10/05

  40. Montgomery Reduction Decryption time g q 2q 3q Figure 1 S. Kamara (600/650.624) 02/10/05

  41. Multiplication • if |x| = |y| then fast • if |x| != |y| then slow S. Kamara (600/650.624) 02/10/05

  42. Multiplication Decryption time Karatsuba Normal g g < q g > q S. Kamara (600/650.624) 02/10/05

  43. Boneh-Brumley Attack hello e Eve Server g or g hi error S. Kamara (600/650.624) 02/10/05

  44. Boneh-Brumley Attack • Kocher attack recovers signing key • Boneh-Brumley attack recovers factor S. Kamara (600/650.624) 02/10/05

  45. Kocher Attack Target sig ( m ) = m d mod n S. Kamara (600/650.624) 02/10/05

  46. Boneh-Brumley Target sig ( m ) = m d mod p · q S. Kamara (600/650.624) 02/10/05

  47. Boneh-Brumley Target • n = pq • Knowing q we recover p d = e − 1 mod ( p − 1 )( q − 1 ) S. Kamara (600/650.624) 02/10/05

  48. Boneh-Brumley Attack CRT m modq m d mod q Square and multiply m d mod R Montgomery Multiplication I · m S. Kamara (600/650.624) 02/10/05

  49. Boneh-Brumley Attack sig ( m ) = m d mod pq • • Recover bit of q i th • when we already have the top bits i − 1 S. Kamara (600/650.624) 02/10/05

  50. Timing Attack • q: smallest factor • g: same top bits as q (rest is all 0) i − 1 • : g with bit set to i th 1 g hi • : decryption(g) - decryption( ) ∆ g hi S. Kamara (600/650.624) 02/10/05

  51. Timing Attack • i = 4 • q = 101 ? • g = 101 0... • g = 101 10... hi S. Kamara (600/650.624) 02/10/05

  52. Timing Attack • i = 4 • q = 101 1 ? if then q 4 = 1 g < g hi < q • g = 101 0... • g = 101 10... hi S. Kamara (600/650.624) 02/10/05

  53. Timing Attack • i = 4 • q = 101 0 ? • g = 101 0... if then q 4 = 0 g < q < g hi • g = 101 10... hi S. Kamara (600/650.624) 02/10/05

  54. Boneh-Brumley Attack q i = 0 → g < q < g hi Montgomery Multiplication slow fast T(g) (xtra reds) (kara) slow T( ) fast g hi (normal) | ∆ | large large S. Kamara (600/650.624) 02/10/05

  55. Boneh-Brumley Attack g < q < g hi Montgomery Multiplication slow fast T(g) (xtra reds) (kara) slow T( ) fast g hi (normal) | ∆ | large large S. Kamara (600/650.624) 02/10/05

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend