CVE-2024-45040 gnark's commitments to private witnesses in Groth16 as implemented break zero-knowledge property

Medium 5.9 Published Updated

Attackers can deduce private witness values in Groth16 proofs if values are small, compromising zero-knowledge privacy in gnark library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-45040?

CVE-2024-45040 is a medium-severity vulnerability in Consensys gnark, published on 6 Sep 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

gnark is a fast zk-SNARK library that offers a high-level API to design circuits. Prior to version 0.11.0, commitments to private witnesses in Groth16 as implemented break the zero-knowledge property. The vulnerability affects only Groth16 proofs with commitments. Notably, PLONK proofs are not affected. The vulnerability affects the zero-knowledge property of the proofs - in case the witness (secret or internal) values are small, then the attacker may be able to enumerate all possible choices to deduce the actual value. If the possible choices for the variables to be committed is large or there are many values committed, then it would be computationally infeasible to enumerate all valid choices. It doesn't affect the completeness/soundness of the proofs. The vulnerability has been fixed in version 0.11.0. The patch to fix the issue is to add additional randomized value to the list of committed value at proving time to mask the rest of the values which were committed. As a workaround, the user can manually commit to a randomized value.

Weakness: CWE-200

Which versions are affected by CVE-2024-45040?

3 open source packages ship an affected version, including github.com/consensys/gnark. It affects 1 product.

PackageAffectedFixed in
github.com/consensys/gnark GoAll versions0.11.0
github.com/consensys/gnark GoAll versions0.11.0
github.com/consensys/gnark GoAll versions0.11.0

Products include Consensys Gnark-Crypto.

How do I fix CVE-2024-45040?

Upgrade github.com/consensys/gnark to 0.11.0 or later.

Is CVE-2024-45040 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-45040 exists.

Sources

Also known as GHSA-9xcg-3q8v-7fq6, GO-2024-3123.

Is CVE-2024-45040 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free