differential power analysis (dpa) with key ranking and … · 2019. 6. 13. · round functionf ak...

46
Differential Power Analysis (DPA) With Key Ranking and Enumeration Martijn Stam COINS Winterschool in Finse, May

Upload: others

Post on 10-Nov-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

Differential Power Analysis (DPA)With Key Ranking and Enumeration

Martijn Stam

COINS Winterschool in Finse, May 2019

Page 2: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

The Rise of Side-Channels The Ideal World 2

Modern CryptologyFrom Katz and Lindell’s Classic Textbook

Three Principles

1 Formal Definitions: “giving a clear descriptionof what threats are in scope and what securityguarantees are desired”

2 Precise Assumptions: “that are simpler to state,since [they] are easier to study and (potentially)refute”

3 Proofs of Security: “that a construction satisfiesa definition under certain specifiedassumptions”

Page 3: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

The Rise of Side-Channels The Ideal World 3

FDH-RSA CryptosystemBlack-box perspective of chosen-message attacks

A

(N, d, e)←$Kg S ← H(M)d mod N

M S

M ,S

N, e

Adveuf-cmaFDH−RSA(A) = Pr

[Se mod N = H(M), M fresh

]

Page 4: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

The Rise of Side-Channels The Real World 4

The Rise of Side-ChannelsPaul Kocher’s Revolution

https://www.paulkocher.com/

1996 Timing Attacks1999 Simple and Di�erential Power Analysis

(DPA)(w. Joshua Ja�e & Benjamin Jun)

2016 https://www.youtube.com/watch?v=6lt7ExN6Kw4

Power Analysis

Measuring power consumption over time allows (relatively)easy recovery of secret keys

Page 5: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

The Rise of Side-Channels The Real World 5

SPA: Simple Power AnalysisA Simple Attack Against Unprotected RSA

What is SPASPA exploits data-dependent di�erences in power consumption of a singleoperation to recover secret information.

S ← H(m)d mod N

s← 1, x ← H(m)

while d > 0if d odd thens← s · x mod N

x ← x2 mod Nd← bd/2c

Simple Attack

Assume you can tell multiplicationsand squarings apart.So you observe something likeSMSSMSSMCorresponds to exponent(10101)2 = 21

Page 6: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

The Rise of Side-Channels The Real World 6

DPA: Differential Power AnalysisThe workhorse of side-channel attacks

What is DPADPA exploits data-dependent correlation in power consumption overmultiple, related operations to recover secret information.

Power of DPAAny unprotected implementation will eventually be susceptible.

CountermeasuresAll implementations will need protection against side channels.

Page 7: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

The Rise of Side-Channels The Real World 7

Power Analysis AttacksStefan Mangard, Elisabeth Oswald, and Thomas Popp’s Classic

Revealing the Secrets of Smart Cards

“first comprehensive treatment of poweranalysis attacks and countermeasures”Aimed at the practitionerFrom 2007⇒ nomodern ideas and theory

Page 8: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

Outline

1 How Di�erential Power Attacks WorkOur SettingA Typical Pipeline for Key RecoveryProfiled Attack Example

2 Key Enumeration and RankingEnumerationRanking

3 ConclusionWant to Learn More?

Page 9: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 9

Modern CryptologyBlack-box Blockciphers

What is a Blockcipher

A blockcipherE is family of keyed permutations

E : {0, 1}k × {0, 1}n → {0, 1}n

where k is the key length and n the block length

Blockcipher Usage

Use amode-of-operation like GCM to create an encryption schemeGCM security proof assumes the blockcipherE is a “PRP”SoE is treated as a black boxWhat happens if you can see it “work”?

Page 10: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 10

Modern CryptologyAES-128

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Round function f

AK SB

S

xxxx

SR

C ←M× C

xx

xx

MC

wi−1 xi yi zi wi

Design

k = 128, n = 128, where 128 = 16× 8 (16 bytes)10 rounds of whitened SP networkNon-linearity comes from bytewise S-boxes

