Singular curve point decompression attack Peter Gnther joint work - - PowerPoint PPT Presentation

singular curve point decompression attack
SMART_READER_LITE
LIVE PREVIEW

Singular curve point decompression attack Peter Gnther joint work - - PowerPoint PPT Presentation

Singular curve point decompression attack Peter Gnther joint work with Johannes Blmer University of Paderborn FDTC 2015, September 13th, Saint Malo Peter Gnther (UPB) Decompression Attack FDTC 2015 1 / 18 Elliptic curves Example: E (


slide-1
SLIDE 1

Singular curve point decompression attack

Peter Günther

joint work with

Johannes Blömer

University of Paderborn

FDTC 2015, September 13th, Saint Malo

Peter Günther (UPB) Decompression Attack FDTC 2015 1 / 18

slide-2
SLIDE 2

Elliptic curves

Elliptic curve E(K)

Points (x, y) ∈ K2 that fulfill y2 = x3 + a4x + a6 with a4, a6 ∈ K and discriminant ∆ := −16(4a3

4 + 27a2 6) = 0.

Example: E(R) : y2 = x3 − 3x + 3 x y

Peter Günther (UPB) Decompression Attack FDTC 2015 2 / 18

slide-3
SLIDE 3

Elliptic curves as additive group

Example: E(R) : y2 = x3 − 3x + 3 x y T + P T P Group operation independent from a6: λ = yP − yT xP − xT xP+T = λ2 − xP − xT yP+T = λ(xP − xP+T) − yP

Peter Günther (UPB) Decompression Attack FDTC 2015 3 / 18

slide-4
SLIDE 4

Elliptic curves as additive group

Example: E(R) : y2 = x3 − 3x + 3 x y 2T T P Group operation independent from a6: λ = 3xT + a4 2yT x2T = λ2 − 2xT y2T = λ(xT − x2T) − yT

Peter Günther (UPB) Decompression Attack FDTC 2015 3 / 18

slide-5
SLIDE 5

Elliptic curve scalar multiplication and DLOG

Scalar multiplication: s ∈ N, P ∈ E(Fq): sP := P + P + · · · + P (s times)

P

s

sP

Peter Günther (UPB) Decompression Attack FDTC 2015 4 / 18

slide-6
SLIDE 6

Elliptic curve scalar multiplication and DLOG

Scalar multiplication: s ∈ N, P ∈ E(Fq): sP := P + P + · · · + P (s times) Discrete logarithm (DLOG): given P, Q = sP, compute s Assumption: complexity of DLOG problem exponential on elliptic curve ⇒ high security already for small Fq (e.g. 256 bit)

P

s

sP

s

Peter Günther (UPB) Decompression Attack FDTC 2015 4 / 18

slide-7
SLIDE 7

Elliptic curve scalar multiplication and DLOG

Scalar multiplication: s ∈ N, P ∈ E(Fq): sP := P + P + · · · + P (s times) Discrete logarithm (DLOG): given P, Q = sP, compute s Assumption: complexity of DLOG problem exponential on elliptic curve ⇒ high security already for small Fq (e.g. 256 bit) Important cryptographic primitive (ECDH, ECDSA, . . . )

P

s

sP

s s s

Peter Günther (UPB) Decompression Attack FDTC 2015 4 / 18

slide-8
SLIDE 8

Elliptic curve scalar multiplication and DLOG

Scalar multiplication: s ∈ N, P ∈ E(Fq): sP := P + P + · · · + P (s times) Discrete logarithm (DLOG): given P, Q = sP, compute s Assumption: complexity of DLOG problem exponential on elliptic curve ⇒ high security already for small Fq (e.g. 256 bit) Important cryptographic primitive (ECDH, ECDSA, . . . ) Adversarial environment: Physical protection of s required

P

s

sP

s s s

Peter Günther (UPB) Decompression Attack FDTC 2015 4 / 18

slide-9
SLIDE 9

Invalid point attack on scalar multiplication

E : y2 = x3 + a4x + a6

Outline of invalid point attacks

1 Group law does not require a6 2 Move P to weak curve with same a4 3 Obtain Q = sP for secret s on weak curve 4 Compute DLOG of Q to base P on weak curve 5 Infer DLOG s on original curve

Examples weak curve attacks

P on curve with smooth order P in small subgroup P on singular curve

Peter Günther (UPB) Decompression Attack FDTC 2015 5 / 18

slide-10
SLIDE 10

Singular curves with node (a4 = 0)

E(R) : y2 = x3 − 3x + 3 x y E(R) : y2 = x3 − 3x + 2, ∆ = 0 x y

Peter Günther (UPB) Decompression Attack FDTC 2015 6 / 18

slide-11
SLIDE 11

Singular curves with node (a4 = 0)

E(R) : y2 = x3 − 3x + 3 x y T + P T P E(R) : y2 = x3 − 3x + 2, ∆ = 0 x y T + P T P

Peter Günther (UPB) Decompression Attack FDTC 2015 6 / 18

slide-12
SLIDE 12

Singular curves with node (a4 = 0)

E(R) : y2 = x3 − 3x + 3 x y 2T T P E(R) : y2 = x3 − 3x + 2, ∆ = 0 x y 2T T P

Peter Günther (UPB) Decompression Attack FDTC 2015 6 / 18

slide-13
SLIDE 13

Singular curves with node (a4 = 0)

E(R) : y2 = x3 − 3x + 3 x y 2T T P E(R) : y2 = x3 − 3x + 2, ∆ = 0 x y 2T T P

Peter Günther (UPB) Decompression Attack FDTC 2015 6 / 18

ENS(Fq) ≃ subgroup of F∗

q or F∗ q2

⇒ DLOG problem subexponential

1 Map DLOG instance to F∗

q or F∗ q2

2 Solve DLOG in F∗

q or F∗ q2

slide-14
SLIDE 14

Singular curves with cusp (a4 = 0)

E(R) : y2 = x3 + 1 x y E(R) : y2 = x3, ∆ = 0 x y

Peter Günther (UPB) Decompression Attack FDTC 2015 7 / 18

slide-15
SLIDE 15

Singular curves with cusp (a4 = 0)

E(R) : y2 = x3 + 1 x y T + P T P E(R) : y2 = x3, ∆ = 0 x y + P T P

Peter Günther (UPB) Decompression Attack FDTC 2015 7 / 18

ENS(Fq) ≃ F+

q

⇒ DLOG problem trivial (by division)

1 Map DLOG instance to F+

q

2 Solve DLOG in F+

q

slide-16
SLIDE 16

Singular curve attack on scalar multiplication

For fixed a4, there are at most 2 corresponding singular curves Random faults will not provide points on singular curve How do we get a point onto one of them?

P

Peter Günther (UPB) Decompression Attack FDTC 2015 8 / 18

slide-17
SLIDE 17

Our approach: Point decompression

Compression

Compress : E(Fq) → Fq × {0, 1} (x, y) → (x, b) where b = LSB(y) Reduces bandwidth by 50% Defined in many standards like IEEE 1363, SEC 1, X9.62 Decompression prior to scalar multiplication

Peter Günther (UPB) Decompression Attack FDTC 2015 9 / 18

slide-18
SLIDE 18

Point compression

Decompress

Require: E : y2 = x3 + a4x + a6, (x, b) ∈ Fq × {0, 1} Ensure: (x, y) with y2 = x3 + a4x + a6

1: v ← x3 + a4x

⊲ v = x3 + a4x

2: v ← v + a6

⊲ v = x3 + a4x + a6

3: if √v ∈ Fq then 4:

v ← (−1)b√v ⊲ v = (−1)b x3 + a4x + a6

5:

return (x, y)

6: else 7:

return O

8: end if

Peter Günther (UPB) Decompression Attack FDTC 2015 10 / 18

slide-19
SLIDE 19

Point compression

Decompress

Require: E : y2 = x3 + a4x + a6, (x, b) ∈ Fq × {0, 1} Ensure: (x, y) with y2 = x3 + a6

1: v ← x3

⊲ v = x3

2: v ← v + a6

⊲ v = x3 + a6

3: if √v ∈ Fq then 4:

v ← (−1)b√v ⊲ v = (−1)b x3 + a6

5:

return (x, y)

6: else 7:

return O

8: end if

Peter Günther (UPB) Decompression Attack FDTC 2015 10 / 18

Similar implementations in IEEE 1363, SEC 1, X9.62, OpenSSL Implicit (partial) point validation: Decompress(x, b) ∈ E(Fq)

slide-20
SLIDE 20

Attack on decompression

Decompress

Require: E : y2 = x3 + a4x + a6, (x, b) ∈ Fq × {0, 1} Ensure: (x, y) with y2 = x3 + a4x + a6

1: v ← x3 + a4x

⊲ v = x3 + a4x

2: v ← v + a6

⊲ v = x3 + a4x + a6

3: if √v ∈ Fq then 4:

v ← (−1)b√v ⊲ v = (−1)b x3 + a4x + a6

5:

return (x, y)

6: else 7:

return O

8: end if

Peter Günther (UPB) Decompression Attack FDTC 2015 11 / 18

slide-21
SLIDE 21

Attack on decompression

Decompress with a4 = 0

Require: E : y2 = x3 + a4x + a6, (x, b) ∈ Fq × {0, 1} Ensure: (x, y) with y2 = x3 + a6

1: v ← x3

⊲ v = x3

2: v ← v + a6

⊲ v = x3 + a6

3: if √v ∈ Fq then 4:

v ← (−1)b√v ⊲ v = (−1)b x3 + a6

5:

return (x, y)

6: else 7:

return O

8: end if

Peter Günther (UPB) Decompression Attack FDTC 2015 11 / 18

slide-22
SLIDE 22

Attack on decompression

Decompress with a4 = 0 and with fault

Require: E : y2 = x3 + a4x + a6, (x, b) ∈ Fq × {0, 1} Ensure: (x, y) with y2 = x3 + a6

1: v ← x3

⊲ v = x3

2: v ← v + a6

⊲ v = x3 + a6

3: if √v ∈ Fq then 4:

v ← (−1)b√v ⊲ v = (−1)b x3 + a6

5:

return (x, y)

6: else 7:

return O

8: end if

Peter Günther (UPB) Decompression Attack FDTC 2015 11 / 18

slide-23
SLIDE 23

Attack on decompression

Decompress with a4 = 0 and with fault

Require: E : y2 = x3 + a4x + a6, (x, b) ∈ Fq × {0, 1} Ensure: (x, y) with y2 = x3 + a6

1: v ← x3

⊲ v = x3

2: v ← v + a6

⊲ v = x3 + a6

3: if √v ∈ Fq then 4:

v ← (−1)b√v ⊲ v = (−1)b x3 + a6

5:

return (x, y)

6: else 7:

return O

8: end if

Peter Günther (UPB) Decompression Attack FDTC 2015 11 / 18

Observation: x quadratic residue ⇒

  • utput on singular curve

y2 = x3

slide-24
SLIDE 24

Hash string to curve

Decompress: building block of other algorithms

MapToPoint : {0, 1}∗ → E(Fq)

Require: E : y2 = x3 + a4x + a6, H : {0, 1}∗ → Fq × {0, 1}, M ∈ {0, 1}∗, Ensure: P ∈ E(Fq)

1: i ← 0 2: repeat

⊲ until (x, b) is valid compression

3:

(x, b) ← H(M i)

4:

P ← Decompress(x, b)

5:

i ← i + 1

6: until P = O 7: return P

Peter Günther (UPB) Decompression Attack FDTC 2015 12 / 18

slide-25
SLIDE 25

Hash string to curve

Decompress: building block of other algorithms

MapToPoint : {0, 1}∗ → E(Fq)

Require: E : y2 = x3 + a4x + a6, H : {0, 1}∗ → Fq × {0, 1}, M ∈ {0, 1}∗, Ensure: P ∈ E(Fq)

1: i ← 0 2: repeat

⊲ until (x, b) is valid compression

3:

(x, b) ← H(M i)

4:

P ← Decompress(x, b)

5:

i ← i + 1

6: until P = O 7: return P

Peter Günther (UPB) Decompression Attack FDTC 2015 12 / 18

Atttack: Choose M such that H(M 0) = (x, b) with quadratic residue x.

slide-26
SLIDE 26

Properties of the attack

Features of the attack

Efficient, especially in the case a4 = 0 One shot: can be applied to exponentiation with nonce Applications:

Point decompression (encryption schemes) Hashing to curve (special signature schemes) Random point sampling (countermeasures)

Limitations of the attack

Access to Q = sP required For a4 = 0: stronger control over (x, b) required

Attack on plain Decompress still possible Attack on MapToPoint not possible

Peter Günther (UPB) Decompression Attack FDTC 2015 13 / 18

slide-27
SLIDE 27

Example application: BLS short signatures

Definition (BLS Signatures)

G1, G2 ⊆ E(Fq): cyclic groups of order r with generators P1 and P2 GT ⊆ F∗

q cyclic group of order r

pairing e : G1 × G2 → GT MapToPoint : {0, 1}∗ → E(Fq) KeyGen( · ):

1

Select s uniformly at random from [0, r − 1]

2

Output secret key s and public key Ps = sP2

Sign(M, s):

1

compute P = MapToPoint(M) ∈ G1

2

compute and output σ = sP as signature for M under s

Verify(M, σ, Ps): output 1 if and only if e(σ, P2) = e(MapToPoint(M), Ps).

Peter Günther (UPB) Decompression Attack FDTC 2015 14 / 18

slide-28
SLIDE 28

Example application: BLS short signatures

Definition (BLS Signatures)

G1, G2 ⊆ E(Fq): cyclic groups of order r with generators P1 and P2 GT ⊆ F∗

q cyclic group of order r

pairing e : G1 × G2 → GT MapToPoint : {0, 1}∗ → E(Fq) KeyGen( · ):

1

Select s uniformly at random from [0, r − 1]

2

Output secret key s and public key Ps = sP2

Sign(M, s):

1

compute P = MapToPoint(M) ∈ G1

2

compute and output σ = sP as signature for M under s

Verify(M, σ, Ps): output 1 if and only if e(σ, P2) = e(MapToPoint(M), Ps).

Peter Günther (UPB) Decompression Attack FDTC 2015 14 / 18

slide-29
SLIDE 29

Example application: BLS short signatures

Definition (BLS Signatures)

G1, G2 ⊆ E(Fq): cyclic groups of order r with generators P1 and P2 GT ⊆ F∗

q cyclic group of order r

pairing e : G1 × G2 → GT MapToPoint : {0, 1}∗ → E(Fq) KeyGen( · ):

1

Select s uniformly at random from [0, r − 1]

2

Output secret key s and public key Ps = sP2

Sign(M, s):

1

compute P = MapToPoint(M) ∈ G1

2

compute and output σ = sP as signature for M under s

Verify(M, σ, Ps): output 1 if and only if e(σ, P2) = e(MapToPoint(M), Ps).

Peter Günther (UPB) Decompression Attack FDTC 2015 14 / 18

Very efficient with Barreto-Naehrig (BN) curves: E : y2 = x3 + a6 Note: a4 = 0

slide-30
SLIDE 30

Attack: Proof of concept realization

Target: BLS short signatures of Relic toolkit on AVR

Target hardware: Atmel AVR Xmega A1 Target software: Relic toolkit

Open source Prime and binary field arithmetic NIST and pairing-friendly curves including BN curves Bilinear maps and related extension fields Cryptographic protocols including BLS short signatures

Attack: Second order instruction skip attack

First fault: decompress to singular curve Second fault: remove point validation countermeasure

Peter Günther (UPB) Decompression Attack FDTC 2015 15 / 18

slide-31
SLIDE 31

Attack: Proof of concept realization

Target: BLS short signatures of Relic toolkit on AVR

Target hardware: Atmel AVR Xmega A1 Target software: Relic toolkit

Open source Prime and binary field arithmetic NIST and pairing-friendly curves including BN curves Bilinear maps and related extension fields Cryptographic protocols including BLS short signatures

Attack: Second order instruction skip attack

First fault: decompress to singular curve Second fault: remove point validation countermeasure

Peter Günther (UPB) Decompression Attack FDTC 2015 15 / 18

slide-32
SLIDE 32

Instruction skips via clock glitching

Glitcher

33 MHz 99 MHz Timer

...

Queue *.py

Host

*.log

clock config reset IO delay t1 delay t2

Peter Günther (UPB) Decompression Attack FDTC 2015 16 / 18

slide-33
SLIDE 33

Instruction skips via clock glitching

Glitcher

33 MHz 99 MHz Timer

...

Queue *.py

Host

*.log

clock config reset IO delay t1 delay t2

99 MHz 33 MHz clock t1 t2

Peter Günther (UPB) Decompression Attack FDTC 2015 16 / 18

slide-34
SLIDE 34

The RELIC implementation

First fault: move to singular curve

Decompress: Require: E : y2 = x3 + a4x + a6, (x, b) ∈ Fq × {0, 1} Ensure: (x, y) with y2 = x3 + a4x + a6

1: v ← x3 + a4x 2: v ← v + a6 3: if √v ∈ Fq then 4:

v ← (−1)b√v

5:

return (x, y)

6: else 7:

return O

8: end if

Peter Günther (UPB) Decompression Attack FDTC 2015 17 / 18

P

slide-35
SLIDE 35

The RELIC implementation

First fault: move to singular curve

BN-curve: E : y2 = x3 + 17, note: a4 = 0 Decompress: Require: E : y2 = x3 + a4x + a6, (x, b) ∈ Fq × {0, 1} Ensure: (x, y) with y2 = x3 + a6

1: v ← x3 2: v ← v + a6 3: if √v ∈ Fq then 4:

v ← (−1)b√v

5:

return (x, y)

6: else 7:

return O

8: end if

.ep_rhs: ... movw r30, r24 ld r20, Z movw r22, r28 subi r22, 0xEB sbci r23, 0xFF movw r24, r22 call fp_add_dig rjmp .+18 ...

Peter Günther (UPB) Decompression Attack FDTC 2015 17 / 18

P

avr-gcc

slide-36
SLIDE 36

The RELIC implementation

First fault: move to singular curve

BN-curve: E : y2 = x3 + 17, note: a4 = 0 Decompress: Require: E : y2 = x3 + a4x + a6, (x, b) ∈ Fq × {0, 1} Ensure: (x, y) with y2 = x3 + a6

1: v ← x3 2: v ← v + a6 3: if √v ∈ Fq then 4:

v ← (−1)b√v

5:

return (x, y)

6: else 7:

return O

8: end if

.ep_rhs: ... movw r30, r24 ld r20, Z movw r22, r28 subi r22, 0xEB sbci r23, 0xFF movw r24, r22 call fp_add_dig rjmp .+18 ...

Peter Günther (UPB) Decompression Attack FDTC 2015 17 / 18

avr-gcc

slide-37
SLIDE 37

References

Relic toolkit: https://github.com/relic-toolkit Glitcher Die Datenkrake: https://www.usenix.org/conference/woot13/ workshop-program/presentation/nedospasov

Peter Günther (UPB) Decompression Attack FDTC 2015 18 / 18