Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1yamptLXgzMnAtbTNmN84AA3C1
gnark's range checker gadget allows wider inputs up to word alignment
Impact
gnark provides a gadget in the standard library to allow optimized checking of the bitwidth of the inputs. The gadget works by constructing a fixed lookup table containing all valid entries, partitioning the input and checking that all parts are inside the lookup table. The range checker gadget did not take into account that the highest partition may be less than the width limit, allowing the inputs to be up to 16 bits wider than checked.
Range checking gadget is extensively used in field emulation. Users using any dependant gadget (ECDSA verification, proof recursion etc.) is impacted.
We consider the impact of the vulnerability being low as the number of attacker-modifiable bits is significantly smaller compared to the bit-width of scalar field modulus and it won't be possible to construct inputs which would allow to overflow the scalar field.
Patches
The issue has been patched in the stable branch of gnark.
Due to low severity of the issue no emergency release will be issued and we follow the existing release plan. Versions v0.9.2 and higher are patched.
Workarounds
We consider the issue very hard to exploit and do not recommend manual remediation. However, it is possible to perform manual bit decomposition using std/math/bits
gadget.
References
Initial issue https://github.com/Consensys/gnark/issues/897
Acknowledgement
The issue was reported by @ultrainstinct30.
Permalink: https://github.com/advisories/GHSA-rjjm-x32p-m3f7JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yamptLXgzMnAtbTNmN84AA3C1
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Low
Classification: General
Published: about 1 year ago
Updated: about 1 year ago
CVSS Score: 3.2
CVSS vector: CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:N/I:L/A:N
Identifiers: GHSA-rjjm-x32p-m3f7
References:
- https://github.com/Consensys/gnark/security/advisories/GHSA-rjjm-x32p-m3f7
- https://github.com/Consensys/gnark/issues/897
- https://github.com/Consensys/gnark/commit/f528807119e9443df94b8c01fe8ee65abe3c75d8
- https://github.com/advisories/GHSA-rjjm-x32p-m3f7
Blast Radius: 6.1
Affected Packages
go:github.com/consensys/gnark
Dependent packages: 104Dependent repositories: 78
Downloads:
Affected Version Ranges: < 0.9.2
Fixed in: 0.9.2
All affected versions: 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.4.0, 0.5.0, 0.5.1, 0.5.2, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.7.0, 0.7.1, 0.8.0, 0.8.1, 0.9.0, 0.9.1
All unaffected versions: 0.10.0, 0.11.0