Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐹
🐹 Go
Not in CISA KEV
MEDIUM severity

CVE-2024-45040 gnark

MEDIUMFix: Consensys/gnark@afda68a

CVE-2024-45040 is a medium-severity (CVSS 5.9) Information Exposure vulnerability in github.com/consensys/gnark. A fix is available for github.com/consensys/gnark — see the affected versions and patch details below.

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

Also known asGHSA-9xcg-3q8v-7fq6GO-2024-3123
Published
Sep 6, 2024
Updated
Sep 4, 2026
Affected
2 pkgs
Patched
2 / 2
Exploits
None indexed
Exploitation data as of Sep 21, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

Proof-of-concept exploit code exists

  • CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.

Exploitation and automatability from CISA’s SSVC triage for CVE-2024-45040.

EPSS Exploitation Probability

via FIRST.org ↗
0.4%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs36th percentile — riskier than 36% of all scored CVEsHighest risk

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

How urgent is this, really

CVE-2024-45040 plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.

Where this sits among everything scored

Of 378,156 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.

Real-World Exposure

2 pkgs affected
🐹github.com/consensys/gnark🐹github.com/consensys/gnark

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.

Description

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 LegoSNARK paper (page 73 in https://eprint.iacr.org/2019/142.pdf) is a similar construction. They do not have a proof of knowledge accompanying the commitment because they are considering the case where there are no public inputs. However, they claim that their scheme is zero-knowledge, and the crucial difference for this is that their commitment has an extra blinding term as is usual for Pedersen commitments. Concretely, it is of the form:

c_new = sum_i w_i * b_i + v*[η/γ]₁

where [η/γ]₁ is a new element of G1 that is part of the proving key, with η a new toxic waste field element. The value of v is randomly chosen by the prover.

When adding this additional term to c, then to make the proof verification still succeeds, the proof point Krs is changed accordingly:

Krs_new = Krs_old -  v*[η/δ]₁

where [η/δ]₁ is another new element of G1 that is part of the proving key. As e([η/γ]₁, -[γ]₂) = e([η/δ]₁, -[δ]₂), the contributions from the new terms cancel each other in the proof verification pairing check.

This modification should ensure that the commitment is hiding.

The proof of knowledge would also need to be adapted accordingly, with

pok = sum_i w_i * b'_i + v*[σ*η/γ]₁

where [σ*η/γ]₁ is another point of G1 to add to the proving key.

Impact

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.

Patches

The vulnerability has been fixed in https://github.com/Consensys/gnark/pull/1245. Corresponding commit on the master branch https://github.com/Consensys/gnark/commit/afda68a38acca37becb8ba6d8982d03fee9559a0.

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.

Workarounds

The user can manually commit to a randomized value.

Affected Packages

2 total 2 fixed
EcosystemPackageVulnerable rangeFix
🐹Gogithub.com/consensys/gnarkall versions0.11.0go get github.com/consensys/gnark@v0.11.0
🐹Gogithub.com/consensys/gnarkall versions0.11.0go get github.com/consensys/gnark@v0.11.0

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/consensys/gnark, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update github.com/consensys/gnark to 0.11.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2024-45040 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2024-45040 can be triaged on real exposure rather than presence alone.

Tailored to CVE-2024-45040. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

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 p
O3 Security · Impact-Aware SCA

Is CVE-2024-45040 in your dependencies?

O3 Security finds CVE-2024-45040 across Go dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

CVE-2024-45040: gnark (Medium 5.9) | O3 Security