13

Rogue Key Attack on Gennaro et al. DKG for Polynomials of Excessive Degree

 3 years ago
source link: https://blog.sigmaprime.io/dkg-rogue-key.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Rogue Key Attack on Genanro DKG for Polynomials of Excessive Degree

Rogue Key Attack on Gennaro et al. DKG for Polynomials of Excessive Degree

TL;DR

Distributed Key Generation (DKG) is a protocol used to create a shared secret over a network. It is often used in a case where no one individual should know the secret but with enough users gathered together the secret can be recovered (or alternatively sign a message) without recovering the underlying secret.

There is a threshold number of malicious users who may work together to attempt to recover the secret. A threshold of t, means that t malicious users cannot recover any concrete details about the secret. However, t+1 malicious users can recover the entire secret.

This blog describes a rogue key style attack on the Joint-Feldman and DKG protocols found in this paper which allows one user to gain full knowledge of the shared secret. Given there are n users in the DKG and a threshold t we require n−t+1 malicious users. It is important to note that the protocol already requires t<n2 for this exact reason. Hence this attack is only viable where configurations are used with polynomials of degree greater than n2.

The attack is based on the fact that a user has not in fact committed to their initial polynomial(s) of degree t until at least t+1 users have verified their commitment.

This attack was first seen in Drand where the threshold is required to be greater than 50% to prevent forking the chain. To overcome the attack a lower threshold closer to n2 was chosen. Another protocol, Dfinity, uses a polynomial which may be larger than n2, though already has the constraint that the threshold is in the range t∈[f+1,n−f] as described in Section 7 of the Dfinity paper. Thus, to pull off this attack would require f+1 nodes which is above the protocol's failure threshold, f.

Joint-Feldman

The Joint-Feldman protocol described in the paper shares a secret over a discrete log based problem (e.g. DLP and ECDLP).

First we need to define some variables:

  • Finite Field - Fq
  • Generator of the Group in Fq - g
  • Size of the Group - p
  • Threshold (also the degree of the polynomials)- t
  • The total number of nodes - n
  • Nodes are indexed - [1,n]

Note in this discussion we will use multiplicative notation to align with the discrete log over a finite field.

Steps

The protocol consists of four stages.

1. Generating the polynomials and sharing its discrete log

Each node, i, will generate a polynomial of degree t by selecting t+1 random values ai,0,ai,1,...,ai,t with each of these values in the field Fq. We get the polynomial fi(z),

fi(z)=ai,0+ai,1z+...+ai,tzt

We then create a commitment to this polynomial that we may share with other users. So to not give the values away we exponentiate these ai,j values. That is we do Ai,j=gai,j such that we cannot calculate ai,j from Ai,j without solving the discrete logarithm (assumed to be computationally hard).

We are now able to send our exponentiated polynomial with the other users. That is broadcast Ai,j to all other nodes.

In addition we will secretly send a share of our polynomial to each node j. The share we send is si,j=fi(j) where we are node i.

2. Verification of shares

Each node j can now verify that the shares sent to them by other nodes are accurate. We check the following equality,

gsi,j= Πtk=0(Ai,k)jkmod p

Here the right hand side is calculated from the public shares and left hand side is calculated from the private share. Noting both sides of the equation should be equivalent to gfi(j).

The premise here is that the node sending the share si,j can only know this value if they in fact know the underlying polynomial to calculate this. Which is true so long as there are t+1 good nodes who verify the shares. But more on that later.

If a node receives and shares which fail to verify the above equation they broadcast a complaint.

3. Setting the qualified groups

If any node receives more than t+1 complaints they are immediately ejected. Nodes who have a complaint and are not ejected are asked to broadcast the correct share si,j associated with the complaint. If that share fails verification the node is ejected.

The non-ejected nodes form the group QUAL⊑[1,n].

4. Calculating the final values

The final public value is calculated as y=Πi∈QUALAi,0. Each node can calculate their portion of the shared secret as xi=Σi∈QUALsi,j.

Attacking Joint-Feldman

Crafting the rogue key

The attack on the Joint-Feldman protocol has the prerequisite that we are able to see all the other nodes' public commitments before calculating our own (a synchronicity requirement). Our goal here is to manipulate the final public value to one which we know the discrete logarithm of. That is for y=Πi∈QUALAi,0 we must know w in y=gw.

