{"answers":{"affected":"3 open source packages ship an affected version, including github.com/consensys/gnark-crypto.","exploited":"There is no known exploitation of GHSA-pffg-92cg-xf5c in the wild and no public exploit code.","fix":"Upgrade github.com/consensys/gnark-crypto to 0.12.1 or later.","what":"GHSA-pffg-92cg-xf5c is a vulnerability in github.com/consensys/gnark-crypto, published on 5 Oct 2023."},"fix_prompt":"Check this codebase for GHSA-pffg-92cg-xf5c and fix it if it is affected.\n\nWhat it is: GHSA-pffg-92cg-xf5c is a vulnerability in github.com/consensys/gnark-crypto, published on 5 Oct 2023. \nExploitation: There is no known exploitation of GHSA-pffg-92cg-xf5c in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- github.com/consensys/gnark-crypto (Go): affected all versions; fixed in 0.12.1\n- github.com/consensys/gnark-crypto (Go): affected all versions; fixed in 0.12.1\n- github.com/consensys/gnark-crypto (Go): affected all versions; fixed in 0.12.1\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-pffg-92cg-xf5c/ (Markdown: https://insights.sbomify.com/GHSA-pffg-92cg-xf5c/index.md)","id":"GHSA-pffg-92cg-xf5c","markdown":"https://insights.sbomify.com/GHSA-pffg-92cg-xf5c/index.md","name":"GHSA-pffg-92cg-xf5c","record":{"aliases":["GO-2023-2101"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["other"],"network_reachable":"unknown","non_default_config":false,"product_category":"Go cryptography library","requires_auth":"none","summary":"Incorrect results in GLV exponentiation in GT group can lead to cryptographic failures, affecting users of the gnark-crypto library.","user_interaction":"not_required","vuln_class":"other"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### Impact\nWhen the exponent is bigger than `r`, the group order of the pairing target group `GT`, the exponentiation à la GLV (`ExpGLV`) can *sometimes* give incorrect results compared to normal exponentiation (`Exp`). \n\nThe issue impacts all users using `ExpGLV` for exponentiations in `GT`. This does not impact `Exp` and `ExpCyclotomic` which are sound. Also note that GLV methods in G1 and G2 are sound and _not_ impacted.\n\n### Patches\nFix has been implemented in pull request https://github.com/Consensys/gnark-crypto/pull/451 and merged in commit https://github.com/Consensys/gnark-crypto/commit/ec6be1a037f7c496d595c541a8a8d31c47bcfa3d to master branch.\n\nThe fix increased the bounds of the sub-scalars by 1. In fact, since https://github.com/Consensys/gnark-crypto/pull/213, we use a fast scalar decomposition that tradeoffs divisions (needed in the Babai rounding) by right-shifts. We precompute `b=2^m*v/d (m \u003e log2(d))` and then at runtime compute `scalar*b/2^m` (`v` is a lattice vector and `d` the lattice determinant). This increases the bounds on sub-scalars by 1 which we check at runtime before increasing the loop size (we don't target constant-timeness). `m` is chosen to be a machine word twice big than `log2(d)` so that we rarely need to increase the loop size. Hence why the issue happens only *sometimes* if we omit to increase the bounds. This bounds increase was implemented in G1 and G2 but forgot in GT.\n\n### Workarounds\nUpdating to `v0.12.1+`. Alternatively, use `Exp` or `ExpCyclotomic` instead. We are not aware of any users using `ExpGLV` anyway.\n\n### References\n- Fix PR: https://github.com/Consensys/gnark-crypto/pull/451 \n- Fast scalar decomposition PR: https://github.com/Consensys/gnark-crypto/pull/213\n- https://eprint.iacr.org/2015/565 Sec.4.2\n\n### Acknowledgement\nThe vulnerability was reported by [Antonio Sanso](https://github.com/asanso) @ [EF](https://crypto.ethereum.org/).","ecosystems":["Go"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"gnark-crypto's exponentiation in the pairing target group GT using GLV can give incorrect results","id":"GHSA-pffg-92cg-xf5c","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"Go","product":null,"products":[],"type":"other","year":"2023"},"n_packages":3,"n_references":null,"packages":[{"ecosystem":"Go","fixed":["0.12.1"],"introduced":["0"],"last_affected":[],"package":"github.com/consensys/gnark-crypto","purl":null,"source":"GHSA-pffg-92cg-xf5c"},{"ecosystem":"Go","fixed":["0.12.1"],"introduced":["0"],"last_affected":[],"package":"github.com/consensys/gnark-crypto","purl":"pkg:golang/github.com/consensys/gnark-crypto","source":"GHSA-pffg-92cg-xf5c"},{"ecosystem":"Go","fixed":["0.12.1"],"introduced":["0"],"last_affected":[],"package":"github.com/consensys/gnark-crypto","purl":"pkg:golang/github.com/consensys/gnark-crypto","source":"GO-2023-2101"}],"products":null,"published":"2023-10-05","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"Go Vulnerability Database","prefix":"GO"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Incorrect results in GLV exponentiation in GT group can lead to cryptographic failures, affecting users of the gnark-crypto library.","url":"https://insights.sbomify.com/GHSA-pffg-92cg-xf5c/"}