Physical Security of Smart Cards Michael Tunstall University - - PowerPoint PPT Presentation

physical security of smart cards
SMART_READER_LITE
LIVE PREVIEW

Physical Security of Smart Cards Michael Tunstall University - - PowerPoint PPT Presentation

Physical Security of Smart Cards Michael Tunstall University College Cork, Ireland. Limerick March 5, 2008 Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 Limerick 1 / 37 Introduction Outline


slide-1
SLIDE 1

Physical Security of Smart Cards

Michael Tunstall

University College Cork, Ireland.

Limerick — March 5, 2008

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 1 / 37

slide-2
SLIDE 2

Introduction

Outline

1

Introduction What is a Smart Card? Why use Smart Cards?

2

Measuring the Power Consumption The Experimental Setup

3

Simple Power Analysis Attacking an Algorithm Attacking an Algorithm Reverse Engineering

4

Differential Power Analysis Correlation Power Analysis Using the Partial Correlation Case Study: The DES block cipher

5

Fault Analysis Case Study: The DES block cipher

6

Countermeasures

7

Other Problems

8

Conclusion

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 2 / 37

slide-3
SLIDE 3

Introduction What is a Smart Card?

What is a Smart Card?

Essentially a small computer.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 3 / 37

slide-4
SLIDE 4

Introduction Why use Smart Cards?

Why use Smart Cards?

Tamper resistance.

◮ Storage. ◮ Processing (e.g. authentication/ciphering algorithms).

Portability.

◮ Ease of use. ◮ Onboard key generation. ◮ Cost. Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 4 / 37

slide-5
SLIDE 5

Measuring the Power Consumption

Outline

1

Introduction What is a Smart Card? Why use Smart Cards?

2

Measuring the Power Consumption The Experimental Setup

3

Simple Power Analysis Attacking an Algorithm Attacking an Algorithm Reverse Engineering

4

Differential Power Analysis Correlation Power Analysis Using the Partial Correlation Case Study: The DES block cipher

5

Fault Analysis Case Study: The DES block cipher

6

Countermeasures

7

Other Problems

8

Conclusion

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 5 / 37

slide-6
SLIDE 6

Measuring the Power Consumption The Experimental Setup

The Experimental Setup

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 6 / 37

slide-7
SLIDE 7

Simple Power Analysis

Outline

1

Introduction What is a Smart Card? Why use Smart Cards?

2

Measuring the Power Consumption The Experimental Setup

3

Simple Power Analysis Attacking an Algorithm Attacking an Algorithm Reverse Engineering

4

Differential Power Analysis Correlation Power Analysis Using the Partial Correlation Case Study: The DES block cipher

5

Fault Analysis Case Study: The DES block cipher

6

Countermeasures

7

Other Problems

8

Conclusion

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 7 / 37

slide-8
SLIDE 8

Simple Power Analysis

Simple Power Analysis (SPA)

Simple Power Analysis is the analysis of one, or several, power consumption traces to determine what is occurring within a device. SPA will always be specific to one implementation, i.e. a given algorithm on a given device (electrical properties). SPA can be used to:

◮ Determine information on secret/private keys in some instances. ◮ Reverse engineering of algorithms. ⋆ Attacking an implementation of a cryptographic algorithm will involve

the reverse engineering of the algorithm used and the key being manipulated.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 8 / 37

slide-9
SLIDE 9

Simple Power Analysis Attacking an Algorithm

Simple Power Analysis (SPA)

If we consider the square and multiply algorithm. Algorithm 1: The Square and Multiply Algorithm Input: M, d = (dx, dx−1, . . . , d0)2, N Output: C = Md mod N R0 ← 1 R1 ← M for i ← x to 0 do R0 ← R02 mod N if (di = 1) then R0 ← R0 · R1 mod N end end return R0

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 9 / 37

slide-10
SLIDE 10

Simple Power Analysis Attacking an Algorithm

Simple Power Analysis (SPA)

Individual operations can potentially be identified.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 10 / 37

slide-11
SLIDE 11

Simple Power Analysis Reverse Engineering

Reverse Engineering with SPA

For example, cryptographic algorithms can be located in a power consumption trace because of the repeating rounds. In this case an implementation of AES on an ARM microprocessor — Nine identical rounds and a shorter tenth round.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 11 / 37

slide-12
SLIDE 12

Simple Power Analysis Reverse Engineering

Reverse Engineering with SPA

A closer analysis can determine the functions within a round, e.g.:

◮ Two initial permutations to reformat the message and key into a format

convenient for calculating.

◮ ByteSub function (a bytewise substitution), MixColumn and key schedule.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 12 / 37

slide-13
SLIDE 13

Differential Power Analysis

Outline

1

Introduction What is a Smart Card? Why use Smart Cards?

2

Measuring the Power Consumption The Experimental Setup

3

Simple Power Analysis Attacking an Algorithm Attacking an Algorithm Reverse Engineering

