Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/consensys/gnark
  4. ›
  5. GMS-2023-4212

GMS-2023-4212: gnark's range checker gadget allows wider inputs up to word alignment

November 12, 2023

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 does 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.

References

  • github.com/Consensys/gnark/commit/f528807119e9443df94b8c01fe8ee65abe3c75d8
  • github.com/Consensys/gnark/issues/897
  • github.com/Consensys/gnark/security/advisories/GHSA-rjjm-x32p-m3f7
  • github.com/advisories/GHSA-rjjm-x32p-m3f7

Code Behaviors & Features

Detect and mitigate GMS-2023-4212 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 0.9.2

Fixed versions

  • v0.9.2

Solution

Upgrade to version 0.9.2 or above.

Source file

go/github.com/consensys/gnark/GMS-2023-4212.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:16:16 +0000.