Executive brief
snarkjs is a JavaScript library for zero-knowledge proofs using zk-SNARK cryptography, commonly used to verify mathematical proofs in blockchain and privacy applications. The vulnerability allows attackers to perform double-spend attacks because the library fails to validate that public signal values stay within the required cryptographic field range, potentially enabling unauthorized transaction replay or proof forgery.
Technical details
The vulnerability is a missing input validation flaw in the Groth16 proof verification function. Specifically, snarkjs does not check that publicSignals values are less than the field modulus (a critical cryptographic constraint), violating CWE-862 (Missing Authorization). An attacker can craft malicious proofs with out-of-range public signals that pass verification when they should fail, enabling them to forge or replay zero-knowledge proofs. The attack is network-accessible with no authentication or user interaction required. Patches are available in versions after 0.6.11.
Affected products
- iden3 snarkjs through 0.6.11
Timeline
- 2023-05-22: disclosed: Advisory GHSA-xp5g-jhg3-3rg2 published
- 2023-05-21: other: NVD published CVE-2023-33252