Images: TikZ for Cryptographers, Jérémy Jean, www.iacr.org/authors/tikz/

Page 11: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 11

SCALE: A Resource by Dan Pagehttps://github.com/danpage/scale

Side-Channel Attack Lab. ExercisesProvides a suite of material related to side-channel(and fault) attacks that is low-cost, accessible,relevant, coherent, and e�ective.

SCALE Data Sets

1 Four platforms: an Atmel atmega328p (an AVR) plus three NXP ARMCortex-M processors

2 Implementation uses an 8-bit datapath and look-up tables for theS-box and xtime operations (but code not known)

3 2× 1000 traces of AES-128 each (known vs. unknown key)4 Traces acquired using a Picoscope 2206B, using triggers for alignment

Page 12: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 12

Plotting a TraceSCALE’s AES-128 on an Atmel

0 20000 40000 60000 80000 100000 120000

0.4

0.2

0.0

0.2

0.4

A full trace k = 2B7E151628AED2A6ABF7158809CF4F3CTotal of 132, 292 pointsYou can see a pattern repeating roughly 10 times

Page 13: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 13

Finding the RoundsUsing crosscorrelation

0 50000 100000 150000 200000 250000

0

200

400

600

800

1000

1200

Crosscorrelation of a traceCompares howwell shi�s of the trace match the original

ci =∑j

ajai+j

Leads to round duration of 12421

Page 14: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 13

Finding the RoundsUsing crosscorrelation

0 2000 4000 6000 8000 10000 120000.5

0.4

0.3

0.2

0.1

0.0

0.1

0.2

0 2000 4000 6000 8000 10000 12000

0.1

0.0

0.1

0.2

0.3

Plotting the Rounds Jointly

Left Rounds 1 and 2 superimposedRound 1 is building up power

Right Rounds 5 and 6 superimposedPeaks and jittery areas match well

Page 15: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 14

Plotting a TraceSCALE’s AES-128 on an Atmel

26000 28000 30000 32000 34000 36000 38000

0.1

0.0

0.1

0.2

0.3

3rd round close up

1 Some peaks, some jitter2 Hard to really discern much of interest...

Page 16: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 15

Signal versus NoiseWhat determines the power consumption?

26000 28000 30000 32000 34000 36000 38000

0.1

0.0

0.1

0.2

0.3

Engineer’s Perspective (MOP, Ch. 4)

Ptotal = Pop + Pdata + Pel. noise + Pconst

Pop d.o. the operationPdata d.o. the data

Pel. noise electrical noisePconst constant base

Page 17: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 15

Signal versus NoiseWhat determines the power consumption?

26000 28000 30000 32000 34000 36000 38000

0.1

0.0

0.1

0.2

0.3

Engineer’s Perspective (MOP, Ch. 4)

Pop + Pdata = Pexp + Psw. noise

Pop d.o. the operationPdata d.o. the data

Pexp exploitable signalPsw. noise switching noise

Page 18: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 15

Signal versus NoiseWhat determines the power consumption?

26000 28000 30000 32000 34000 36000 38000

0.1

0.0

0.1

0.2

0.3

Engineer’s Perspective (MOP, Ch. 4)

Ptotal = Pexp + Psw. noise + Pel. noise + Pconst

Pel. noise electrical noisePconst constant base

Pexp exploitable signalPsw. noise switching noise

Page 19: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 15

Signal versus NoiseWhat determines the power consumption?

26000 28000 30000 32000 34000 36000 38000

0.1

0.0

0.1

0.2

0.3

Theoretician’s Perspective

Ptotal = f(data) +N (0, σ)

f(data)mainly models Pexp, function f incorporates Pop and Pconstσ depends on Psw. noise and Pel. noise

Page 20: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 15

Signal versus NoiseWhat determines the power consumption?

26000 28000 30000 32000 34000 36000 38000

0.1

0.0

0.1

0.2

0.3

Some Caveats1 Which operations are performed on which registers can be relevant2 Looking at multiple points might lead to multivariate dependencies3 Sometimes noise levels (σ) are data-dependent4 The function f and noise level σ are unknown

