cs642 computer security
play

CS642: Computer Security Professor Ristenpart - PowerPoint PPT Presentation

Diffie-Hellman, Side-channels, RNGs CS642: Computer Security Professor Ristenpart h9p://www.cs.wisc.edu/~rist/ rist at cs dot wisc dot edu University


  1. Diffie-­‑Hellman, ¡ Side-­‑channels, ¡ RNGs ¡ CS642: ¡ ¡ Computer ¡Security ¡ Professor ¡Ristenpart ¡ h9p://www.cs.wisc.edu/~rist/ ¡ rist ¡at ¡cs ¡dot ¡wisc ¡dot ¡edu ¡ University ¡of ¡Wisconsin ¡CS ¡642 ¡

  2. Diffie-­‑Hellman ¡math ¡ Let ¡p ¡be ¡a ¡large ¡prime ¡number ¡ Fix ¡the ¡group ¡G ¡ ¡= ¡ ¡ Z p ¡ ¡= ¡{1,2,3,…, ¡p-­‑1} ¡ * ¡ ¡ Then ¡G ¡ ¡is ¡ cyclic . ¡This ¡means ¡one ¡can ¡give ¡a ¡ ¡ member ¡g ¡ ¡ ¡ ¡G ¡ ¡, ¡called ¡the ¡generator, ¡such ¡that ¡ ¡ ¡ ∈ ¡ G ¡= ¡{ ¡g 0 , ¡g 1 , ¡ ¡g 2 , ¡… ¡, ¡g p-­‑1 ¡ } ¡ ¡ * ¡ Example: ¡ ¡p ¡= ¡7. ¡Is ¡2 ¡or ¡3 ¡a ¡generator ¡for ¡ Z 7 ¡ ¡ ? ¡ x ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 2 x ¡mod ¡7 ¡ 1 ¡ 2 ¡ 4 ¡ 1 ¡ 2 ¡ 4 ¡ 1 ¡ 3 x ¡mod ¡7 ¡ 1 ¡ 3 ¡ 2 ¡ 6 ¡ 4 ¡ 5 ¡ 1 ¡

  3. Textbook ¡exponen^a^on ¡ Let ¡G ¡ ¡be ¡cyclic ¡group. ¡ ¡ How ¡do ¡we ¡compute ¡h x ¡ ¡for ¡any ¡ ¡h ¡ ¡ ¡ ¡G? ¡ ∈ ModExp(h,x) ¡ SqrAndMulExp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at ¡random ¡from ¡ Z |G| ¡ ¡ Give ¡adversary ¡g, ¡X ¡= ¡g x ¡. ¡Adversary’s ¡goal ¡is ¡to ¡compute ¡x ¡ easy ¡ x ¡ g x ¡ hard ¡

  6. The ¡discrete ¡log ¡problem ¡ Fix ¡a ¡cyclic ¡group ¡G ¡with ¡generator ¡g ¡ ¡ Pick ¡x ¡at ¡random ¡from ¡ Z |G| ¡ ¡ Give ¡adversary ¡g, ¡X ¡= ¡g x ¡. ¡Adversary’s ¡goal ¡is ¡to ¡compute ¡x ¡ Very ¡slow ¡for ¡large ¡groups! ¡ A (X): ¡ O (|G|) ¡ ¡ for ¡i ¡= ¡2 ¡, ¡… ¡, ¡ ¡|G|-­‑1 ¡do ¡ ¡ ¡if ¡X ¡ ¡= ¡g i ¡then ¡ ¡ Baby-­‑step ¡giant-­‑step ¡is ¡be9er: ¡ ¡ ¡Return ¡i ¡ O (|G| 0.5 ) ¡ Nothing ¡faster ¡is ¡known ¡for ¡some ¡ groups. ¡ ¡

  7. Diffie-­‑Hellman ¡Key ¡Exchange ¡ X ¡ Y ¡ Pick ¡random ¡x ¡from ¡ Z |G| ¡ Pick ¡random ¡y ¡from ¡ Z |G| ¡ X ¡= ¡g x ¡ Y ¡= ¡g y ¡ K ¡= ¡H(Y x ) ¡ K ¡= ¡H(X y ) ¡ Y x ¡ ¡ = ¡g yx ¡= ¡g xy ¡= ¡X y ¡ ¡ Get ¡the ¡same ¡key. ¡Why? ¡ ¡ ¡ ¡ What ¡type ¡of ¡security ¡does ¡this ¡protocol ¡provide? ¡

  8. Computa^onal ¡Diffie-­‑Hellman ¡Problem ¡ Fix ¡a ¡cyclic ¡group ¡G ¡with ¡generator ¡g ¡ ¡ Pick ¡x,y ¡both ¡at ¡random ¡ Z |G| ¡ ¡ Give ¡adversary ¡ ¡g, ¡X ¡= ¡g x ¡, ¡Y ¡= ¡g y . ¡ ¡ Adversary ¡must ¡compute ¡g xy ¡ For ¡most ¡groups, ¡best ¡known ¡algorithm ¡finds ¡ ¡ discrete ¡log ¡of ¡X ¡or ¡Y. ¡ ¡ But ¡we ¡have ¡no ¡proof ¡that ¡this ¡is ¡best ¡approach. ¡

  9. TLS ¡handshake ¡for ¡ Diffie-­‑Hellman ¡Key ¡Exchange ¡ Client ¡ Server ¡ ClientHello, ¡MaxVer, ¡Nc, ¡Ciphers/CompMethods ¡ Pick ¡random ¡Nc ¡ Pick ¡random ¡Ns ¡ Check ¡CERT ¡ ServerHello, ¡Ver, ¡Ns, ¡SessionID, ¡Cipher/CompMethod ¡ using ¡CA ¡public ¡ Pick ¡random ¡x ¡ CERT ¡= ¡(pk s ¡, ¡signature ¡over ¡it) ¡ verifica^on ¡key ¡ X ¡= ¡g x ¡ p ¡, ¡g ¡, ¡X ¡, ¡ ¡ ¡σ ¡ ¡= ¡Sign(sk s , ¡p ¡|| ¡g ¡|| ¡X) ¡ ¡ Check ¡σ ¡ Pick ¡random ¡y ¡ Y ¡ Y ¡= ¡g y ¡ PMS ¡= ¡g xy ¡ ChangeCipherSpec, ¡ ¡ PMS ¡= ¡g xy ¡ { ¡Finished, ¡PRF(MS, ¡“Client ¡finished” ¡|| ¡H(transcript)) ¡} ¡ ¡ ¡ ChangeCipherSpec, ¡ ¡ Bracket ¡nota^on ¡ { ¡Finished, ¡PRF(MS, ¡“Server ¡finished” ¡|| ¡H(transcript’)) ¡} ¡ ¡ ¡ means ¡contents ¡ ¡ encrypted ¡ MS ¡<-­‑ ¡PRF(PMS, ¡“master ¡secret” ¡|| ¡Nc ¡|| ¡Ns ¡) ¡

  10. Side-­‑channel ¡a9acks ¡ • Implementa^ons ¡might ¡leak ¡informa^on ¡ about ¡secret ¡internal ¡state ¡via ¡side-­‑channels: ¡ – power ¡consump^on ¡ – Electromagne^c ¡emana^ons ¡(Tempest) ¡ – ^ming ¡ – Shared ¡physical ¡resources ¡(CPU ¡cache) ¡

  11. PKCS ¡#1 ¡RSA ¡encryp^on ¡ Kg ¡outputs ¡(N,e),(N,d) ¡ ¡ ¡where ¡|N| 8 ¡= ¡n ¡ ¡ Let ¡B ¡= ¡{0,1} 8 ¡ / ¡{00} ¡ ¡be ¡set ¡of ¡all ¡bytes ¡except ¡00 ¡ Want ¡to ¡encrypt ¡messages ¡of ¡length ¡|M| 8 ¡= ¡m ¡ (N,e) ¡ Enc((N,e), ¡M, ¡R) ¡ pad ¡= ¡ ¡first ¡n ¡-­‑ ¡m ¡-­‑ ¡2 ¡bytes ¡from ¡R ¡that ¡ R ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡are ¡in ¡B ¡ Enc ¡ C ¡ Y ¡= ¡00 ¡|| ¡02 ¡|| ¡pad ¡|| ¡00 ¡|| ¡M ¡ M ¡ Return ¡Y e ¡mod ¡N ¡ Dec((N,d), ¡C ¡) ¡ (N,d) ¡ Y ¡= ¡C d ¡mod ¡N ¡ ¡ ¡ ¡; ¡ ¡aa||bb||w ¡= ¡Y ¡ If ¡(aa ¡≠ ¡00) ¡or ¡(bb ¡≠ ¡02) ¡or ¡(00 ¡ ¡ ¡w) ¡ / M ¡or ¡ ¡ ∈ C ¡ Dec ¡ ¡ ¡ ¡ ¡ ¡Return ¡error ¡ error ¡ pad ¡|| ¡00 ¡|| ¡M ¡= ¡w ¡ Return ¡M ¡

  12. SqrAndMulExp(C,d,N) ¡ But: ¡ b k ,…,b 0 ¡= ¡d ¡ Squaring ¡and ¡mul^plying ¡take ¡ f ¡= ¡1 ¡ different ¡amounts ¡of: ¡ For ¡i ¡= ¡k ¡down ¡to ¡0 ¡do ¡ 1) power ¡ S ¡ ¡f ¡= ¡f 2 ¡ ¡mod ¡N ¡ 2) ^me ¡ ¡If ¡b i ¡= ¡1 ¡then ¡ M ¡ 3) instruc^on ¡cache ¡sets ¡ ¡ ¡f ¡= ¡f*C ¡mod ¡N ¡ Return ¡f ¡ S ¡M ¡S ¡S ¡M ¡S ¡M ¡ d ¡= ¡? ¡ ¡ ¡1 ¡ ¡ ¡ ¡0 ¡ ¡ ¡1 ¡ ¡ ¡ ¡ ¡ ¡1 ¡ d ¡= ¡11 ¡

  13. SqrAndMulExp(X,e,N) ¡ But: ¡ b k ,…,b 0 ¡= ¡e ¡ Squaring ¡and ¡mul^plying ¡take ¡ f ¡= ¡1 ¡ different ¡amounts ¡of: ¡ For ¡i ¡= ¡k ¡down ¡to ¡0 ¡do ¡ 1) power ¡ ¡f ¡= ¡f 2 ¡ ¡mod ¡N ¡ 2) ^me ¡ ¡If ¡b i ¡= ¡1 ¡then ¡ 3) instruc^on ¡cache ¡sets ¡ ¡ ¡f ¡= ¡f*X ¡mod ¡N ¡ Return ¡f ¡ From ¡Messerges ¡et ¡al. ¡1999: ¡ Exponentiation Power Signal: Multiplication Power Signal: Multiply Multiply Square . . . Square Square Cross-Correlation Signal: Fig. 2. Cross-Correlation of Multiplication and Exponentiation Power Signals The above signals were obtained using the power analysis equipment described in Section 4. The signals were averaged for 5,000 exponentiations using a constant input value. The results

  14. SqrAndMulExp(X,e,N) ¡ But: ¡ b k ,…,b 0 ¡= ¡e ¡ Squaring ¡and ¡mul^plying ¡take ¡ f ¡= ¡1 ¡ different ¡amounts ¡of: ¡ For ¡i ¡= ¡k ¡down ¡to ¡0 ¡do ¡ 1) power ¡ ¡f ¡= ¡f 2 ¡ ¡mod ¡N ¡ 2) ^me ¡ ¡If ¡b i ¡= ¡1 ¡then ¡ 3) instruc^on ¡cache ¡sets ¡ ¡ ¡f ¡= ¡f*X ¡mod ¡N ¡ Return ¡f ¡ Time: ¡ Remote ¡^ming ¡a9acks ¡against ¡TLS ¡ ¡(Boneh, ¡Brumley ¡2003) ¡ ¡ Chosen ¡ciphertexts ¡+ ¡^ming ¡= ¡key ¡extrac^on ¡ ¡ ~1 ¡million ¡queries ¡(though ¡highly ¡variable) ¡

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