Thank you for this wonderful project! This is one of the most well-written Circom project that I have ever met.
However, I have found one bug in the HashChecker template. Specifically, the assert statement only checks the condition when calculating the witness, and it does not add a constraint.
|
assert(hash == calculatedHash); |
Hence, the following malicious witness can satisfy the constraint:
╔══════════════════════════════════════════════════════════════╗
║🚨 Counter Example: ║
║ 🧟 UnderConstrained (Unexpected-Input) 🧟
║ Violated Condition: (Eq main.hash main.calculatedHash)
║ 🔍 Assignment Details:
║ ➡️ main.value3 = 2
║ ➡️ main.value4 = 8
║ ➡️ main.externalNullifier = 7
║ ➡️ main.hash = 0
║ ➡️ main.calculatedHash = 5191963198109124433444999836115045656277008082202604780038683351638849840962
║ ➡️ main.nullifierHash = 7061949393491957813657776856458368574501817871421526214197139795307327923534
║ ➡️ main.value1 = 7
║ ➡️ main.value2 = 21888242871839275222246405745257275088548364400416034343698204186575808495586
This vulnerability was identified by our fuzzing tool, zkFuzz. To fix this bug, we need to replace this assert with the === operator, which adds a constraint.
This is a common type of Circom bug, and details about this type of issue can be found in the following resources:
Even if the current behavior is intentional, clarifying this through documentation or comments would help prevent user confusion.
Thank you for this wonderful project! This is one of the most well-written Circom project that I have ever met.
However, I have found one bug in the
HashCheckertemplate. Specifically, theassertstatement only checks the condition when calculating the witness, and it does not add a constraint.remix-challenges/circuits/calculate_hash.circom
Line 60 in e767f3c
Hence, the following malicious witness can satisfy the constraint:
This vulnerability was identified by our fuzzing tool, zkFuzz. To fix this bug, we need to replace this assert with the
===operator, which adds a constraint.This is a common type of Circom bug, and details about this type of issue can be found in the following resources:
Even if the current behavior is intentional, clarifying this through documentation or comments would help prevent user confusion.