Page 21: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 15

Signal versus NoiseWhat determines the power consumption?

0 20000 40000 60000 80000 100000 120000

0.4

0.2

0.0

0.2

0.4

0 20000 40000 60000 80000 100000 1200000.000

0.001

0.002

0.003

0.004

0.005

0.006

0.007

0.008

Atmel AES, Based on 1000 traces

Assuming no branches in the executionLeft Pointwise sample mean: Pconst + PopRight Pointwise sample variance: Pdata + Pel. noise

Both Pexp and Psw. noise depend on your target...

Page 22: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 16

Signal versus NoiseIntermediate values and target selection

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Round function f

AK SB

S

xxxx

SR

C ←M× C

xx

xx

MC

wi−1 xi yi zi wi

The Locality of Leakage

Intermediate value:the (few) byte(s) involved in aspecific operationLocality assumption:leakage primarily depends on theintermediate value operated upon

26000 28000 30000 32000 34000 36000 38000

0.1

0.0

0.1

0.2

0.3

Page 23: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 16

Signal versus NoiseIntermediate values and target selection

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Round function f

AK SB

S

xxxx

SR

C ←M× C

xx

xx

MC

wi−1 xi yi zi wi

The Locality of Leakage

Intermediate value:the (few) byte(s) involved in aspecific operationLocality assumption:leakage primarily depends on theintermediate value operated upon

Target intermediatevalue captured byPexpThe “rest”contributes toPsw. noise

Page 24: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 16

Signal versus NoiseIntermediate values and target selection

5500 6000 6500 7000 7500 8000 8500

0.03

0.02

0.01

0.00

0.01

0.02

0.03

0.04 000FF0FF

5500 6000 6500 7000 7500 8000 8500

0.06

0.04

0.02

0.00

0.02

0.04

000FF0FF

First Round, Byte Pos. “0”, keybyte 2B

Left Average leakage based on select plaintext valuesRight Average leakage based on select sbox inputs

Initial peak correlates more with plaintextFinal peak correlates more with sbox input

Page 25: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 17

SNR: Signal to Noise RatioVisualizing “Simple” Leakage

Mangard’s SNR

Recall we said Ptotal = f(data) +N (0, σ)f(data) is called the signal, the other term the noise

SNR =Var(signal)Var(noise)

=Vardatafσ2

Page 26: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 17

SNR: Signal to Noise RatioVisualizing “Simple” Leakage

2000 4000 6000 8000 10000 12000 140000

5

10

15

20

Round 1 SNRs, sample estimate

16 Sbox inputs as separate targetsFixed key, so equivalent to 16 plaintext bytesClearly see the di�erent bytes leak repeatedly, one a�er the other

Page 27: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 17

SNR: Signal to Noise RatioVisualizing “Simple” Leakage

5500 6000 6500 7000 7500 80000

5

10

15

20

Round 1 SNRs, zoom in

Clearly see the di�erent bytes leak repeatedly, one a�er the otherPeaks di�er in heightAt the bases consecutive bytes leak jointly

Page 28: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 18

Hamming Weight and Hamming DistanceTwo Common Leakage Models

Hamming Weight

Power consumption is linear in the Hamming weight of the target data

f(data) = a · HW(data) + b

Correspond to model where power depends primarily on “setting” bits

Hamming Distance

Power consumption is linear in the Hamming distance of the target datainput with the output

f(data) = a · HD(datain, dataout) + b

Correspond to model where power depends primarily on “flipping” bits

Page 29: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 19

SNR: Signal to Noise RatioAES Atmel Hamming Leakage

2000 4000 6000 8000 10000 12000 140000.0

2.5

5.0

7.5

10.0

12.5

15.0

17.5

20.0

2000 4000 6000 8000 10000 12000 140000

2

4

6

8

10

12

14

16

Round 1, “0” byte SNR vs Sbox input Hamming weight

plaintext Hamming weight (right)Explains the third SNR peak (le�)No non-linearity⇒ hard to exploit

