the long and winding path to secure implementation of
play

The Long and Winding Path to Secure Implementation of GlobalPlatform - PowerPoint PPT Presentation

Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion The Long and Winding Path to Secure Implementation of GlobalPlatform SCP10 Daniel De Almeida Braga


  1. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion The Long and Winding Path to Secure Implementation of GlobalPlatform SCP10 Daniel De Almeida Braga Pierre-Alain Fouque Mohamed Sabt April, 9 th 2020 April, 9th 2020 SCP10 Pitfalls 1 / 26

  2. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion 1 Context 2 Notation & Reminders 3 Deterministic RSA Padding 4 Padding Oracle on Key Transport 5 Key Reuse 6 Secure Implementation 7 Conclusion April, 9th 2020 SCP10 Pitfalls 2 / 26

  3. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Context April, 9th 2020 SCP10 Pitfalls 3 / 26

  4. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion The smart card world April, 9th 2020 SCP10 Pitfalls 4 / 26

  5. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion The smart card world April, 9th 2020 SCP10 Pitfalls 4 / 26

  6. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion SCP (Secure Communication Protocol) April, 9th 2020 SCP10 Pitfalls 5 / 26

  7. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion SCP (Secure Communication Protocol) April, 9th 2020 SCP10 Pitfalls 5 / 26

  8. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion SCP (Secure Communication Protocol) April, 9th 2020 SCP10 Pitfalls 5 / 26

  9. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion SCP (Secure Communication Protocol) Establish a secure session between a card and an Off-Card Entity 2-steps protocol: Key Exchange + Communication April, 9th 2020 SCP10 Pitfalls 5 / 26

  10. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion SCP (Secure Communication Protocol) Establish a secure session between a card and an Off-Card Entity 2-steps protocol: Key Exchange + Communication SCP10 relies on a Public Key Infrastructure: Both the card and off-card entity have a key pair They use each other public key to encrypt/verify messages April, 9th 2020 SCP10 Pitfalls 5 / 26

  11. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Key Exchange Modes (a) Key Transport mode April, 9th 2020 SCP10 Pitfalls 6 / 26

  12. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Key Exchange Modes (a) Key Transport mode (b) Key Agreement mode April, 9th 2020 SCP10 Pitfalls 6 / 26

  13. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Our contributions Our contributions: 1 Abuse blurs and flaws in the RSA encryption in Key Transport 2 Recovered session keys by two independent means In less than a second with the first attack In an average of 2h30 for the second 3 Exploit a design flaw in the specification to forge a valid certificate, signed by the card (allowing impersonation) 4 Implement a (semi-)compliant version of SCP10 as an applet 5 Propose a secure implementation, with an estimation of the corresponding overhead April, 9th 2020 SCP10 Pitfalls 7 / 26

  14. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Our contributions Our contributions: 1 Abuse blurs and flaws in the RSA encryption in Key Transport 2 Recovered session keys by two independent means In less than a second with the first attack In an average of 2h30 for the second 3 Exploit a design flaw in the specification to forge a valid certificate, signed by the card (allowing impersonation) 4 Implement a (semi-)compliant version of SCP10 as an applet 5 Propose a secure implementation, with an estimation of the corresponding overhead However, we did not : × Attack real cards (no implementation in the wild) × Try to exploit weakness in the symmetric encryption April, 9th 2020 SCP10 Pitfalls 7 / 26

  15. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Our Threat Model Our attacker can: � Initiate an SCP10 session with a card � Intercept, read and modify plaintext message transmitted between a legitimate Off-Card Entity and the card � Measure the time needed by the card to respond She cannot: × Have physical access to the card × Break the cryptographic primitives April, 9th 2020 SCP10 Pitfalls 8 / 26

  16. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Notation & Reminders April, 9th 2020 SCP10 Pitfalls 9 / 26

  17. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Acronyms APDU: Application Protocol Data Unit Message format of request send to the card TLV: Tag Length Value Data structure used to ease parsing CRT: Control Reference Template Data structure defining a symmetric key and its usage IV: Initialization Vector Initialisation vector used to initialize symmetric encryption April, 9th 2020 SCP10 Pitfalls 10 / 26

  18. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion RSA and padding RSA: pub = ( n , e ) priv = ( n , d ) Encryption: c = m e mod n , Signature: s = RSA sign ( m , priv ) , Decryption: m = c d Verification: m == RSA ver ( m , pub ) ? mod n . April, 9th 2020 SCP10 Pitfalls 11 / 26

  19. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion RSA and padding RSA: pub = ( n , e ) priv = ( n , d ) Encryption: c = m e mod n , Signature: s = RSA sign ( m , priv ) , Decryption: m = c d Verification: m == RSA ver ( m , pub ) ? mod n . PKCS#1v1.5 padding: Enc: EME-PKCS1-v1_5(m) = 0x00 || 0x02 || PS || 0x00 || m ���� random bytes Sig: EMSA-PKCS1-v1_5(m) = 0x00 || 0x01 || 0xFF..FF || 0x00 || m April, 9th 2020 SCP10 Pitfalls 11 / 26

  20. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Deterministic RSA Padding April, 9th 2020 SCP10 Pitfalls 12 / 26

  21. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Perform Security Operation Perform Security Operation APDU: M: params || CRT [|| CRT] April, 9th 2020 SCP10 Pitfalls 13 / 26

  22. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Perform Security Operation Perform Security Operation APDU: padding M: params || CRT [|| CRT] → EM − − − − EM: 0002 || FF..FF || 00 || params || CRT [|| CRT ...] ���� � �� � � �� � [22,42] bytes 128 − len ( CRTs ) − 3 bytes 3 bytes → Hybrid between EME and EMSA April, 9th 2020 SCP10 Pitfalls 13 / 26

  23. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Perform Security Operation Perform Security Operation APDU: padding M: params || CRT [|| CRT] → EM − − − − EM: 0002 || FF..FF || 00 || params || CRT [|| CRT ...] ���� � �� � � �� � [22,42] bytes 128 − len ( CRTs ) − 3 bytes 3 bytes → Hybrid between EME and EMSA CRT: header || key [|| 91 08 iv ] � �� � ���� ���� [6,8] fixed bytes 8 bytes [16,24] bytes April, 9th 2020 SCP10 Pitfalls 13 / 26

  24. Context Notation & Reminders Deterministic RSA Padding Padding Oracle on Key Transport Key Reuse Secure Implementation Conclusion Perform Security Operation Perform Security Operation APDU: padding M: params || CRT [|| CRT] → EM − − − − EM: 0002 || FF..FF || 00 || params || CRT [|| CRT ...] ���� � �� � � �� � [22,42] bytes 128 − len ( CRTs ) − 3 bytes 3 bytes → Hybrid between EME and EMSA CRT: header || key [|| 91 08 iv ] � �� � ���� ���� [6,8] fixed bytes 8 bytes [16,24] bytes ⇒ Only few unknown bytes (compared to the modulus size) April, 9th 2020 SCP10 Pitfalls 13 / 26

Recommend


More recommend