one done a single decryption em based attack on openssl s
play

One&Done: A Single-Decryption EM-Based Attack on OpenSSLs - PowerPoint PPT Presentation

One&Done: A Single-Decryption EM-Based Attack on OpenSSLs Constant-Time Blinded RSA Monjur Alam, Haider Adnan Khan, Moumita Dey, Nishith Sinha, Robert Callan, Alenka Zajic, and Milos Prvulovic 1 1 v Motivation Public key crypto is


  1. One&Done: A Single-Decryption EM-Based Attack on OpenSSL’s Constant-Time Blinded RSA Monjur Alam, Haider Adnan Khan, Moumita Dey, Nishith Sinha, Robert Callan, Alenka Zajic, and Milos Prvulovic 1 1

  2. v Motivation Ø Public key crypto is essential for modern security Ø Secure exchange of session keys Ø Verifying identity of systems and users Ø And a lot more Ø Private keys are a highly valuable asset Ø So attackers want them Ø And we don’t want attackers to get them 2 2

  3. v Public Key Crypto Ø Good public key crypto (e.g. RSA) Ø Designed to make private keys very, very hard to recover key RSA 3 3

  4. v Analog Side-Channel Attacks Ø But cryptographic implementation runs on real hardware Ø Logic gates switch, causing current flow Ø Currents flowing create changes in surrounding EM field key RSA Side-channel information helps recover the private key 4 4

  5. v Analog Side-Channel Attacks Ø Message randomization (blinding) Ø Prevents chosen-plaintext and other message-dependent attacks Ø But… when message-independent operations use the key key RSA Side-channel information, alone, eventually enables efficient recovery of the private key 5 5

  6. v Analog Side-Channel Attacks Ø One&Done Ø Message does not matter (message blinding does not help) Ø Multiple “traces” not needed (exponent blinding does not help) key RSA Side-channel information alone , in a single encryption/signing, enables efficient recovery of the entire private key 6 6

  7. v OpenSSL’s RSA Implementation Ø BN_mod_exp_montgomery_consttime() Ø Computes x d mod m , where d is the secret exponent For each fixed-size “window” For each bit in the window Square the result ( v=v 2 ) Look up one bit of d and add to wval Multiply result with x wval Look up precomputed x wval 7 7

  8. v Side-Channel Attacks on OpenSSL’s RSA Ø BN_mod_exp_montgomery_consttime() Ø Computes x d mod m , where d is the secret exponent For each fixed-size “window” For each bit in the window Square the result ( v=v 2 ) One&Done (new) Mitigation (new) Get bit from d, add to wval Genkin et al., CHES’15 Message Blinding Multiply result with x wval Look up precomputed x wval Cache (e.g. Percival) Scatter-Gather 8 8

  9. v Measurement Setup Samsung Alcatel Ideal A13-OLinuXino Galaxy Centura SCH-S738C 9 9

  10. v Side Channel Analysis Ø Recent advances in side-channel-based program monitoring Ø Camelia, our DARPA LADS project • Uses analog signals to monitor computational activity to detect control flow deviation and/or execution of unknown code • Found that even a single-instruction control-flow can be detected • But… Ø Constant-time implementation – no key-dependent CF Ø Every encryption has the same CF sequence • Can’t use CF differences for attack • But can use the (very stable and predictable) signal features and timing to tell us exactly where in the signal BN_is_bit_set is executing 10 10

  11. v Attack Approach Constant-time Montgomery Multiplication Another Constant-time to square the result Montgomery Multiplication Const-Time Easy to Find Window-value update 11 11

  12. v Relevant Part Zoom-In Window Value Update 0 -A 1 -A 0 -B 1 -B 12 12

  13. How well does this recover bits of <d p ,d q >? Ø Training on 15 private-key RSA decryptions Ø Recover bits of secret exponents using only one decryption 100% 99% 98% Max 97% Median 96% Min 95% Samsung Alcatel Ideal OLinuXino Galaxy Phone Board Centura Phone 13 13

  14. v Full RSA Key Recovery Ø We have dp and dq but with Ø Erasures – could not find where the bit’s signal is Ø Errors – found the bit’s signal, but misclassified it (0 vs. 1) Ø Existing branch-and-prune algorithms Ø Prune partial solutions when group of bits has too many errors • Assumes errors are uniformly distributed • Our errors often occur in bursts • Does not explicitly handle erasures Ø Prune partial solutions that disagree with known bits of <d p ,d q > • Can’t handle errors (no bits truly “known”) 14 14

  15. v Full RSA Key Recovery Ø We have dp and dq but with Ø Erasures – could not find where the bit’s signal is Ø Errors – found the bit’s signal, but misclassified it (0 vs. 1) Ø Our algorithm Ø Take partial solution with fewest disagreement overall • Known-to-be-unknown bits (erasures) not counted Ø Expand that partial solution by one bit position • Prune expansions that violate relationships between p,q,n,dp,and dq • Efficient implementation, nearly all checks use only scalars (not BNs) Ø Repeat 15 15

  16. v Recover RSA key from <d p ,d q > with errors 1,000,000.00 Key Search Steps Errors Erasures 100,000.00 50 % Mix 10,000.00 1,000.00 0% 1% 2% 3% 4% 5% 6% 7% 8% 9% 10% Our <d p ,d q > results Key search using one i7 core: (errors+erasures) 500K steps / second! 16 16

  17. v More in the paper Ø Train on one device, attack another Ø Only slightly worse than same-device (still 100% key recovery) Ø Similar attack on sliding-window implementation Ø Used in prior versions of OpenSSL • Prior attacks extract enough bits to sometimes allow full-key recovery Ø One&Done recovers nearly all bits in one private-key encryption, recovered full key every time 17 17

  18. v Mitigation Ø Fundamental enabler of the attack Ø Several instructions have very few possibilities for their operands • BN_is_bit_set returns either 0 or 1 Ø No need to get bits one at a time Ø A 5-bit fixed window needs 5 consecutive bits • Don’t have to get them one at a time and shift into wval Ø So we take an entire word’s worth of bits each time, mask to window-size only before wval is needed Ø Takes only a little longer than getting one bit! Ø But done only once per window! 18 18

  19. v Results after mitigation 65% Max 60% Median Min 55% Random 50% Guessing Erasures 45% Counted as Errors 40% Samsung Galaxy Alcatel Ideal Phone OLinuXino Board Centura Phone 19 19

  20. v Conclusions Ø Analog side-channel attack on OpenSSL’s constant-time modular exponentiation implementation Ø Precise timing thanks to constant-timeness of the implementation Ø Highly accurate thanks to one-secret-bit-at-a-time implementation Ø Entire private key recovered from only one use of that key Ø Attack not affected by blinding Ø Attack directly obtains exponent bits, message bits not relevant Ø Exponent blinding does not help agains single-trace attacks Ø Mitigation: look up groups of secret bits, not individual bits 20 20

  21. Thank you! Questions ? 21 21

Recommend


More recommend