CVE-2025-58157: gnark affected by denial of service when computing scalar multiplication using fake-GLV algorithm
Impact For optimizing the scalar multiplication algorithm in circuit for some curves, gnark uses fake-GLV algorithm in case the curve doesn't support true-GLV. For this to work, we need to compute the scalar decomposition using the Half GCD method in gnark-crypto. However, for some of the inputs the algorithm didn't converge quickly enough.
Published Aug 29, 2025 · Updated Oct 8, 2025
Affected packages
github.com/consensys/gnark
- Ecosystem
- Go
- Affected
- = 0.12.0
- Fixed in
- 0.13.0
- Check
go list -m github.com/consensys/gnark
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Impact
For optimizing the scalar multiplication algorithm in circuit for some curves, gnark uses fake-GLV algorithm in case the curve doesn't support true-GLV. For this to work, we need to compute the scalar decomposition using the Half GCD method in gnark-crypto. However, for some of the inputs the algorithm didn't converge quickly enough.
In case the prover accepts untrusted witness, it could lead to denial of service as the prover gets stuck in a very slowly converging loop.
Thanks to @feltroidprime for reporting the issue and proposing a fix.
Patches
The issue has been patched in gnark-crypto commit https://github.com/Consensys/gnark-crypto/commit/56600883e0e9f9b159e9c7000b94e76185ec3d0d. The dependency update is implemented in gnark commit https://github.com/Consensys/gnark/commit/68be6cede36e387ab760725beabd3c96cc94e6dc.
Workarounds
This update doesn't require recompiling the circuits as the issue is in the hint function. The users can update the gnark-crypto dependency to the fixed version.
References
- See bug report https://github.com/Consensys/gnark/issues/1483
- Fake GLV description https://ethresear.ch/t/fake-glv-you-dont-need-an-efficient-endomorphism-to-implement-glv-like-scalar-multiplication-in-snark-circuits/20394
Credited to feltroidprime.
References
- https://github.com/Consensys/gnark/security/advisories/GHSA-9fvj-xqr2-xwg8
- https://github.com/Consensys/gnark/issues/1483
- https://github.com/Consensys/gnark-crypto/commit/56600883e0e9f9b159e9c7000b94e76185ec3d0d
- https://github.com/Consensys/gnark/commit/68be6cede36e387ab760725beabd3c96cc94e6dc
- https://nvd.nist.gov/vuln/detail/CVE-2025-58157
- https://github.com/advisories/GHSA-9fvj-xqr2-xwg8
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2025-57801
gnark is vulnerable to signature malleability in EdDSA and ECDSA due to missing scalar checks
high9.1Aug 22, 2025CVE-2024-50354
Gnark out-of-memory during deserialization with crafted inputs
medium5.5Oct 31, 2024CVE-2024-45039
gnark's Groth16 commitment extension unsound for more than one commitment
medium6.2Sep 6, 2024CVE-2024-45040
gnark commitments to private witnesses in Groth16 as implemented break zero-knowledge property
high5.9Sep 6, 2024
