accessing secure information using export file fraudulence
play

Accessing Secure Information using Export file Fraudulence Guillaume - PowerPoint PPT Presentation

Accessing Secure Information using Export file Fraudulence Guillaume Bouffard 1 Tom Khefif 1 Jean-Louis Lanet 1 Ismael Kane 2 Sergio Casanova Salvia 2 1 Smart Secure Devices (SSD) Team University of Limoges Limoges, France


  1. Accessing Secure Information using Export file Fraudulence Guillaume Bouffard 1 Tom Khefif 1 Jean-Louis Lanet 1 Ismael Kane 2 Sergio Casanova Salvia 2 1 Smart Secure Devices (SSD) Team – University of Limoges – Limoges, France guillaume.bouffard @unilim.fr http://secinfo.msi.unilim.fr 2 Applus – LGAI Technological Center – Barcelona, Spain CRiSIS 2013 – PhD Workshop 1 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 1/16

  2. Outline Introduction Smart Card Java Card Technology Java Card Linking Process Outside the Java Card Inside the Java Card Man-in-the-Middle Attack Objective Exploitation on the javacard.security API Conclusion 2 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 2/16

  3. The Smart Card Widely used device • Credit Card; • (U)SIM Card; • Health Card (french Vitale card); • Pay TV; • . . . This device contains sensitive data 3 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 3/16

  4. Java Card based Smart Card Applet Applet Applet • Created by Vendor and/or Schlumberger in 1996. Java Card Industry Spe- Runtime • Specified by Oracle cific Extensions Environ- • Provide a friendly Java Card Framework and APIs ment environment to develop Java Card Virtual Machine secured Java Card Operating System applications. Hardware 4 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 4/16

  5. Java Card Security Model • Off-card Security Java Class Files Java Card Files Byte Code Verifier Byte Code Converter Byte Code Signer (BCV) 5 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 5/16

  6. Java Card Security Model • Off-card Security Java Class Files Java Card Files Byte Code Verifier Byte Code Converter Byte Code Signer (BCV) • On-card Security Installed applet Java Card Files BCV Linker Firewall 5 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 5/16

  7. Off-card compilation Application export File Java Archive Byte Code Con- verter, con- verter and signer API export Files Application Cap File 6 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 6/16

  8. Off-card compilation Application export File Java Archive Byte Code Con- verter, con- verter and signer API export Files Application Cap File 6 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 6/16

  9. Off-card compilation Java- Class Files Application export File • Non-optimized for embedded devices Java Archive • Itemized file Byte Code Con- • Each item is an UTF8-String verter, con- #1 - Class Reference: name=#2 verter and signer #2 - UTF8 Text: fr/unilim/MyApplet #3 - UTF8 Text: process #4 - UTF8 Text: (Ljavacard/framework/APDU)V #5 - Method Reference: class=#1 signature=#6 #6 - Name/Type: name=#3 type=#4 API export Files Application Cap File 6 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 6/16

  10. Off-card compilation API export Files Application export File • Class ’ item to Java Card token Java Archive • 1 export file/Java-Package Byte Code Con- • The Java Card toolchain uses the verter, con- first find, first used export file. verter and signer class_info { // javacard/framework/APDU token #10 access_flags public final name_index 172 // javacard/framework/APDU export_supers_count 1 API export Files ... Application Cap File 6 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 6/16

  11. Off-card compilation Application export File Java Archive Byte Code Con- verter, con- verter and signer API export Files Application Cap File 6 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 6/16

  12. Off-card compilation Program export File Application export File • Describe each public methods shared Java Archive by the built application or API. Byte Code Con- verter, con- verter and signer API export Files Application Cap File 6 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 6/16

  13. Off-card compilation Program CAP File Application export File • Tokenized file Java Archive • Optimized for embedded devices Byte Code Con- verter, con- verter and signer API export Files Application Cap File 6 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 6/16

  14. On-Card Linking Step Reference Location Component Import Component ... packages[0]{ // javacard.framework offset_to_byte2_indices: { version: 1.2 ... @32 ... AID: 0xA0000000620101 } } ... Method Component Constant Pool Component ... ... /*0030*/ aload_2 Token: 2 => CONSTANT_VirtualMethodRef: /*0031*/ invokevirtual 0002 external method: 0x80 , 0x12, 0x00 ... ... 7 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 7/16

  15. Man-In-The-Middle • Attacks aims to: ◦ Abuse the Off-card Java Card toolchain; ◦ Link a malicious library instead of the legitimate one. • Hypothesis: ◦ The Java Card Export folder can be corrupted; ◦ The Smart Card’s loading keys are known. 8 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 8/16

  16. Principle Applet Attacker’s applet Fake API API buildKey buildKey Key Store key Key getKeys Keys stored 9 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 9/16

  17. Modus Operandi I 1. A copy of API to confuse is developed: ◦ Same classes’ prototype; ◦ Same methods’ prototype; ◦ Package’s name?/AID? 2. The developer downloaded the fake export file: ◦ The Java Card uses the first find, first used policy. 3. The Java- Class file to be converted is linked with our malicious export file 4. The Applet is linked with the malicious Java Card API. 10 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 10/16

  18. Modus Operandi II Card Faulty API Java- Cap File API Conversion Faulty API Loading 1 Applet Use Same AID Fake API Fake Export Conversion Loading 2 Java- Cap Conversion Applet file Export Export Fake ... 1 2 Export 3 11 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 11/16

  19. A Piece of a Java Card Crypto. Application ✞ ☎ this .desKey = (javacard.security.DESKey) javacard.security.KeyBuilder.buildKey (KeyBuilder.TYPE_DES , // key’s type KeyBuilder.LENGTH_DES , // key’s length true ); // key value is encrypted // DES Key initialization this .desKey.setKey(DES_KEY_VALUE , //PIN code init. OFFSET_DES_KEY_VALUE ); ✝ ✆ • Exploitation: ◦ Develop a fake javacard.security export file; ◦ The fragment of Crypto Application is linked with our malicious export file ◦ Problem: Can the application be correctly executed? 12 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 12/16

  20. A Piece of a Java Card Crypto. Application ✞ ☎ this .desKey = (javacard.security.DESKey) javacard.security.KeyBuilder.buildKey (KeyBuilder.TYPE_DES , // key’s type KeyBuilder.LENGTH_DES , // key’s length true ); // key value is encrypted // DES Key initialization this .desKey.setKey(DES_KEY_VALUE , //PIN code init. OFFSET_DES_KEY_VALUE ); ✝ ✆ Object javacard.security malicious.API � = DESKey DESKey 12 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 12/16

  21. How to Execute an Ill-Linked Applet? I Applet malicious.API.DESKey javacard.security.DESKey desKey.setKey() desKey.setKey() ok ok 13 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 13/16

  22. How to Execute an Ill-Linked Applet? II ✞ ☎ public class DESKey extends malicious.API.DESKey { private javacard.security.DESKey desKey; // Default constructor MyDESKey (javacard.security.DESKey desKey) public { this .desKey = desKey; } // Implementation of the setKey function setKey( byte [] keyData , short kOff) { public void this .desKey.setKey(keyData , kOff); } // ... } ✝ ✆ 14 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 14/16

  23. The End • What we did? ◦ A Man-in-the-Middle attack on Java Card was presented; ◦ The javacard.security API was exploited; • How to prevent that? ◦ Sign the export file! 15 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 15/16

  24. Thank you for your attention! Do you have any questions? ? guillaume.bouffard@unilim.fr http://secinfo.msi.unilim.fr 16 / 16 Guillaume Bouffard (SSD Team) Accessing Secure Information using Export file Fraudulence 16/16

Recommend


More recommend