SAR-SSI 2012 1 Introduction Java Card security model Off-card - - PowerPoint PPT Presentation

sar ssi 2012
SMART_READER_LITE
LIVE PREVIEW

SAR-SSI 2012 1 Introduction Java Card security model Off-card - - PowerPoint PPT Presentation

Samiya Hamadouche, Guillaume Bouffard , Jean-Louis Lanet, Bruno Dorsemaine , Bastien Nouhant, Alexandre Magloire, Arnaud Reygnaud guillaume.bouffard@xlim.fr bruno.dorsemaine@etu.unilim.fr SAR-SSI 2012 1 Introduction Java Card security model


slide-1
SLIDE 1

Samiya Hamadouche, Guillaume Bouffard, Jean-Louis Lanet, Bruno Dorsemaine, Bastien Nouhant, Alexandre Magloire, Arnaud Reygnaud

guillaume.bouffard@xlim.fr bruno.dorsemaine@etu.unilim.fr

SAR-SSI 2012

1

slide-2
SLIDE 2

Introduction

Java Card security model

2

Java class files Byte code verifier (BCV) Byte code converter Byte code signer Java Card file

Off-card security model Firewall

Java Card file BCV Linker Installed applet

On-card security model

slide-3
SLIDE 3

Introduction

Our objectives

 Understand the security of Java Card better  Improve it

Process

 Create ill typed files  Load files on the card

3

slide-4
SLIDE 4

Summary

Introduction Overview Dr4ccarD & the results Counter measures Conclusion

4

slide-5
SLIDE 5

Overview

Goals

 Execute arbitrary & rich shell-codes

Problem

 The addresses of the methods are not access

free

5

slide-6
SLIDE 6

Process

How ?

 Modifying the CAP file

What ?

 Method Component  Constant Pool Component  Reference Location Component

When ?

 Linking step

6

slide-7
SLIDE 7

Normal linking step : before

7

[ … ] .ConstantPoolComponent { [ … ] 0006 - ConstantStaticMethodRef : ExternalStaticMethoddRef : packageToken 80 classToken 10 token 6 } [ … ] .MethodComponent { [ … ] @008a invokestatic 0006 [ … ] } [ … ] .ReferenceLocationComponent { [ … ]

  • ffsets_to_byte2_indices = {

[ … ] @008b [ … ] } [ … ] } [ … ]

Constant Pool reference (token) Offset of a token Method referenced by the token 0006

slide-8
SLIDE 8

[ … ] .ConstantPoolComponent { [ … ] 0006 - ConstantStaticMethodRef : ExternalStaticMethoddRef : packageToken 80 classToken 10 token 6 } [ … ] .MethodComponent { [ … ] #8553 invokestatic 0539 [ … ] } [ … ] .ReferenceLocationComponent { [ … ]

  • ffsets_to_byte2_indices = {

[ … ] @008b [ … ] } [ … ] } [ … ]

Normal linking step : after

8

Real address to call the method

slide-9
SLIDE 9

The attack

9

Token Call to the referenced method

Original code

[ … ] @008a invokestatic 0006 @008d bspush 2a @008f sreturn [ … ]

0x002a Push the byte 0x2a as a signed short on the stack Return the top of the stack

Output

reference 0x002a @0089 @008a @008f after

slide-10
SLIDE 10

The attack

10

Push the token on the stack

Modified code Output

0x0539 0x0539 @0089 @008a @008f after

[ … ] @008a sspush 0006 @008d nop @008e nop @008f sreturn [ … ]

slide-11
SLIDE 11

Summary

Introduction Overview Dr4ccarD & the results Counter measures Conclusion

11

slide-12
SLIDE 12

12

Cap Map OPAL CAP files Ill typed files Dr4ccarD

Analysis

Final report

 Generic  Platform independent  API version (in)dependent

Dr4ccarD

slide-13
SLIDE 13

Reference Java Card GP Characteristics Address of getKey a-21a 2.1.1. 2.0.1. 0x8C08 a-22a 2.2. 2.1. 64k EEPROM 0x080A a-22c 2.1.1. 2.1.1. 36k EEPROM, RSA 0x020F b-21a 2.1.1. 2.1.2. 16k EEPROM, RSA 0x3267 c-22a 2.1.1. 2.0.1. RSA 0x810B c-22c 2.2. 2.1.1. 72k EEPROM, dual interface, RSA 0x810B d-21a 2.1. 2.0.1. 32K EEPROM, RSA 0x0003 d-22b 2.1.1. 2.1.1. 16k EEPROM 0x80BA e-21a 2.2. 2.1. 72k EEPROM 0x142F

13

The results

slide-14
SLIDE 14

Summary

Introduction Overview Dr4ccarD & the results Counter measures Conclusion

14

slide-15
SLIDE 15

Counter measures

Use an embedded BCV

 O(n * 43 + p)  n : number of instructions  p : number of tokens

15

slide-16
SLIDE 16

Counter measures

Only link real tokens

 O(p * log(log(43)))  p : number of tokens

16

.ReferenceLocationComponent { [ … ] @008b [ … ] } @008a invokestatic 0006 Belong to {new, invokestatic, invokevirtual, …} ?

slide-17
SLIDE 17

Summary

Introduction Overview Dr4ccarD & the results Counter measures Conclusion

17

slide-18
SLIDE 18

Conclusion

 Map of the Java Card API  Reverse engineering is easier  Affordable counter measure  Ongoing work : Use a laser beam to

bypass an embedded BCV

18

slide-19
SLIDE 19

Thank you for your attention

Do you have any question ?

19

guillaume.bouffard@xlim.fr bruno.dorsemaine@etu.unilim.fr http://secinfo.msi.unilim.fr/