4

Differential Power Analysis Correlation Power Analysis Using the Partial Correlation Case Study: The DES block cipher

5

Fault Analysis Case Study: The DES block cipher

6

Countermeasures

7

Other Problems

8

Conclusion

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 13 / 37

slide-14
SLIDE 14

Differential Power Analysis

Differential Power Analysis

A statistical analysis of power consumption traces can be conducted with a series of acquisitions.

◮ Differential Power Analysis is often used as a generic term for any treatment

involving more than one trace.

A series of acquisitions will result in a series of traces and corresponding messages and ciphertexts. 01 B688EE57BB63E03EC031A0392DC881E6 02 185C881E64D7751A0392DC887509F36F 03 EE2DC88750957B673B63185C881E64E0 . . . . . .

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 14 / 37

slide-15
SLIDE 15

Differential Power Analysis

Differential Power Analysis

Looking closely at superposed traces, small differences can be

  • bserved.

Where the difference is either:

◮ Proportional to the Hamming weight of the data being manipulated

(Hamming weight model).

◮ Proportional to the Hamming weight of the data being manipulated

XORed with some unknown constant previous state (Hamming distance model).

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 15 / 37

slide-16
SLIDE 16

Differential Power Analysis Correlation Power Analysis

Correlation Power Analysis

Where a given byte of a message is manipulated can be determined by calculating the correlation between that byte and the instantaneous power consumption. For example correlating the first byte of 1000 random plaintexts enciphered using AES:

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 16 / 37

slide-17
SLIDE 17

Differential Power Analysis Correlation Power Analysis

Correlation Power Analysis

To attack an implementation of a cryptographic algorithm using the correlation, one needs to predict the data being manipulated by the device during the computation of the algorithm. Knowing the secret key the output of one byte of the ByteSub can be computed and a correlation trace generated.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 17 / 37

slide-18
SLIDE 18

Differential Power Analysis Correlation Power Analysis

Correlation Power Analysis

If the key is unknown, all possible key values that affect the first byte ByteSub need to be considered, i.e. one key byte. A correlation trace can be generated for the each possible value of the key byte.

◮ A trace will also be necessary for each previous state if the device

conforms to the Hamming distance model.

The correct hypothesis should give the largest correlation.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 18 / 37

slide-19
SLIDE 19

Differential Power Analysis Using the Partial Correlation

Using the Partial Correlation

An attacker is obliged to predict a machine word that is being manipulated to be sure of their results. This is prohibitively time consuming for platforms with large word sizes, e.g. 32-bit platforms, FPGA implementations. The partial correlation can be used to determine portions of the data being manipulated to eliminate certain hypotheses. For a hardware DES implementation on a smart card the first 48-bit subkey can be determined by correlating with the 32-bit word produced by the output of the S-boxes (traces donated by Gemalto).

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 19 / 37

slide-20
SLIDE 20

Differential Power Analysis Case Study: The DES block cipher

Case Study: The DES block cipher

The DES round function:

◮ Kn is 48-bits. ◮ Reduced to 32-bits after the S-box function. ◮ In hardware the S-box function can be applied to the 48-bits at the

same point in time.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 20 / 37

slide-21
SLIDE 21

Differential Power Analysis Case Study: The DES block cipher

Case Study: The DES block cipher

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 21 / 37

slide-22
SLIDE 22

Fault Analysis

Outline

1

Introduction What is a Smart Card? Why use Smart Cards?

2

Measuring the Power Consumption The Experimental Setup

3

Simple Power Analysis Attacking an Algorithm Attacking an Algorithm Reverse Engineering

4

Differential Power Analysis Correlation Power Analysis Using the Partial Correlation Case Study: The DES block cipher

5

Fault Analysis Case Study: The DES block cipher

6

Countermeasures

7

Other Problems

8

Conclusion

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 22 / 37

slide-23
SLIDE 23

Fault Analysis

Fault Analysis

“Jolt” the smart card off its normal processing. Exploit any information that might be revealed. E.g. glitches.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 23 / 37

slide-24
SLIDE 24

Fault Analysis

Fault Analysis

  • r white light flashes or laser light.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 24 / 37

slide-25
SLIDE 25

Fault Analysis Case Study: The DES block cipher

Case Study: The DES block cipher

If we consider the last round. R16 = S(R15 ⊕ K16) ⊕ L15 = S(L16 ⊕ K16) ⊕ L15

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 25 / 37

slide-26
SLIDE 26

Fault Analysis Case Study: The DES block cipher

Case Study: The DES block cipher

If a fault occurs in R15 to produce R′

15.

R16 = S(R15 ⊕ K16) ⊕ L15 R′

16

= S(R′

15 ⊕ K16) ⊕ L15

= S(L16 ⊕ K16) ⊕ L15 = S(L′

16 ⊕ K16) ⊕ L15