Page 30: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work Our Setting 19

SNR: Signal to Noise RatioAES Atmel Hamming Leakage

2000 4000 6000 8000 10000 12000 140000.0

2.5

5.0

7.5

10.0

12.5

15.0

17.5

20.0

2000 4000 6000 8000 10000 12000 140000

1

2

3

4

5

6

Round 1, “0” byte SNR vs Sbox output Hamming weight

Sbox input Hamming weight (right)Explains the final two SNR peaks (le�)Non-linearity⇒ exploitable for key recovery

Page 31: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 20

Kerckhoffs PrincipleKnown Knowns and Unkown Unknowns

Kerckhoffs’s Principle

A cryptosystem’s security shouldreside in the the secrecy of its keys (known unknown)without any need to keep the cryptosystem secure (known known)

What about Implementations

What device is being used?Which cryptosystem is implemented how?Auxiliary inputs (plaintexts/ciphertexts/randomness)?But what about the leakage such as power consumption?

Page 32: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 20

Kerckhoffs PrincipleKnown Knowns and Unkown Unknowns

Kerckhoffs’s Principle

A cryptosystem’s security shouldreside in the the secrecy of its keys (known unknown)without any need to keep the cryptosystem secure (known known)

What about Power Consumption?

Realistically, even if you knowwhat operations are being performed, how adevice leaks is too unpredictable (unknown unknown).Not-Quite-Kerckho� Principle

Page 33: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 21

Different Adversarial ScenariosNot-Quite-Kerckhoffs Principle

A

K∗ ←$ Kg

Leak←$L

assert Leak ∈ L

C ← EK∗ (X)

L←$ Leak(K∗, X)

L← Leak(K,X)

K

The naked guess-the-key game: AdvkrE (A) = Pr

[K∗ = K

]

Page 34: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 21

Different Adversarial ScenariosNot-Quite-Kerckhoffs Principle

A

K∗ ←$ Kg

Leak←$L

assert Leak ∈ LC ← EK∗ (X)

L←$ Leak(K∗, X)

Leak, X L

L← Leak(K,X)

K

The adversary selects how the leakage is derived

Page 35: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 21

Different Adversarial ScenariosNot-Quite-Kerckhoffs Principle

A

K∗ ←$ KgLeak←$L

assert Leak ∈ L

C ← EK∗ (X)

L←$ Leak(K∗, X)

X L

Leak

L← Leak(K,X)

K

The adversary knows exactly how tomodel the leakage

Page 36: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 21

Different Adversarial ScenariosNot-Quite-Kerckhoffs Principle

A

K∗ ←$ KgLeak←$L

assert Leak ∈ L

C ← EK∗ (X)

L←$ Leak(K∗, X)

X L

L← Leak(K,X)

K,X

L

K

The adversary learns how the leakage profile θ looks:Leak(data) ≈ Mθ(data)

Page 37: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 21

Different Adversarial ScenariosNot-Quite-Kerckhoffs Principle

A

K∗ ←$ KgLeak←$L

assert Leak ∈ L

C ← EK∗ (X)

L←$ Leak(K∗, X)

X L

L← Leak(K,X)

K

The adversary infers a leakage modelM:Leak(data) ≈ M(data)

Page 38: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 21

Different Adversarial ScenariosNot-Quite-Kerckhoffs Principle

Different Scenarios1 The adversary selects how the leakage is derivedincludes leakage-resilience and formal probingmodels

2 The adversary knows exactly how tomodel the leakageused for simulated leakage models

3 The adversary learns how the leakage profile lookscaptures real-life profiled attacks

4 The adversary infers a leakage modelcaptures real-life attackswithout profiling

Caveat: “Stronger” models (higher in the list) tend to be relative to less real-istic and potentially “weaker” forms of leakage

Page 39: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 22

A Typical Side-Channel Attack Pipeline

A Acquire training datacontrol over keys and plaintextssignal processing to clean up traces

