GHSA-rjjm-x32p-m3f7: Github.com/consensys/gnark Gnark's Range Checker Gadget Allows Vulnerability

LOW
CVSS 3.2
Published
Advisory Summary

GHSA-rjjm-x32p-m3f7 is a LOW (CVSS 3.2) gnark's range checker gadget allows vulnerability (General Security Weakness) affecting Github.com/consensys/gnark libraries in the Go ecosystem. The issue involves gnark's range checker gadget allows wider inputs up to word alignment. Remediation is available by upgrading affected packages to version 0.9.2.

GHSA-rjjm-x32p-m3f7 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-rjjm-x32p-m3f7
Severity LOW
CVSS v3.1 Base Score 3.2
CWE Classification General Security Weakness
Affected Product Github.com/consensys/gnark
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 3.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:N/I:L/A:N).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix GHSA-rjjm-x32p-m3f7

To remediate this vulnerability, upgrade all affected Github.com/consensys/gnark dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/consensys/gnark fixed: 0.9.2
Upgrade github.com/consensys/gnark to 0.9.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/consensys/gnark

How to Check if You Are Affected

To determine whether your application is affected by GHSA-rjjm-x32p-m3f7, inspect your project dependencies for Github.com/consensys/gnark:

inspect dependencies for github.com/consensys/gnark

Analyze the terminal output to locate any version of Github.com/consensys/gnark in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.9.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Github.com/consensys/gnark, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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](https://github.com/ultrainstinct30).

GHSA-rjjm-x32p-m3f7 Affected Github.com/consensys/gnark Versions

1 component(s)
Fixed Versions:
0.9.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/consensys/gnark
Go
< 0.9.2
0.9.2

References

Frequently Asked Questions

What is GHSA-rjjm-x32p-m3f7?
GHSA-rjjm-x32p-m3f7 is a security vulnerability in Github.com/consensys/gnark involving gnark's range checker gadget allows wider inputs up to word alignment under General Security Weakness.
Which Github.com/consensys/gnark versions are affected?
Affected versions include releases prior to 0.9.2 across affected packages: github.com/consensys/gnark.
What version fixes GHSA-rjjm-x32p-m3f7?
Upgrading to 0.9.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/consensys/gnark affected?
Yes, github.com/consensys/gnark is affected in releases prior to 0.9.2. Upgrade your dependency to 0.9.2 or later.
What is the CVSS score of GHSA-rjjm-x32p-m3f7?
GHSA-rjjm-x32p-m3f7 has a CVSS v3.1 base score of 3.2 (LOW) with vector string CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:N/I:L/A:N.
What CWE is associated with GHSA-rjjm-x32p-m3f7?
GHSA-rjjm-x32p-m3f7 is classified under General Security Weakness.
How can I check Go dependencies for GHSA-rjjm-x32p-m3f7?
Run the dependency tree command: 'inspect dependencies for github.com/consensys/gnark'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-rjjm-x32p-m3f7",
  "modified" : "2023-11-12T15:56:48Z",
  "published" : "2023-11-12T15:56:48Z",
  "aliases" : [ ],
  "summary" : "gnark's range checker gadget allows wider inputs up to word alignment",
  "details" : "### Impact\n\ngnark 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.\n\nRange checking gadget is extensively used in field emulation. Users using any dependant gadget (ECDSA verification, proof recursion etc.) is impacted.\n\nWe 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.\n\n### Patches\n\nThe issue has been patched in the stable branch of gnark. \n\nDue 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.\n\n### Workarounds\n\nWe 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.\n\n### References\n\nInitial issue https://github.com/Consensys/gnark/issues/897\n\n### Acknowledgement\n\nThe issue was reported by [@ultrainstinct30](https://github.com/ultrainstinct30).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/consensys/gnark"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.9.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Consensys/gnark/security/advisories/GHSA-rjjm-x32p-m3f7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Consensys/gnark/issues/897"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Consensys/gnark/commit/f528807119e9443df94b8c01fe8ee65abe3c75d8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Consensys/gnark"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-11-12T15:56:48Z",
    "nvd_published_at" : null
  }
}