Every CVE Search/ Get API key

CVE-2024-45040

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

5.9 MediumFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
High
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
None
Availability
None

Exploit likelihood

0.43%Up 0.4 points since Sep 7, 2024
90%50%10%1%

What each source reports

CVE List Score used 5.9

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

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.

Record
CVE-2024-45040
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-11-02
EUVDEUVD-2024-2765 5.9

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.

Record
EUVD-2024-2765
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-03
GitHub AdvisoriesGHSA-9xcg-3q8v-7fq6 8.2

gnark commitments to private witnesses in Groth16 as implemented break zero-knowledge property

This report concerns the Groth16 prover when used with commitments (as in frontend.Committer). To simplify exposition of the issue, I will focus on the case of a single commitment, to only private witnesses. But the issue should be present whenever commitments are used that include private witnesses.

The commitment to private witnesses w_i is computed as

c = sum_i w_i * b_i

where b_i would be ProvingKey.CommitmentKeys[0].Basis[i] in the code.

While this is a binding commitment, it is not hiding. In practice, an adversary will know the points b_i, as they are part of the proving key, and can verify correctness of a guess for the values of w_i by computing c' as the right hand side of the above formula, and checking whether c' is equal to c. I attach a proof of concept that demonstrates this.

This breaks the perfect zero-knowledge property of Groth16, so the Groth16 scheme using commitments to private witnesses as implemented by gnark fails to be a zk-SNARK.

The code indicates that the extension to Groth16 given by the commitments follows the paper "Recursion over Public-Coin Interactive Proof Systems; Faster Hash Verification" by Alexandre Belling, Azam Soleimanian, and Olivier Begassat. In that paper, it seems that commitments are applied to what were originally public inputs, which are moved to private witnesses for efficiency reasons. In any case, that paper does not discuss any hiding/privacy/zero-knowledge properties of their protocols.

So for the use-cases envisioned by that paper, having the commitment not be hiding and losing zero-knowledge of Groth16 might be adequate. However, the documentation by gnark does not make clear that committing to private witnesses loses the zero-knowledge property. The documentation for frontend.Committer does not mention this, and the following snippet from std/multicommit/doc_test.go, where private witness variables are named Secrets and are committed, seems to actively suggest that committed witnesses are still private.

// MultipleCommitmentCircuit is an example circuit showing usage of multiple
// independent commitments in-circuit.
type MultipleCommitmentsCircuit struct {
    Secrets [4]frontend.Variable
}