B Build a profile1 select features or PoIs2 fix modelM, estimate parameters θ

C Collect target tracesunknown target key, known plaintextsuse signal processing as before

D Distinguish1 extract features or PoIs2 using modelM and parameters θ,for each key candidate,compute distinguishing score

Page 40: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 23

A Typical Side-Channel Attack PipelineAcquisition and Collection

Experimental setup

Use oscilloscope to measure power(Optional) Use triggers to align dataUse signal processing to clean up raw trace

⇐ see the textbook for details!

Page 41: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 24

A Typical Side-Channel Attack PipelineFeature Extraction and Points of Interest

2000 4000 6000 8000 10000 12000 140000.5

0.4

0.3

0.2

0.1

0.0

0.1

0.2

2000 4000 6000 8000 10000 12000 140000.0

2.5

5.0

7.5

10.0

12.5

15.0

17.5

20.0

Where does a target intermediate leak?

An intermediate leaks mostly where it is being usedGood to identify where this isThen reduce dimension of interesting points if possible

Easiest is to select a point of interest

Page 42: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 25

A Typical Side-Channel Attack PipelineBuild a Model, Profiling

2000 4000 6000 8000 10000 12000 140000

2

4

6

8

10

12

14

16

2000 4000 6000 8000 10000 12000 140000

1

2

3

4

5

6

How does a target intermediate leak?

Assume Leak(data) = Mθ(data) for knownmodelMEstimate the “real” parameters θ by θ

Page 43: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 26

A Typical Side-Channel Attack PipelineBuild a Model, Profiling

Lessons from Machine Learning

Suppose the real leakage follows data-dependent distribution Leak(data)1 Assume that unknown Leak(data) follows knownmodel Mwithunknown parameters θ

Leak(data) ≈ Mθ(data)

2 Estimate the “real” parameters θ by θ

Mθ(data) ≈ Mθ(data)

Warning: More complex models have smallermodelling errors (first point)at the expense of larger estimation errors (second point)

Page 44: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 27

A Typical Side-Channel Attack PipelineDistinguish using Divide-and-Conquer

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Round function f

AK SB

S

xxxx

SR

C ←M× C

xx

xx

MC

wi−1 xi yi zi wi

Divide-and-Conquer

Idea: Recover each subkey byte separatelyFor all 256 candidates, calculate a distinguishing scoreThe lowest (or highest) score indicates the likely true subkey byte

Guess all 16 subkey bytes correctly⇔ guess the AES key correctly

Page 45: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 27

A Typical Side-Channel Attack PipelineDistinguish using Divide-and-Conquer

k0 score0 0.123. . .1 0.127. . ....

...255 0.238. . .

k1 score0 0.134. . .1 0.116. . ....

...255 0.098. . .

. . .

k15 score0 0.184. . .1 0.167. . ....

...255 0.152. . .

Divide-and-Conquer

Idea: Recover each subkey byte separatelyFor all 256 candidates, calculate a distinguishing scoreThe lowest (or highest) score indicates the likely true subkey byte

Guess all 16 subkey bytes correctly⇔ guess the AES key correctly

Page 46: Differential Power Analysis (DPA) With Key Ranking and … · 2019. 6. 13. · Round functionf AK SB S x x x x SR CM x x x x MC The Locality of Leakagew i i1 x y i z w Intermediatevalue:

How Di�erential Power Attacks Work A Typical Pipeline for Key Recovery 27

A Typical Side-Channel Attack PipelineDistinguish using Divide-and-Conquer

k0 score0 0.123. . .1 0.127. . ....

...255 0.238. . .

k1 score0 0.134. . .1 0.116. . ....

...255 0.098. . .

. . .

k15 score0 0.184. . .1 0.167. . ....

...255 0.152. . .

Distinguishing Scores using Leak(data) ≈ Mθ(data)

1 Assume data relevant for leakage only depends on one subkey(easiest to attack AES first or last round)

2 For each 256 possibilities and each trace,calculate how the modelled leakage would look

3 Compare modelled leakage with observed trace, combine into score