The results can be compared by XORing R16 with R′

16.

R16 ⊕ R′

16 = S(L16 ⊕ K16) ⊕ L15 ⊕ S(L′ 16 ⊕ K16) ⊕ L15

= S(L16 ⊕ K16) ⊕ S(L′

16 ⊕ K16)

Where the only unknown is the key K16.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 26 / 37

slide-27
SLIDE 27

Fault Analysis Case Study: The DES block cipher

Case Study: The DES block cipher

Gives a list of possible key values 227. Leads to an exhaustive search. Number of hypotheses can be further reduced by injecting a fault to produce another R′

16.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 27 / 37

slide-28
SLIDE 28

Countermeasures

Outline

1

Introduction What is a Smart Card? Why use Smart Cards?

2

Measuring the Power Consumption The Experimental Setup

3

Simple Power Analysis Attacking an Algorithm Attacking an Algorithm Reverse Engineering

4

Differential Power Analysis Correlation Power Analysis Using the Partial Correlation Case Study: The DES block cipher

5

Fault Analysis Case Study: The DES block cipher

6

Countermeasures

7

Other Problems

8

Conclusion

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 28 / 37

slide-29
SLIDE 29

Countermeasures

Countermeasures

The principles of the countermeasures used to prevent the attacks presented are well understood. In the case of fault attacks the countermeasure consists of redundance, and sensors to detect attacks. The most basic side channel countermeasure is to implement everything such that an algorithm is computed in constant time, and uses the same code irrespective of the data entered, i.e. no data dependent branching. A common countermeasure for removing the correlation between known,

  • r guessable, information and the power consumption is data masking.

◮ I.e. the function,

y = f (x) can be replaced with y ⊕ r = f ′(x ⊕ r) or, alternatively y ⊕ r = f ′(x ⊕ r, r) where r is a random value generated each time f ′ is computed.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 29 / 37

slide-30
SLIDE 30

Countermeasures

Countermeasures

All the hardware countermeasures are beyond the scope of this presentation. A physical shield can be used to prevent inspection and reverse engineering.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 30 / 37

slide-31
SLIDE 31

Countermeasures

Countermeasures

In the case of RSA, this takes the form. Algorithm 2: Randomised Exponentiation Algorithm Input: M, d, N, small random values r1, r2, r3 Output: C = Md mod N M′ ← M + r1 · N d′ ← d + r2 · λ(N) N′ ← r3 · N C ′ ← M′d′ mod N′ C ← C ′ mod N return C where λ is Euler’s Totient function.

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 31 / 37

slide-32
SLIDE 32

Countermeasures

Countermeasures

Other countermeasures can also be included to make life as difficult for the attacker as possible. The order that a given function processes information can be randomised, e.g. randomising the order bytes are accessed in the ByteSub function of AES.

◮ This also prevents some higher-order attacks that attempt to remove

data masking by comparing different points in the same trace, but these attacks are largely theoretical.

Random delays in either software (dummy loops) or hardware (dummy clock cycles) can be used to force an attacker to resynchronise their acquisitions a posteriori.

◮ This is a relatively trivial task but can be time consuming. Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 32 / 37

slide-33
SLIDE 33

Other Problems

Outline

1

Introduction What is a Smart Card? Why use Smart Cards?

2

Measuring the Power Consumption The Experimental Setup

3

Simple Power Analysis Attacking an Algorithm Attacking an Algorithm Reverse Engineering

4

Differential Power Analysis Correlation Power Analysis Using the Partial Correlation Case Study: The DES block cipher

5

Fault Analysis Case Study: The DES block cipher

6

Countermeasures

7

Other Problems

8

Conclusion

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 33 / 37

slide-34
SLIDE 34

Other Problems

Wrong Cryptographic Design

Short keys. Weak algorithms. Broken protocols Examples

◮ French Carte Bleu ◮ COMP128 used in GSM Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 34 / 37

slide-35
SLIDE 35

Conclusion

Outline

1

Introduction What is a Smart Card? Why use Smart Cards?

2

Measuring the Power Consumption The Experimental Setup

3

Simple Power Analysis Attacking an Algorithm Attacking an Algorithm Reverse Engineering

4

Differential Power Analysis Correlation Power Analysis Using the Partial Correlation Case Study: The DES block cipher

5

Fault Analysis Case Study: The DES block cipher

6

Countermeasures

7

Other Problems

8

Conclusion

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 35 / 37

slide-36
SLIDE 36

Conclusion

Conclusion

Smart cards are like any security devices: they have limitations. A system should be designed with these limitations in mind. A system should be upgradeable to deal with the (inevitable?) security breach or the aging of the technology

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 36 / 37

slide-37
SLIDE 37

Conclusion

Comments/Questions?

http://www.geocities.com/mike.tunstall/

Michael Tunstall (UCC, Ireland) Physical Security of Smart Cards March 5, 2008 — Limerick 37 / 37