Recently, the Fireblocks team disclosed a vulnerability in the ECDSA threshold signature protocol GG18/GG20 in the paper Practical Key-Extraction Attacks in Leading MPC Wallets (CVE-2023-33241). By exploiting this vulnerability, a malicious participant can steal other participants' key share with only 16 signatures.
This article describes the details of the vulnerability with two participants, Alice and Bob, where Alice is the attacker and Bob is an honest participant.
Before describing the details of the vulnerability, some preliminaries are introduced to aid in understanding the follow-up content.
Paillier encryption algorithm is an asymmetric encryption algorithm with the property of additive homomorphism.
Paillier key pair generation: choose two prime numbers,
Paillier encryption process: randomly select an
Paillier decryption process: let
The GG18/GG20 MPC signature protocol has a sub-protocol called Multiplicative-to-Additive (MtA).
After the MtA sub-protocol,
In GG18/GG20, Paillier homomorphic encryption is used to implement the MtA sub-protocol.
Alice uses her own Paillier public key
The following question appears in the 3rd-century book 'Sunzi Suanjing':
There are certain things whose number is unknown. If we count them by threes, we have two left over; by fives, we have three left over; and by sevens, two are left over. How many things are there?
Given an integer that has a remainder of 2 when divided by 3, a remainder of 3 when divided by 5, and a remainder of 2 when divided by 7, find this integer. The Chinese Remainder Theorem can be used to calculate that this smallest integer is 23.
Alice can obtain Bob's key share
This section describes the basic principles of CVE-2023-33241.
In the MtA sub-protocol, Alice randomly selects a
Let's demonstrate why Bob's key share
Then, look at what happens when
Obviously, increasing
In the CVE-2023-33241 attack, Alice increases
In the MtA sub-protocol, Alice needs to provide a range proof to prove that the plaintext corresponding to the ciphertext she sent to Bob
If all three equations in the lower right corner of the figure are true, Bob is convinced that
When Alice sets
Here is a way to forge Range Proof.
The key to forging Range Proof is that Alice uses
The Fireblocks team pointed out that when
The second-to-last step of the above derivation uses
And
So,
The remaining question is how to make
The exploitation process of CVE-2023-33241 is as follows:
- In the DKG phase, Alice maliciously constructs a Paillier public key
$N=p_1 \cdots p_{16} \cdot q$ , where$p_1,\cdots,p_{16}$ are small primes with 16 bits each; - Perform 16 MPC signatures, and in each MtA sub-protocol of the signature:
- Alice does not randomly generate
$k$ , but sets$k=\frac{N}{p_i}$ . When Alice behaves well,$k$ is 256 bits. When Alice behaves maliciously and uses$k=\frac{N}{p_i}$ , since$N$ is 2048 bits and$p_i$ is 16 bits, this$k$ is 2032 bits, which is much larger than normal and does not meet the Range Proof requirement. Therefore, subsequent steps are needed to forge the Range Proof; - Alice forges the Range Proof. The specific method is that Alice sets
$k=0$ (so that it can pass the verification of$s_1 \le q^3$ ), and brute-forces the value of a random number$\gamma$ (or any other random number controlled by Alice) until the condition$e \bmod p_i = 0$ is satisfied. This brute-force search is likely to succeed easily because$p_i$ is relatively small, only 16 bits; - After MtA, Alice uses the formula
$x \bmod p_i = \frac{\alpha - (\alpha \bmod (N/p_i))}{N/p_i}$ to obtain$x \bmod p_i$ .
- Alice does not randomly generate
- After step 2 is completed, 16 values
$x \bmod p_1, \cdots, x \bmod p_{16}$ can be obtained, and then the Chinese Remainder Theorem can be used to calculate Bob's key share$x$ .
For the proof of the formula
The mitigation for CVE-2023-33241 is as follows: When each participant creates a Paillier public key
-
$N$ is the product of two primes$pq$ , and$pq$ and$(p-1)(q-1)$ are coprime (this is the condition that a normal Paillier public key will satisfy). -
$N$ has no small factors.
When each participant receives
These two zero-knowledge proofs can be found in the papers CMP/CGGMP, corresponding to Paillier-Blum Modulus ZK and No Small Factor Proof in the CMP/CGGMP papers, respectively.
- Practical Key-Extraction Attacks in Leading MPC Wallets
- Fast Multiparty Threshold ECDSA with Fast Trustless Setup
- Small Leaks, Billions Of Dollars: Practical Cryptographic Exploits That Undermine Leading Crypto Wallets
- Safeheron GG20 Exploit PoC
- UC Non-Interactive, Proactive, Threshold ECDSA
- UC Non-Interactive, Proactive, Threshold ECDSA with Identifiable Aborts