Advanced Network Security 6. Agreement and consensus II: Byzantine - - PowerPoint PPT Presentation

advanced network security
SMART_READER_LITE
LIVE PREVIEW

Advanced Network Security 6. Agreement and consensus II: Byzantine - - PowerPoint PPT Presentation

Advanced Network Security 6. Agreement and consensus II: Byzantine failures Jaap-Henk Hoepman Digital Security (DS) Radboud University Nijmegen, the Netherlands @xotoxot // * jhh@cs.ru.nl // 8 www.cs.ru.nl/~jhh Byzantine failures are real


slide-1
SLIDE 1

Jaap-Henk Hoepman

Digital Security (DS) Radboud University Nijmegen, the Netherlands

@xotoxot // * jhh@cs.ru.nl // 8 www.cs.ru.nl/~jhh

Advanced Network Security

  • 6. Agreement and consensus II:

Byzantine failures

slide-2
SLIDE 2

Jaap-Henk Hoepman // Radboud University Nijmegen //

Byzantine failures are real

29-2-2016 // Fault Tolerance - Byzantine Generals 2

binair

9

Én

1 -7 teshdd

'

slide-3
SLIDE 3

Jaap-Henk Hoepman // Radboud University Nijmegen //

The consensus problem (again)

n All processes have a binary input value (0 or 1)

  • So it is different from a broadcast

n Consistency condition

  • All correct processes decide on the same value (Agreement)
  • If all processors have the same input value !, then all correct

processors must decide ! (Validity)

n Termination condition

  • Deterministic

n Now tolerating " < $/& byzantine failures

  • Instead of arbitrary number of crash failures

29-2-2016 // Fault Tolerance - Byzantine Generals 4

slide-4
SLIDE 4

Jaap-Henk Hoepman // Radboud University Nijmegen //

Consensus for Byzantine failures

n Remember: Byzantine processors may lie… n So: what goes wrong in the protocol for crash failures?

29-2-2016 // Fault Tolerance - Byzantine Generals 5

(

essential

strategy

:

gossip ( for

crash

failure )

(

problem

:

the

gossip

mag

be

a

lle

slide-5
SLIDE 5

Jaap-Henk Hoepman // Radboud University Nijmegen //

Correctness proof of protocol for crash failures

n Lemma: suppose both processors ' and ( are correct (i.e don’t fail). Then if ) ∈ +

, then ) ∈ +

  • n Proof
  • If ) ∈ +

, then ) = )/ , for some 0 with ' ∉ σ

«If ' ∈ 0, i.e. 0 = 3; '; 5 then ' sent ) = 67;,

,

and hence ) = )7

, too, with ' ∉ 3

  • If 0 < 8 + 1 then ' will send 6/;,
  • = )/

, = ) to q and then )/;,

  • = ) and

so ) ∈ +

  • If 0 = 8 + 1 then there is a non faulty processor ; with 0 = 3; ;; 5 such

that )7

< = )/ , Then at round 3 + 1 processor ; sent ) = )7 < to ( as well

(as message ) = 67;<

  • ). Hence )7;<
  • = ). Again ) ∈ +
  • 29-2-2016 // Fault Tolerance - Byzantine Generals

6

1-

slide-6
SLIDE 6

Jaap-Henk Hoepman // Radboud University Nijmegen //

Byzantine failures: " < $/& is necessary

n Suppose > = 3 and 8 = 1 (and two rounds)

29-2-2016 // Fault Tolerance - Byzantine Generals 8

goud

baat

byzantijnen

a

a

%

@ µ

.

° @rmiarym.amia

iii.

"ËËË

.

@

÷

.

.

b

mis

b

Mb

C

b Mb

C

tube

It

allo

must

decide

I

are

must

I

b

seek

decided

decide

gameuserset

§

decide

1

slide-7
SLIDE 7

Jaap-Henk Hoepman // Radboud University Nijmegen //

A protocol tolerating " < $/& byzantine failures

