CVE-2024-45040
📋 TL;DR
This vulnerability in gnark's Groth16 implementation breaks zero-knowledge property for proofs with commitments, allowing attackers to potentially deduce small private witness values through enumeration. It affects users of gnark library versions before 0.11.0 who generate Groth16 proofs with commitments. PLONK proofs are not affected.
💻 Affected Systems
- gnark zk-SNARK library
📦 What is this software?
Gnark Crypto by Consensys
⚠️ Risk & Real-World Impact
Worst Case
Complete disclosure of small private witness values in zero-knowledge proofs, compromising confidentiality of sensitive data.
Likely Case
Partial information leakage about witness values when they have limited possible values, reducing privacy guarantees.
If Mitigated
No information leakage when witness values have large possible ranges or many values are committed.
🎯 Exploit Status
Exploitation requires analyzing generated proofs and enumerating possible witness values. No authentication needed to access proofs.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 0.11.0
Vendor Advisory: https://github.com/Consensys/gnark/security/advisories/GHSA-9xcg-3q8v-7fq6
Restart Required: No
Instructions:
1. Update gnark dependency to version 0.11.0 or later. 2. Rebuild and redeploy applications using gnark. 3. Regenerate any stored proofs created with vulnerable versions.
🔧 Temporary Workarounds
Manual randomization workaround
allManually commit to an additional randomized value to mask other committed values
// In proof generation code, add commitment to random value
// Example: circuit.Commit(randomValue)
🧯 If You Can't Patch
- Avoid using Groth16 proofs with commitments in vulnerable versions
- Use PLONK proofs instead of Groth16 where commitments are needed
🔍 How to Verify
Check if Vulnerable:
Check gnark version in go.mod or import statements - versions <0.11.0 are vulnerable if using Groth16 with commitments.
Check Version:
go list -m github.com/consensys/gnark
Verify Fix Applied:
Verify gnark version is 0.11.0 or later and review code to ensure Groth16 proofs with commitments use updated API.
📡 Detection & Monitoring
Log Indicators:
- Generation of Groth16 proofs with commitments using gnark <0.11.0
Network Indicators:
- Transmission of potentially vulnerable Groth16 proofs
SIEM Query:
Application logs containing 'gnark' AND version < '0.11.0' AND 'Groth16' AND 'commit'