side channel cryptanalysis
play

Side-Channel Cryptanalysis Joseph Bonneau Security Group - PowerPoint PPT Presentation

Side-Channel Cryptanalysis Joseph Bonneau Security Group jcb82@cl.cam.ac.uk Rule 0: Attackers will always cheat xkcd #538 What is side channel cryptanalysis? Side Channels: whatever the designers ignored Key Plaintext Encryption Cipher


  1. Attack exponent one bit at a time T = observed timing of entire algorithm M = model for time of one multiplication ∝ Bit n-i: Is T( power(r,e,N) ) 2 e ⋅ M( mult(r [ n - 1 : n - i ] ,r,N) ) + ≈ 2,500 encryptions e [ n - 1 : n - i ] | | 1 M( square(r ,N) )?

  2. More complicated attacks work across a LAN Boneh and Brumley, 2003

  3. More complicated attacks work across a LAN ≈ 1,000,000 encryptions Boneh and Brumley, 2003

  4. Blinded RSA provides generic defense Private Key: p, q (random primes) d ≡ e -1 (mod φ(N)) (exponent) N = p ⋅ q Public Key: (modulus) e (exponent) s = m d Signing: (mod N) Blind Signing: r 1 = r 0 (mod N) e -1 (r 1 ⋅ m) d s = r 0 (mod N)

  5. Attacks against AES (Rijndael)

  6. AES is cryptography's standard block cipher

  7. AES is very complicated Jeff Moser

  8. AES is very complicated Wikipedia

  9. AES is very complicated Wikipedia

  10. AES is very complicated Wikipedia

  11. AES is very complicated Wikipedia

  12. AES is designed for very efficient implementation t0 = Te0[(s0 >> 24) ] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[(s3 ) & 0xff] ^ rk[0]; t1 = Te0[(s1 >> 24) ] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[(s0 ) & 0xff] ^ rk[1]; t2 = Te0[(s2 >> 24) ] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[(s1 ) & 0xff] ^ rk[2]; t3 = Te0[(s3 >> 24) ] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[(s2 ) & 0xff] ^ rk[3];

  13. AES utilises large pre-computed lookup tables static const u32 Te0[256] = { 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, ... 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, };

  14. Lookups into shared cache are vulnerable Plaintext Key XOR Lookup Mix Key XOR Mix Lookup Key XOR Ciphertext

  15. Lookups into shared cache are vulnerable Plaintext First round: Key XOR T[P i ⊕ K i ] Lookup Mix Key XOR Mix Lookup Key XOR Ciphertext

  16. Lookups into shared cache are vulnerable Plaintext First round: Key XOR T[P i ⊕ K i ] Lookup Mix Key XOR Mix Final round: - 1 [C i ⊕ K i ]] T[T Lookup Key XOR Ciphertext

  17. Simple power analysis of AES (Bertoni et. Al, 2005; Bonneau 2006)

  18. Cache hit/miss is very obvious in power trace Bertoni et. al, 2005

  19. Every miss yields many constraints Plaintext Key XOR Lookup Miss? P 0 ⊕ K 0 ≠P 1 ⊕ K 1 Hit? P 0 ⊕ K 0 ≟P 1 ⊕ K 1

  20. Every miss yields many constraints Plaintext Key XOR Lookup Miss? P 0 ⊕ K 0 ≠P 1 ⊕ K 1 P 0 ⊕ P 1 ≠K 0 ⊕ K 1 Hit? P 0 ⊕ K 0 ≟P 1 ⊕ K 1 P 0 ⊕ P 1 ≟K 0 ⊕ K 1

  21. Every miss yields many constraints Plaintext Key XOR Lookup Miss? P 0 ⊕ P 2 ≠K 0 ⊕ K2 ∧ P 1 ⊕ P 2 ≠K 1 ⊕ K 2

  22. Table of possible key byte differences refined K0 K1 K2 ... K15 {23,70,c K0 00 {27,e0} {35} {65} 4} {32,45,8 K1 00 {5f,f3} {0a,db} 9} {17,64,9 K2 00 {86} c} ... 00 {42,d5} K15 00

  23. Table of possible key byte differences refined K0 K1 K2 ... K15 {23,70,c K0 00 {27,e0} {35} {65} 4} ≈ 100 encryptions {32,45,8 K1 00 {5f,f3} {0a,db} 9} {17,64,9 K2 00 {86} c} ... 00 {42,d5} K15 00

  24. Cache observation attack (Osvik et. al, 2006)

  25. 1) Attacker “primes” the cache with known data AES Attacker RAM void * p = malloc(CACHE_SIZE); while(i < CACHE_SIZE) p[i++]++; Cache

  26. 1) Attacker “primes” the cache with known data AES Attacker RAM void * p = malloc(CACHE_SIZE); while(i < CACHE_SIZE) p[i++]++; Cache

  27. 2) Attacker triggers AES encryption AES Attacker RAM void * p = malloc(CACHE_SIZE); while(i < CACHE_SIZE) p[i++]++; Cache aes_encrypt(random_p());

  28. 3) AES loads some cache lines AES Attacker RAM void * p = malloc(CACHE_SIZE); while(i < CACHE_SIZE) p[i++]++; Cache aes_encrypt(random_p());

  29. 4) Attacker can test which lines were touched AES Attacker RAM void * p = malloc(CACHE_SIZE); while(i < CACHE_SIZE) p[i++]++; Cache aes_encrypt(random_p()); while(i < CACHE_SIZE) t[i++] = timed_read(p, i);

  30. 5) All untouched lines yield constraints Plaintext Key XOR Lookup P 0 ⊕ K 0 ∉ {Untouched lines}

  31. 5) All untouched lines yield constraints Plaintext Key XOR Lookup K 0 ∉ {Untouched lines ⊕ P 0 }

  32. 5) All untouched lines yield constraints Plaintext Key XOR Lookup ≈ 300 encryptions K 0 ∉ {Untouched lines ⊕ P 0 }

  33. Cache timing attack (Bonneau and Mironov, 2006)

  34. Observation: self-collisions lower encryption time Plaintext Key XOR Lookup P i ⊕ K i ≟ P j ⊕ K j

  35. Observation: self-collisions lower encryption time Plaintext Key XOR Lookup P i ⊕ K i ≟ P j ⊕ K j P i ⊕ P j ≟ K i ⊕ K j

  36. Internal collisions cause most timing variation 30 20 10 Timing deviation (cycles) 0 -10 -20 -30 -40 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 # of cache collisions

  37. Key byte differences ranked by average time K0 K1 K2 ... K15 K0 K1 K2 ... K15

  38. Key byte differences ranked by average time K0 K1 K2 ... K15 K0 K1 K2 ... K15 0) f2 1024.32 1) 37 1036.71 2) 7a 1036.84 3) 26 1036.91 … 255) a2 1038.42

  39. Key byte differences ranked by average time K0 K1 K2 ... K15 K0 K1 K2 ... K15 0) f2 1024.32 0) 5d 1025.61 1) 37 1036.71 1) 10 1036.64 2) 7a 1036.84 2) 46 1036.79 3) 26 1036.91 3) dc 1036.98 … … 255) a2 1038.42 255) 03 1038.16

  40. Key byte differences ranked by average time K0 K1 K2 ... K15 K0 K1 K2 ≈ 100,000 encryptions ... K15 0) f2 1024.32 0) 5d 1025.61 1) 37 1036.71 1) 10 1036.64 2) 7a 1036.84 2) 46 1036.79 3) 26 1036.91 3) dc 1036.98 … … 255) a2 1038.42 255) 03 1038.16

  41. Final round is much better to attack C i ⊕ K i =S[X] C j ⊕ K j =S[Y] X=Y ⇒ C i ⊕ K i = C j ⊕ K j C i ⊕ C j = K i ⊕ K j Lookup Key XOR Ciphertext

  42. Final round is much better to attack C i ⊕ K i =S[X] C j ⊕ K j =S[Y] ≈ 32,000 encryptions X=Y ⇒ C i ⊕ K i = C j ⊕ K j C i ⊕ C j = K i ⊕ K j Lookup Key XOR Ciphertext

  43. Hardware countermeasures on the way /* AES-128 encryption sequence. The data block is in xmm15. Registers xmm0–xmm10 hold the round keys(from 0 to 10 in this order). In the end, xmm15 holds the encryption result. */ pxor xmm15, xmm0 // Input whitening aesenc xmm15, xmm1 // Round 1 aesenc xmm15, xmm2 // Round 2 aesenc xmm15, xmm3 // Round 3 aesenc xmm15, xmm4 // Round 4 aesenc xmm15, xmm5 // Round 5 aesenc xmm15, xmm6 // Round 6 aesenc xmm15, xmm7 // Round 7 aesenc xmm15, xmm8 // Round 8 aesenc xmm15, xmm9 // Round 9 aesenclast xmm15, xmm10 // Round 10 Courtesy of Intel

  44. Differential power analysis (Kocher et. al, 1999)

  45. Simple power analysis ineffective Trace courtesy of Cryptography Research, Inc.

  46. Hardware implementations don't use cache Plaintext Key XOR Lookup Mix

  47. Hardware implementations don't use cache Plaintext Key XOR Lookup Mix S[P 0 ⊕ K 0 ]

  48. Partition traces by some predicted intermediate bit Guessing K 0 = 00, traces where high bit of S[P 0 ⊕ K 0 ] is set

  49. Partition traces by some predicted intermediate bit Guessing K 0 = 01, traces where high bit of S[P 0 ⊕ K 0 ] is set

  50. Partition traces by some predicted intermediate bit Guessing K 0 = 02, traces where high bit of S[P 0 ⊕ K 0 ] is set

  51. Partition traces by some predicted intermediate bit ≈ 10,000 encryptions Guessing K 0 = 02, traces where high bit of S[P 0 ⊕ K 0 ] is set

  52. Perfect countermeasures are very difficult

  53. Even further down the rabbit hole...

  54. CPU Noise ƒ PC (Recording Station ) ADC Bandpass Amplifiers (Sound Card) Filter Collects sounds which emanates from CPU Capacitor emits sound from its foils due to fast pulse charging n discharging Adi Purwono, 2008

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