func (c *MultipleCommitmentsCircuit) Define(api frontend.API) error {
    // first callback receives first unique commitment derived from the root commitment
    multicommit.WithCommitment(api, func(api frontend.API, commitment frontend.Variable) error {
        // compute (X-s[0]) * (X-s[1]) for a random X
        res := api.Mul(api.Sub(commitment, c.Secrets[0]), api.Sub(commitment, c.Secrets[1]))
        api.AssertIsDifferent(res, 0)
        return nil
    }, c.Secrets[:2]...)
   // ...

Thus it seems to me that the intention likely was (and users will be expecting) that gnark's implementation of Groth16 with these commitments should still have zero-knowledge and that the commitments should be hiding.

The way to fix this is likely to adjust the commitment to be hiding the way that is done in the LegoSNARK paper (https://eprint.iacr.org/2019/142.pdf). To expand:

First, let me fix some notation.

Currently, the verifying key has two points on G2 used for checking the proof of knowledge for the commitment: g and g'=-1/σ * g (in the code: VerifyingKey.CommitmentKey.G and VerifyingKey.CommitmentKey.GRootSigmaNeg). The commitment itself is then c = sum_i w_i * b_i, where b_i are on G1, and the proof of knowledge associated to c is calculated as pok = sum_i w_i * b'_i, where b'_i = σ*b_i (in the code b_i and b'_i are ProvingKey.CommitmentKeys.Basis[0][i] and ProvingKey.CommitmentKeys.BasisExpSigma[0][i]). The proof of knowledge is then verified by checking e(c, g) + e(pok, g') = 0 (I am using additive notation throughout here).

The Groth16 proof is verified by checking

e(Krs, -[δ]₂) + e(c, -[γ]₂) + e(term involving public inputs, -[γ]₂) + other terms = 0

The construction ccGro16 from the…

Record
GHSA-9xcg-3q8v-7fq6
CVSS 4.0
8.2 HighCVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-11-02
NVD 5.9

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.

Record
CVE-2024-45040
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-11-02
OSV 5.9

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

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.

Record
CVE-2024-45040
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-11-02
OSVGHSA-9xcg-3q8v-7fq6 8.2

gnark commitments to private witnesses in Groth16 as implemented break zero-knowledge property

This report concerns the Groth16 prover when used with commitments (as in frontend.Committer). To simplify exposition of the issue, I will focus on the case of a single commitment, to only private witnesses. But the issue should be present whenever commitments are used that include private witnesses.

The commitment to private witnesses w_i is computed as

c = sum_i w_i * b_i

where b_i would be ProvingKey.CommitmentKeys[0].Basis[i] in the code.

While this is a binding commitment, it is not hiding. In practice, an adversary will know the points b_i, as they are part of the proving key, and can verify correctness of a guess for the values of w_i by computing c' as the right hand side of the above formula, and checking whether c' is equal to c. I attach a proof of concept that demonstrates this.

This breaks the perfect zero-knowledge property of Groth16, so the Groth16 scheme using commitments to private witnesses as implemented by gnark fails to be a zk-SNARK.

The code indicates that the extension to Groth16 given by the commitments follows the paper "Recursion over Public-Coin Interactive Proof Systems; Faster Hash Verification" by Alexandre Belling, Azam Soleimanian, and Olivier Begassat. In that paper, it seems that commitments are applied to what were originally public inputs, which are moved to private witnesses for efficiency reasons. In any case, that paper does not discuss any hiding/privacy/zero-knowledge properties of their protocols.

So for the use-cases envisioned by that paper, having the commitment not be hiding and losing zero-knowledge of Groth16 might be adequate. However, the documentation by gnark does not make clear that committing to private witnesses loses the zero-knowledge property. The documentation for frontend.Committer does not mention this, and the following snippet from std/multicommit/doc_test.go, where private witness variables are named Secrets and are committed, seems to actively suggest that committed witnesses are still private.

// MultipleCommitmentCircuit is an example circuit showing usage of multiple
// independent commitments in-circuit.
type MultipleCommitmentsCircuit struct {
    Secrets [4]frontend.Variable
}

func (c *MultipleCommitmentsCircuit) Define(api frontend.API) error {
    // first callback receives first unique commitment derived from the root commitment
    multicommit.WithCommitment(api, func(api frontend.API, commitment frontend.Variable) error {
        // compute (X-s[0]) * (X-s[1]) for a random X
        res := api.Mul(api.Sub(commitment, c.Secrets[0]), api.Sub(commitment, c.Secrets[1]))
        api.AssertIsDifferent(res, 0)
        return nil
    }, c.Secrets[:2]...)
   // ...

Thus it seems to me that the intention likely was (and users will be expecting) that gnark's implementation of Groth16 with these commitments should still have zero-knowledge and that the commitments should be hiding.

The way to fix this is likely to adjust the commitment to be hiding the way that is done in the LegoSNARK paper (https://eprint.iacr.org/2019/142.pdf). To expand:

First, let me fix some notation.

Currently, the verifying key has two points on G2 used for checking the proof of knowledge for the commitment: g and g'=-1/σ * g (in the code: VerifyingKey.CommitmentKey.G and VerifyingKey.CommitmentKey.GRootSigmaNeg). The commitment itself is then c = sum_i w_i * b_i, where b_i are on G1, and the proof of knowledge associated to c is calculated as pok = sum_i w_i * b'_i, where b'_i = σ*b_i (in the code b_i and b'_i are ProvingKey.CommitmentKeys.Basis[0][i] and ProvingKey.CommitmentKeys.BasisExpSigma[0][i]). The proof of knowledge is then verified by checking e(c, g) + e(pok, g') = 0 (I am using additive notation throughout here).

The Groth16 proof is verified by checking

e(Krs, -[δ]₂) + e(c, -[γ]₂) + e(term involving public inputs, -[γ]₂) + other terms = 0

The construction ccGro16 from the…

Record
GHSA-9xcg-3q8v-7fq6
CVSS 4.0
8.2 HighCVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-11-02
OSVGO-2024-3123 No score

Commitments to private witnesses in Groth16 as implemented break zero-knowledge property in github.com/consensys/gnark

Commitments to private witnesses in Groth16 as implemented break zero-knowledge property in github.com/consensys/gnark

Record
GO-2024-3123
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
github.com/consensys/gnark
Go
before 0.11.0
0.11.0

History

History
RecordedChangedSources
aliases, publishedEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2024-45040 is a medium vulnerability (CVSS 5.9) in Consensys Gnark, published September 6, 2024. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.43%, the 37th percentile. Fixed in github.com/consensys/gnark 0.11.0.

References

This page doesn't list everything

Left out here: the rest of 2 source descriptions. The JSON record has them.

MoveEnter Open