Now letting w=Σi∈QUAL ai,0 and letting our node index be, e, if we can craft our Ae,0 value to be

Ae,0=gl−∑i≠eai,0

then the final secret will be

w=Σi≠e(ai,0)+ae,0=Σi≠e(ai,0)+l−∑i≠eai,0=l

So here the final secret will be l which we know because we set it and thus we would have full control over the final secret!

Now we do not know the values of ai,j other than our own (otherwise we'd already know the final secret!). Hence we cannot calculate Σi≠e(ai,0). So how do we craft our Ae,0 to be that above?

Well each user's commitment, Ai,0, are publicly shared in step 1. so multiplying them together (excluding ours) gives Πi≠e(Ai,0) which is the same as

Πi≠e(Ai,0)=gΣi≠e(ai,0)

We are now getting pretty close to the desired value, we just need to take the inverse of the above (a log(p) calculation) to get g−Σi≠e(ai,0) select our value l that only we know and do gl. Then multiplying these two together we get

Ae,0=gl−∑i≠eai,0

So reiterating why we want this. Looking again at step 4. we see that the final public key is y=Πi∈QUALAi,0=gΣi∈QUALai,0=gl and we know l!

Passing the verification step (crafting the remainder of the polynomial)

Now comes the challenging part, passing the commitment verification step. If we are unable to have our commitments verified by nodes we will be ejected from the protocol in step 3.

We need to pass the equality

gse,j= Πtk=0(Ae,k)jkmod p

gfe(j)= Πtk=0(Ae,k)jkmod p

To do this we need to be able to calculate fe(j) for each node j. We do this by cleverly crafting our polynomial fe using two helper polynomials, u and v. The reason will become clear as we go on. Our polynomial is set as,

fe(z)=(z−Σi≠eai,0)u(z)+v(z)

We need this polynomial to have ae,0=l−∑i≠eai,0 that is

fe(0)=l−∑i≠eai,0

which will occur if u(0)=1 and v(0)=l i.e.

fe(0)=(0−Σi≠eai,0)u(z)+v(z)=(0−Σi≠eai,0)∗1+l=l−∑i≠eai,0

From the u(0) and v(0) calculations we know the constant term of u(0)=1 and v(0)=l. Now to hide the fact that we do not actually know Σi≠eai,0 we attempt to set,

u(z)=0 for j∈QUAL

such that,

fe(j)=(j−Σi≠eai,0)u(j)+v(j)=(j−Σi≠eai,0)∗0+v(j)=v(j)

This is important as we will know the values v(j) so we are able to send valid shares se,j=fe(j)=v(j) to the other nodes.

Defining u(z) as,

u(z)=1+b1∗z+b2∗z2+...+bt−1∗zt−1

Note since fe is a polynomial of degree t and we have (z−Σi≠eai,0)u(z) therefore u(z) must be of most degree t−1.

By evaluating the polynomials such that u(0)=1 and u(j)=0 for j∈QUAL we will have a system of linear equations,

j=0 gives 1=1+b1∗0+...+bt−1∗0=1 (no variables to solve for!)

j=1 gives 0=1+b1+b2+...+bt−1

j=2 gives 0=1+2b1+4b2+...+2t−1bt−1

j=n gives 0=1+nb1+n2b2+...+nt−1bt−1

There are numerous ways to solve systems of linear equations often done through using an augmented matrix, see solving systems of linear equations. To be guaranteed a solution we must have at least as many variables as linearly independent equations.

The number of equations we currently have is n and need to solve for the t−1, bi variables. Since n>t−1 we will likely not get a solution to our system of equations. So we need to reduce the number of equations to ≤t−1.

Each equation is only verified by one other node hence we may also reduce the number of equations by having other malicious nodes claim they verified our commitments (when the commitments do not actually verify) and of course claiming our own commitment is valid. Let m be the number of malicious nodes helping us, including ourself.

Hence, the number of malicious nodes we need is,

n−m≤t−1

m≥n−t+1

Therefore with m≥n−t+1 malicious nodes we are able to generate a polynomial u(z), which will allow us to pass the commitment verification step.

Note here we use the degree of the polynomial as t which means it would be a t+1 of n threshold scheme as you would need t+1 valid nodes to recover the secret. So to account for this having m≥n−t+2 malicious nodes in a t of n threshold scheme will allow the secret to be rogue key attacked.

The polynomial v(z) should be randomly generated (by us so we know the co-efficients). Its purpose is so the values of fe(j)≠0 for each valid node as,

fe(j)=(j−Σi≠eai,0)u(j)+v(j)=v(j)

Hence, if we did not use a the polynomial v(z) then fe(j)=0, which would make our attack obvious.

From here we would need to calculate the public commitments to our polynomial. We already have Ae,0 calculated above the rest are trivially done as,

Ae,i=gbi−1∗(Πe≠iAi,0)bi∗gv(i)

Gennaro et al. DKG

Differences from Joint-Feldman

A simplified summary of the differences is that we now use two polynomials during the commitment stage rather than one.

Step 1. a) Generate polynomials

