31
Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏

Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Side Channel AttackOn AES

GROUP5:楊政道、黃郁傑、林宸熏

Page 2: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

CONTENTS

01 AES review

02 Side channel attacks

03 demo

04 conclusion

Page 3: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

01 AES

Page 4: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

FOUR STEPS

MixColumns

ShiftRows

SubBytes

ADDRoundKey

Page 5: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

AddRoundKey

Oringal matrixXOR

output1

Page 6: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

SubBytes

output1 output2

Page 7: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

GF(28) = GF(2)[x]/(x8 + x4 + x3 + x + 1)

Page 8: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

ShiftRows

Page 9: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

MixColumns

Page 10: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Side channel attack

Page 11: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Simple Power Analysis (SPA)

visual examination of graph

Variations of power occur as the device performs different operations

Page 12: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Differential Power Analysis (DPA)

Correlation Power Analysis is a kind of DPA

Statistically analyzing power consumption measurements from a cryptosystem.

Power varying while hardware performing operations using secret keys.

Page 13: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Steps of CPA

01

Get the victim to encrypt different plaintexts. Record traces of the power consumption.02

03

04

Write down a model for the victim's power consumption.

Attack small parts (subkeys) of the secret key

Put together the best subkeys guessed to obtain the full secret key.

Page 14: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

K7

P7

S

Byte 7 of Secure Key

Byte 7 of Plaintext

X-OR

S-Box

Sensitive point we attack: Power(Sbox(plaintext⊕key))

Attack Subkey (measure power of target)

2128 possibilities turn into 16 * 28 possibilities for AES-128

Page 15: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Using Hamming Weight model

Hamming weight of a value is the number of non-zeroes.

Ex: in the binary number 1100 0010 the Hamming weight would be 3

Why use Hamming Wight model?

Because assuming “the number of bits set to 0 or 1 of an output is

correlated with the power consumption of a device”.

HW(Sbox(plaintext⊕key))

Page 16: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Implementation of CPA

Plaintexts

AES chip

Power predictmodel

Measured power traces

Predicted power values

1a f5 78 … e5c3 58 2a … bc

Statistical calculation

Page 17: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Picking a Subkey (stastical calculation)

This correlation coefficient will always be in the range [-1, 1]. It describes how closely the random variables X and Y are related:

If Y always increases when X increases, it will be 1;If Y always decreases when X increases, it will be -1;If Y is totally independent of X, it will be 0.

Page 18: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Picking a Subkey (stastical calculation)

we'll have D power traces t, and each of these traces will have T data points.

td,j refer to point j in trace d ( 1 ≤ d ≤ D, 0 ≤ j ≤ T )

We'll say that there are I different subkeys that we want to try.

hd,i refer to point j in trace d ( 1 ≤ d ≤ D, 0 ≤ i ≤ I )

For each subkey i, find the highest value of |ri,j|, then find the maximum |ri|,

Page 19: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

CPA result

If success to get the correct key…

Page 20: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

DEMO&Result

Page 21: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

simpleserial.cmakefile aes_sbox.c

aes_enc.caes-independant.c

Trace codes

simpleserial-aes.c

Page 22: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Linear s-box

Nonlinear s-box

Page 23: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Linear

Nonlinear

Key:fixedPlaintext:Random

Page 24: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

SPA

Page 25: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

KEY:2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C

nonlinear Form subkey 0 ~ subkey 15

numtraces:157

linear

numtraces:157

Page 26: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

WHY

linear

1. The correlation between any two intermediate values from different keys is high

Key1model {S(p⊕k1)}HW

high correlation {S(p⊕ktrue)}p

guess

Key1

For Linear S-box

Key2 model {S(p⊕k2)}HW

Key1model {S(p⊕k1)}HW

high correlation

{S(p⊕ktrue)}pguess

Don’t know

Page 27: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

WHY

nonlinear

1. The intermediate values are not random enough

Key1model {S(p⊕k1)}HW

high correlation {S(p⊕ktrue)}p

guess

Key1

Page 28: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Future work

Page 29: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Problem

CPA works because an attacker can predict an intermediate value,

which is dependent on the processed data and cypher key

Page 30: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Method—Masking --- randomize the intermediate value

1.Masking the intermediate values

2.Achieved by adding a random mask to the input of the algorithm

4. At the end of the algorithm, the mask is removed to get the correct result

3. All intermediate values are randomized automatically

the attacker is unable to predict intermediate value

Page 31: Side Channel Attack On AES - PUFsecurity Blog · 2020. 2. 18. · Side Channel Attack On AES GROUP5:楊政道、黃郁傑、林宸熏. CONTENTS 01 AES review 02 Side channel attacks

Thanks for listening