n Again each processor ' builds the following tree E

,

29-2-2016 // Fault Tolerance - Byzantine Generals 10

)-F,-G,..,-H

,

means: (Itold ', that (IJKtold (I, …. that (K’s value is ) Initially all ⊥ )M

, = N ' . O>

)M

,

)K

,

)-

,

)P

,

)P,K

,

)P,PJK

,

)K,Q

,

)K,P

,

Level 0 Level 1 Level 2 Level R Level 8 + 1 )/

,

Level R + 1 )/;S

,

for all T ∉ 0, i.e. > − 0 = > − R children

slide-8
SLIDE 8

Jaap-Henk Hoepman // Radboud University Nijmegen //

Byzantine failures: decision more complex

n Associate a decision value V/

, to each node in the tree

  • After tree is filled with values top down, it is filled with decision

values bottom up

  • VM

, is the value for N ' . VWXOYOZ> that ' decides on

n Define [\TZRO]^ _ be the value that occurs most in a set _, using some constant ⊥ to break ties

29-2-2016 // Fault Tolerance - Byzantine Generals 11

slide-9
SLIDE 9

Jaap-Henk Hoepman // Radboud University Nijmegen //

Lamport’s OM protocol for building the tree

n We write `[/

,(O, )) to make clear processor ' executes this to

propagate ) and to keep track of ‘stack trace’ 0

  • O is recursion parameter (starts at 8 and ends at 0) (Lamport uses 6 in the

paper)

  • `[/

, O, ) is executed by ' for all 0 s.t. |0| = 8 − O and ' ∉ 0

  • It sends ) = )/

