Dangers Of Determinism In Threshold Signatures
Common digital signatures schemes like ECDSA, EdDSA and Schnorr require the use of a “nonce”, a number only used once. It’s well known that using it only once is critical to the security of these schemes. Failure to do so results in full private key recovery from two signatures. We’ll use Schnorr signatures for the purposes of this post, but the same concepts apply to others. Here is how private key recovery works.
We first create two signatures
Using these two signatures, we can derive an equation to solve for
Once the nonces cancel out, we end up with an equation that can be computed using only public information, the signatures and the data required to verify them. There are two ways to fix this:
- Use a random nonce for every signature
- Use a “deterministic nonce” like RFC6979
Using a random nonce needs no explanation, so we’ll only review deterministic ones here.
A deterministic nonce is one that is not based on random inputs per signature,
but the randomness of your existing private key. It is generated by using a hash
function where your secret key
This method makes the signature deterministic for a given message and also avoids a class of problems that can happen from having to sample randomness to generate the nonce for each signature. Assuming the hash function is cryptographically secure, this completely solves the problem of accidentally reusing a nonce.
Now we come to threshold signatures… it would make sense to apply the same reasoning here and prefer deterministic nonces, but unfortunately that leads to catastrophic results.
A simple (insecure) 2-of-2 signature scheme
The scheme I describe below is not secure but will serve as a simple way to show what happens when you attempt to use deterministic nonces in a multi-signature scheme.
Assume we have a secure way to generate a public key
First they generate nonces
Next they each compute partial signatures and send them to each other:
Each can then add these signatures together to produce a valid signature under the
public key
Checking that the verification equation holds is left as an excercise for the reader.
Let’s see what happens when Eve decides to ask for another signature on the same
message, but decides to generate a different nonce? We’ll call it
By changing her nonce, the public nonce also changes
If we look closely, we can see that we’ve just tricked Dan into reusing a nonce
with a different
Now that we know
Application to Threshold Schemes
This attack can be trivially adapted to threshold schemes and works in the same
way. While threshold schemes are parameterized by
One might ask, what if we provide a proof that the nonce was computed correctly?, that would surely fix this?
Unfortunately no. That just increases the number of malicious parties required
to break the scheme. Notice that the break was caused by changing
Assume a 4-of-5 scheme where parties 1 and 2 are malicious. Parties
In fact, we can see that the parties don’t even need to be malicious for this to happen! Everyone can behave honestly and just by the fact that different participants signed, a passive observer will be able to recover everyone’s private key shares. Yikes.
Takeaways
The main takeaway I hope people get from this post is that threshold schemes are hard to get right :D. This seemingly innocuous change that is common & recommended in single-party signatures completely breaks the security of the threshold system. Minor changes have significant risks, so be cautious when adapting a protocol on paper to a real world use.
The second takeaway is that while nonce reuse is typically referred to in the context of “using the same nonce for different messages”, these attacks are broader than that. If you can trick someone into changing any of the inputs into the hash function, you trigger the same effect and can recover private keys. So be on the lookout for interesting non-standard ways this might come up in the real world.
If you find any errors in this post or have any questions, reach out to me on Twitter (@jakecraige).