formal security analysis of cryptographic protocol code
play

Formal Security Analysis of Cryptographic Protocol Code - PowerPoint PPT Presentation

Formal Security Analysis of Cryptographic Protocol Code Karthikeyan Bhargavan INRIA Karthikeyan.Bhargavan@inria.fr IIT Delhi, Fall 2010 Lecture 3: Coding


  1. Formal ¡Security ¡Analysis ¡of ¡ Cryptographic ¡Protocol ¡Code ¡ ¡ Karthikeyan ¡Bhargavan ¡ INRIA ¡ Karthikeyan.Bhargavan@inria.fr ¡ IIT ¡Delhi, ¡Fall ¡2010 ¡

  2. Lecture ¡3: ¡ Coding ¡Symbolic ¡Abstrac3ons ¡in ¡F# ¡ IntroducCon ¡

  3. A ¡Crypto ¡Protocol ¡ImplementaCon ¡ ApplicaCon ¡ ParGally ¡Trusted ¡ Code ¡ Network ¡ ¡ Protocol ¡ Based ¡ Code ¡ Opponent ¡ Key ¡ Cryptographic ¡ ¡ Network ¡ ¡ Management ¡ Library ¡ Stack ¡ Database ¡of ¡secrets ¡ Crypto ¡algorithms ¡ Network ¡Protocols ¡ (keys, ¡passwords) ¡ Untrusted ¡Network ¡

  4. Towards ¡Symbolic ¡VerificaCon ¡ One ¡Source, ¡Many ¡Tasks ¡ ApplicaCons ¡ ¡ One ¡Source ¡ Many ¡Tasks ¡ Security ¡ Protocol ¡Code ¡ Goals ¡ ¡ ¡ Crypto, ¡Net ¡ ¡ ¡ Crypto, ¡Net ¡ Other ¡ ¡ ¡Concrete ¡Libraries ¡ ¡ ¡ ¡Symbolic ¡Libraries ¡ Implementa3ons ¡ ¡ AAack ¡ ¡ ¡Compile ¡ ¡ ¡Compile ¡ Verify ¡ Diverges ¡ Run ¡ Run ¡ No ¡AAack ¡ Network ¡ Symbolic ¡ ¡ Symbolic ¡ ¡ Interoperability ¡Tes3ng ¡ Debugging ¡ Verifica3on ¡

  5. Lecture ¡Outline ¡ • Library ¡modules ¡review: ¡Data, ¡Net, ¡Crypto ¡ • An ¡example ¡protocol ¡using ¡these ¡modules ¡ – AuthenCcated ¡RPC ¡ – Security ¡goals, ¡how ¡shall ¡we ¡formalize ¡them? ¡ • A ¡symbolic ¡cryptographic ¡library ¡ – New ¡implementaCons ¡for ¡Data, ¡Crypto, ¡Net ¡ • Symbolic ¡debugging ¡ – AuthenCcated ¡EncrypCon ¡example ¡

  6. Lecture ¡3: ¡ Coding ¡Symbolic ¡Abstrac3ons ¡in ¡F# ¡ Library ¡Modules ¡

  7. Data ¡Module: ¡Strings, ¡Bytestrings ¡ Interface ¡ • str ¡represents ¡string ¡ • bytes ¡represents ¡byte[] ¡ ¡

  8. Net ¡Module: ¡Networking ¡ • Uses ¡Data.bytes ¡ • fork ¡creates ¡a ¡new ¡thread ¡running ¡the ¡funcCon ¡ ¡ ¡

  9. Crypto ¡Module: ¡Cryptography ¡

  10. request ¡ HMAC(key,request) ¡ response ¡ HMAC(key,request,response) ¡ Client ¡ ¡ Server ¡ SAMPLE ¡PROTOCOL ¡ AUTHENTICATED ¡RPC ¡

  11. Informal ¡DescripCon ¡

  12. Why ¡Is ¡This ¡Protocol ¡Secure? ¡

  13. Logical ¡SpecificaCon ¡

  14. F# ¡ImplementaCon ¡

  15. Test ¡ Connecting to localhost:8080 Sending {BgAyICsgMj9mhJa7iDAcW3Rrk...} (28 bytes) Listening at ::1:8080 Received Request 2 + 2? Sending {AQA0NccjcuL/WOaYS0GGtOtPm...} (23 bytes) Received Response 4

  16. Is ¡The ¡Protocol ¡Code ¡Secure? ¡ 1. Can ¡the ¡opponent ¡cause ¡one ¡of ¡our ¡ authenCcaCon ¡goals ¡to ¡fail? ¡ 2. What ¡if ¡the ¡opponent ¡sent ¡a ¡forged ¡message ¡to ¡ the ¡server? ¡ 3. What ¡if ¡the ¡client ¡started ¡concurrent ¡sessions ¡ with ¡both ¡an ¡honest ¡and ¡a ¡dishonest ¡server? ¡ 4. What ¡if ¡the ¡MAC ¡key ¡is ¡compromised? ¡ More ¡importantly, ¡what ¡is ¡the ¡formal ¡model ¡under ¡ which ¡we ¡may ¡prove ¡our ¡security ¡goals? ¡ ¡

  17. Lecture ¡3: ¡ Coding ¡Symbolic ¡Abstrac3ons ¡in ¡F# ¡ A ¡Symbolic ¡AbstracCon ¡of ¡ Cryptography ¡

  18. A ¡New ¡ImplementaCon ¡of ¡Data, ¡Crypto ¡ str, ¡bytes ¡are ¡both ¡now ¡algebraic ¡datatypes ¡ • operaCons ¡on ¡bytes ¡are ¡represented ¡as ¡constructors ¡ • – One-­‑one ¡determinisCc ¡funcCons ¡

  19. Recall: ¡Data ¡Interface ¡ • We ¡must ¡implement ¡all ¡these ¡funcCons ¡

  20. Conversions ¡using ¡InverCble ¡Constructors ¡ • UTF8, ¡Base64, ¡Concat ¡modeled ¡as ¡constructors ¡ ¡ – one-­‑one ¡determinisCc ¡funcCons ¡ • Inverse ¡funcCons ¡modeled ¡using ¡pacern ¡matching ¡

  21. Random ¡Values ¡using ¡Fresh ¡Names ¡ • A ¡name ¡is ¡a ¡freshly ¡generated ¡value ¡ – The ¡name ¡datatype ¡is ¡hidden ¡from ¡the ¡interface ¡ – Hence, ¡given ¡a ¡name, ¡one ¡cannot ¡deconstruct ¡it ¡ – And ¡given ¡a ¡counter, ¡one ¡cannot ¡construct ¡a ¡name ¡

  22. Hash/MAC ¡as ¡One-­‑way ¡Constructors ¡ • Hash, ¡MAC ¡are ¡constructors ¡ – One-­‑one ¡funcCons ¡[ Collision ¡resistance ] ¡ • The ¡implementaCon ¡of ¡type ¡bytes ¡is ¡hidden ¡ – No ¡funcCon ¡for ¡inverCng ¡Hash/MAC ¡ – Hence, ¡noboby ¡can ¡look ¡inside ¡a ¡Hash ¡or ¡a ¡MAC ¡ – [ Preimage ¡resistance ] ¡ • To ¡construct ¡a ¡MAC ¡one ¡must ¡use ¡mac ¡ – One ¡must ¡know ¡the ¡key ¡[ Unforgeability ] ¡ • AssumpGons ¡too ¡strong? ¡ – Nobody ¡can ¡read ¡the ¡contents ¡of ¡MAC ¡[Secrecy] ¡

  23. Symbolic ¡Symmetric ¡EncrypCon ¡ ¡ • DecrypCon ¡succeeds ¡on ¡encrypted ¡values ¡ – [ DeterminisGc ¡DecrypGon ] ¡ • SymEncrypt ¡constructor ¡hidden ¡from ¡interface ¡ – Only ¡way ¡to ¡open ¡it ¡is ¡to ¡use ¡sym_decrypt ¡ – Hence, ¡one ¡must ¡know ¡key ¡to ¡recover ¡plaintext ¡ – [ Secrecy ] ¡

  24. Public ¡and ¡Private ¡Keys ¡ • Private ¡keys ¡are ¡fresh ¡names ¡ • One ¡can ¡go ¡from ¡a ¡private ¡key ¡to ¡a ¡public ¡key ¡ – But ¡not ¡the ¡other ¡way ¡round ¡[ Private ¡Key ¡Secrecy ] ¡

  25. Symbolic ¡Asymmetric ¡EncrypCon ¡ • EncrypCon ¡with ¡public ¡key ¡ – DecrypCon ¡with ¡private ¡key ¡ – AsymEncrypt ¡constructor ¡is ¡hidden ¡from ¡interface ¡ – Nobody ¡can ¡access ¡plaintext ¡without ¡calling ¡ asym_decrypt ¡with ¡private ¡key ¡[ Secrecy ] ¡ ¡

  26. Symbolic ¡Signatures ¡ ¡ • Only ¡way ¡to ¡construct ¡Sign(k,b) ¡is ¡through ¡sign ¡ – One ¡must ¡know ¡k ¡[ Unforgeability ] ¡ • VerificaCon ¡guarantees ¡that ¡the ¡signer ¡knows ¡ the ¡private ¡key ¡[ Non-­‑repudiaGon ] ¡

  27. Recall: ¡Net ¡Interface ¡

  28. Networking ¡using ¡Channels ¡ • The ¡network ¡is ¡a ¡public ¡channel ¡ • Channels ¡are ¡asynchronous, ¡unordered, ¡buffered ¡ – send ¡adds ¡a ¡message ¡to ¡the ¡buffer ¡

  29. Networking ¡using ¡Channels ¡ • recv ¡is ¡blocking ¡ – It ¡waits ¡for ¡a ¡message ¡to ¡appear ¡on ¡the ¡network ¡ – Code ¡uses ¡monitors ¡to ¡avoid ¡race ¡condiCons ¡

  30. Network-­‑based ¡Acacker ¡ • The ¡network ¡channel ¡netChan ¡is ¡made ¡ available ¡to ¡the ¡acacker ¡ – He ¡knows ¡all ¡connecCon ¡idenCfiers ¡ – He ¡can ¡send ¡any ¡message ¡using ¡Net.send ¡ – He ¡can ¡intercept ¡any ¡message ¡using ¡Net.recv ¡ • Hence, ¡the ¡acacker ¡controls ¡the ¡network ¡

  31. request ¡ HMAC(key,request) ¡ response ¡ HMAC(key,request,response) ¡ Client ¡ ¡ Server ¡ SAMPLE ¡PROTOCOL ¡ AUTHENTICATED ¡RPC ¡REVISITED ¡

  32. F# ¡ImplementaCon ¡

  33. Test ¡with ¡Symbolic ¡Libraries ¡ Connecting to http://localhost:8081 Listening at http://localhost:8081 Accepted channels Sending: Foo | HMAC-SHA1{symkey[1]}[Foo] Sending Bar in response to Foo Sending: Bar | HMAC-SHA1{symkey[1]}[Foo | Bar] Accepted Bar as response to Foo Compare ¡with ¡the ¡original ¡concrete ¡run: ¡ Connecting to localhost:8080 Sending {BgAyICsgMj9mhJa7iDAcW3Rrk...} (28 bytes) Listening at ::1:8080 Received Request 2 + 2? Sending {AQA0NccjcuL/WOaYS0GGtOtPm...} (23 bytes) Received Response 4

  34. Is ¡The ¡Protocol ¡Code ¡Secure? ¡ 1. Can ¡the ¡opponent ¡cause ¡one ¡of ¡our ¡ authenCcaCon ¡goals ¡to ¡fail? ¡ 2. What ¡if ¡the ¡opponent ¡sent ¡a ¡forged ¡message ¡to ¡ the ¡server? ¡ 3. What ¡if ¡the ¡client ¡started ¡concurrent ¡sessions ¡ with ¡both ¡an ¡honest ¡and ¡a ¡dishonest ¡server? ¡ 4. What ¡if ¡the ¡MAC ¡key ¡is ¡compromised? ¡ More ¡importantly, ¡what ¡is ¡the ¡formal ¡model ¡under ¡ which ¡we ¡may ¡prove ¡our ¡security ¡goals? ¡ ¡

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