, to all nodes ( (as message 6/;,

  • , stored by ( as )/;,
  • ),

and instructs them to propagate the value through recursion

  • It essentially builds '’s part of the subtrees rooted at 0 for all

processors; together with the other `[/

  • () the whole subtrees rooted

at 0 are built.

  • The protocol starts with `[M

,(8, N ' . O>) for all '

29-2-2016 // Fault Tolerance - Byzantine Generals 12

slide-10
SLIDE 10

Jaap-Henk Hoepman // Radboud University Nijmegen //

m-1 rounds

Lamport’s OM protocol

n `[/

, 0, ) :

  • Send v/

, as 6/;,

  • to all (
  • All processors ( that receive it set )/;,
  • = 6/;,
  • ; set ⊥ if no value received ; and set V/;,
  • = )/;,
  • Set V/

, = [\TZRO]^( V/;- , |( ∉ 0 )

n `[/

, O, ) for 0 < O ≤ 8

  • Send ) as 6/;,
  • to all (
  • All processors ( that receive it set )/;,
  • = 6/;,
  • = ); set ⊥ if no value received
  • Trigger `[/;,
  • (O − 1, )/;,
  • ) for all ( ∉ 0; '

« Or rather: when receiving 6/;-

,

execute `[/;-

, (O − 1, 6/;- , ) if ' ∉ 0; (

  • Set V/

, = [\TZRO]^( V/;- , |( ∉ 0 )

n Start as `[M

,(8, N ' . O>) for all ' in round 0

  • Storing N ' . O> as )M

, 29-2-2016 // Fault Tolerance - Byzantine Generals 13

Here 0; ' = 8 + 1

slide-11
SLIDE 11

Jaap-Henk Hoepman // Radboud University Nijmegen //

A protocol tolerating " < $/& byzantine failures

n Again each processor ' builds the following tree E

,

29-2-2016 // Fault Tolerance - Byzantine Generals 14

)-F,-G,..,-H

,

means: (Itold ', that (IJKtold (I, …. that (K’s value is ) Initially all ⊥ )M

, = N ' . O>

)M

,

)K

,

)-

,

)P

,

)P,K

,

)P,PJK

,

)K,Q

,

)K,P

,

Level 0 Level 1 Level 2 Level R Level 8 + 1 )/

,

Level R + 1 )/;S

,

for all T ∉ 0, i.e. > − 0 = > − R children `[M

,

`[K,P

,

`[K

,

slide-12
SLIDE 12

Jaap-Henk Hoepman // Radboud University Nijmegen //

One step in detail

29-2-2016 // Fault Tolerance - Byzantine Generals 15

)K,P

,

`[K,P

,

Level 0 Level 1 Level 2 Level 3 `[K

P

)K

P

6K,P

,

6K,P

PJK

)K,P,,

  • `[M

K

)M

K

6K,P,,

slide-13
SLIDE 13

Jaap-Henk Hoepman // Radboud University Nijmegen //

So building the tree is the same protocol as for crash failures.

n Before round 1

  • Initialise tree. Set all )/

, =⊥ and )M , = N ' . O>

n Round R, 1 ≤ R ≤ 8 + 1

  • For all 0 with 0 = R − 1 ∧ ' ∉ 0, send )/

, to all processors ( (including

')

«Call this message 6/;,

  • Receive all 6/;y

,

addressed to ' and store in )/;y

,

«By the protocol z ∉ 0 so ' receives > − (R − 1) such messages from each z

29-2-2016 // Fault Tolerance - Byzantine Generals 16

)-F,-G,..,-H

,

means: (Itold ', that (IJKtold (I, …. that (K’s value is ) Initially all ⊥ )M

, = N ' . O>

slide-14
SLIDE 14

Jaap-Henk Hoepman // Radboud University Nijmegen //

Deciding on a value

n Work from the leaves upwards

  • V/

, = )/ , for 0 = 8 + 1

  • V/

, = [\TZRO]^( V/;- , |( ∉ 0 ) otherwise

  • Node ' decides on VM

,

29-2-2016 // Fault Tolerance - Byzantine Generals 17

slide-15
SLIDE 15

Jaap-Henk Hoepman // Radboud University Nijmegen //

Correctness

n Lemma 1: If ', (, R are non faulty, then for all 0 we have )/;|

,

= )/;|

  • Proof:

n Set V/

, = )/ , for all leaves, ie 0 = 8 + 1

29-2-2016 // Fault Tolerance - Byzantine Generals 18

We reason over all trees

is

correct

,

so

it

seeds

ten

same

value

to

p

de

slide-16
SLIDE 16

Jaap-Henk Hoepman // Radboud University Nijmegen //

Correctness

n Lemma 1: If ', (, R are non faulty, then for all 0 we have )/;|

,

= )/;|

  • n Lemma 2: Let 0 be arbitrary and let R be non faulty. Then there is

a value ) such that for all non faulty p we have V/;|

,

= )/;|

,

= ).

29-2-2016 // Fault Tolerance - Byzantine Generals 20

inductie

  • n

tart

inductieve

tortilla

  • basecase
:

lont

  • TH

level k

VI

  • level

f

In

level

ten

tv-Toren

levert

II

,

'

i.

(

tweeten

'

n .

er :p

  • ther

dfr.tv

amajoin

Anodes

  • her

have

div

n

  • tarten
  • f

&

df.ru

> zf

slide-17
SLIDE 17

Jaap-Henk Hoepman // Radboud University Nijmegen //

Correctness

n Lemma 1: If ', (, R are non faulty, then for all 0 we have )/;|

,

= )/;|

  • n Lemma 2: Let 0 be arbitrary and let R be non faulty. Then there is a

value ) such that for all non faulty p we have V/;|

,

= )/;|

,

= ).

  • By induction on the length of 0; R starting with the leaves (length 8 + 1)
  • The base case follows from lemma 1 and the fact that for 0; R = 8 + 1 we

have V/;|

,

= )/;|

,

.

  • Now suppose 0 ≤ 0; R < 8 + 1. By lemma 1 all non faulty processors have the

same value )/;|

,

= ). Then all non-faulty processors ' ∉ 0; R send ) as 6/;|;,

  • to

all other processors (. If non faulty, ( sets )/;|;,

  • = ).
  • By the induction hypothesis we have V/;|;,
  • = )/;|;,
  • = ) for all non faulty (.
  • The number of children of a node with label 0; R is > − 0; R ≥ > − 8 > 28
  • Hence the majority of children is non-faulty, and so V/;|
  • = [\TZRO]^(É

Ñ V/;|;,

  • |' ∉

0 ) = ) as required

29-2-2016 // Fault Tolerance - Byzantine Generals 22

slide-18
SLIDE 18

Jaap-Henk Hoepman // Radboud University Nijmegen //

Validity

n Theorem: If all non faulty processors have input ) they decide on )

29-2-2016 // Fault Tolerance - Byzantine Generals 23

  • If

alt

nou
  • faalt

p have

value

v

her

send

U

to

an

man

  • faun

q

In

te

firstround

✓ {

=

v

for

an

correct

p

d

9-

.
  • lemma

2

die

for

an

correct

plot

af

=

Maij

( Edit

brand )

=

v

slide-19
SLIDE 19

Jaap-Henk Hoepman // Radboud University Nijmegen //

Agreement

n Definition 1. 0 is common if V/

, = V/

  • for all pairs of non faulty ', (.

n Definition 2. A subset N of nodes in a tree E is a path cover of E if all paths from the leaves to the root visit at least one node in N. n Definition 3. A path cover N is common if all nodes in N are common.

  • Note: this does not require V/

, = V/Ç

  • for different 0, 0′.

29-2-2016 // Fault Tolerance - Byzantine Generals 25

cover

slide-20
SLIDE 20

Jaap-Henk Hoepman // Radboud University Nijmegen //

Agreement

n Lemma 3. There exists a common path covering of the tree constructed by the consensus algorithm

  • All paths from the root to a leaf correspond to a label 0 with length

8 + 1.

  • Then 0 = 0Ç; R; 0ÇÇ for some non faulty R
  • By lemma 2 V/’;|

,

= V/’;|

  • for all non faulty ', ( and so 0’; R is common

and on the path

29-2-2016 // Fault Tolerance - Byzantine Generals 26

slide-21
SLIDE 21

Jaap-Henk Hoepman // Radboud University Nijmegen //

Agreement

n Lemma 4. Let 0 be a node. If there is a common path covering of the subtree rooted at 0, then 0 is common itself.

  • By induction on the length of 0
  • For 0 = 8 + 1 the lemma trivially follows
  • Let 0 ≤ 0 < 8 + 1 and assume there is a common path covering N of the

subtree rooted at 0. If 0 ∈ N we are done. If not, then the trees rooted in all children have a common path covering and by the induction hypothesis then all children 0; R of 0 are common.

  • Hence V/;|

,

= V/;|

  • for all pairs of non faulty ', (. Hence V/

, = [\TZRO]^á

à É Ñ V/;|

, |R ∉

= [\TZRO]^ V|

  • |R ∉ 0

= V/

  • and hence 0 is common as well.

n Theorem: All non faulty nodes decide on the same value

  • Follows from lemma 3 and 4.

29-2-2016 // Fault Tolerance - Byzantine Generals 27

slide-22
SLIDE 22

Using authentication

29-2-2016 // Fault Tolerance - Byzantine Generals 30

slide-23
SLIDE 23

Jaap-Henk Hoepman // Radboud University Nijmegen //

Signing messages

n Every processor ' has a private signing key. The corresponding signature verification key is known to all processors. n Signatures of correct processors cannot be forged n Let us write 6 , for a message 6 signed by '. Write 6 / for … 6 ,. . | with 0 = '; … ; R n Processors reject any messages with incorrect signatures.

  • Byzantine nodes cannot forge values pretending they heard another

value from a correct processor

  • But they can send conflicting initial values in the first round!
slide-24
SLIDE 24

Jaap-Henk Hoepman // Radboud University Nijmegen //

Using authentication to tolerate Byzantine failures

n Could the protocol for crash failures by used to toleratean arbitrary number if Byzantine failures?

  • By always sending signed messages, so Byzantine processors cannot

forge information?

29-2-2016 // Fault Tolerance - Byzantine Generals 32

Valluik

:

If

an

processor

have

An

some

inputvalue

v

,

ken

v

must

be

the

de

"

  • h

(

is the

default

must

decision

value

decide

① ①

1-

!

{ No

Vp

= kon ) →

decision

=

te

default

=
  • 8
slide-25
SLIDE 25

Jaap-Henk Hoepman // Radboud University Nijmegen //

(Re)onsider the weak broadcast protocol

n One server ' holds a bit

  • Either 0 or 1

n Consistency condition:

  • (Agreement) All correct processes decide on the same value
  • (Validity) If ' is not faulty, this should be '’s input

n Termination condition:

  • deterministic

n Assumptions

  • Byzantine failures
  • Synchronous communication

29-2-2016 // Fault Tolerance - Byzantine Generals 34

slide-26
SLIDE 26

Jaap-Henk Hoepman // Radboud University Nijmegen //

(Binary) Broadcast (aka agreement)

n Sender ' in round 1

  • If N ' . O> = 1 then send 1 , to all, otherwise stay silent
  • Decide on N ' . O>

n Other nodes (

  • For each round R ∈ {1, … , 8 + 1}

«If you receive a valid 1 / message (note 0 = R) with 0 = '; 0′ then send 1 / , = 1 /;- to all, decide on 1 and terminate

  • After round 8 + 1 decide on 0 and terminate

29-2-2016 // Fault Tolerance - Byzantine Generals 35

fan

?

slide-27
SLIDE 27

Jaap-Henk Hoepman // Radboud University Nijmegen //

Correctness

n Agreement

  • Suppose a correct node decides on 1 in round R. This means it

received a valid 1 / message.

  • If R < 8 + 1 then ' sends a valid

1 / , = 1 /;- message to all correct ( who therefore decide on 1 too.

  • If R = 8 + 1 then 0 = 8 + 1 hence 0 = 0Ç; (; 0′′ for some correct ( that

sent a valid 1 /å;- message to all correct nodes that therefore decided

  • n 1 in round 0Ç + 1.

n

29-2-2016 // Fault Tolerance - Byzantine Generals 36

slide-28
SLIDE 28

Jaap-Henk Hoepman // Radboud University Nijmegen //

Correctness

n Validity

  • Suppose ' is correct.
  • Either its input is 1 so it sends 1 , to all, and all correct nodes decide

1 in round 1.

  • Or its input is 0 so it does not send anything. As a result no correct

node receives a valid 1 / message, so all correct nodes decide 0 in round 8 + 1

29-2-2016 // Fault Tolerance - Byzantine Generals 37

slide-29
SLIDE 29

Jaap-Henk Hoepman // Radboud University Nijmegen //

Using agreement to reach consensus

n Use Byzantine agreement as a subprotocol

  • Each node maintains a vector + of values, one for each node O, initially empty
  • Each node O uses the Byzantine agreement (i.e. broadcast algorithm) to

broadcast its input value to all other nodes. This takes at most 8 + 1 rounds

  • All other nodes receive this value and store it in +[O]
  • All other nodes obtain (by the agreement property of the broadcast) the same

vector of input values

  • All nodes decide on the majority of values in this vector (breaking ties in a

deterministic way)

  • If 8 < >/2 then if all nodes have the same input value, all nodes decide on

this value.

29-2-2016 // Fault Tolerance - Byzantine Generals 38

slide-30
SLIDE 30

Jaap-Henk Hoepman // Radboud University Nijmegen //

Strong validity condition yields 8 < >/2

n Consider weak validity

  • If all processes are correct and all have the same input value, then this

is the decision value

n Then the algorithm for crash failures strengthened with authentication becomes a consensus algorithm for Byzantine failures for arbitrary 8 < >

29-2-2016 // Fault Tolerance - Byzantine Generals 39