Each node will now have two polynomials,

fi(z)=ai,0+ai,1z+...+ai,tzt

f′i(z)=bi,0+bi,1z+...+bi,tzt

There are now two generators (who's discrete log should not be known) g and h.

The initial public commitments are Ci,k=gai,khbi,k.

The nodes will also share two secret values si,j=fi(j) and s′i,j=f′i(j)

Step 1. b) Verify commitments

The commitments are verified as,

gsi,jhs′i,j= Πtk=0(Ci,k)jkmod p

Step 1. c) Complain if commitments are invalid

This is the same as Joint-Feldman complaints are made if verification in step 1. b) fails.

Step 1. d) Eject malicious nodes

This is the same as Joint-Feldman, nodes who have a t complaints against them or fail to prove a complaint are ejected.

Step 2. Make the qualified set

All nodes who are not ejected form the set QUAL.

Step 3. Private shares

Each node's private shares are now x=Σi∈QUALsi,j and x′=Σi∈QUALs′i,j.

Step 4. Extracting the public key

First each node will expose their public polynomial of fi(z) by broadcasting Ai,k=gai,k.

The remaining nodes will verify this as,

gsi,j= Πtk=0(Ai,k)jkmod p

For any node, r that fail this test their polynomial can be reconstructed by the other nodes though using each individual sr,i values shared in step 1.

We can now calculate the final public key as y=Πi∈QUALAi,0.

Attacking Gennaro et al. DKG

Modifications during step 1.

The modifications to attack Gennaro et al. DKG is that we must create two polynomials for each fe and f′e. Setting ourself as e again we have,

fe(z)=(z−Σi≠eai,0)u(z)=v(z)

f′e(z)=(z−Σi≠eai,0)u′(z)=v′(z)

We need to have u(0)=1 and u(j)=0 for j∈QUAL and u′(0)=1 and u′(j)=0 for j∈QUAL (Note thus u(z)=u′(z)). The caculations of this polynomial remains the same as for Joint-Feldman.

Then we must set our inital commitment Ce,0 as,

Ce,0=gv(0)−Σi≠eai,0hv′(0)−Σi≠ebi,0

Which can be calculated by taking the inverse of Πi≠eCi,0 giving g−Σi≠eai,0h−Σi≠ebi,0 then multiplying it by gv(0) and hv′(0).

We are then able to share our secret shares as se,j=fe(j) and s′e,j=fe(j).

Modification to step 4.

During step 4. we must again calculate our Ae,0 after receiving the other Ai,0 values as,

Ae,0=gv(0)(Πi≠eAi,0)−1

Thus, again we will have the final public key as,

y=ΠAi,0=Ae,0Πi≠eAi,0=gv(0)(Πi≠eAi,0)−1∗Πi≠eAi,0=gv(0)

to which we know the value v(0).

Requirements

The requirements again fall in the calculation of the polynomial u(z) which is unchanged and so will require the same number of malicious nodes to be m≥n−t+1 where t is the degree of the polynomial (t+1 of n threshold scheme).

Mitigations

A simple mitigation to this issue is by adding an additional step to the beginning which forces users to commit to their polynomial before obtaining any information about the other users polynomial.

For example a commitment step where each node uses a secure hash function to over their polynomial. Hash(A_{i,0} || A_{i,1} || .. || A_{i,t}) where || represents string concatenation. Obviously ensuring the encoding of a polynomial is unique.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK