Cyber Risks · Trail of Bits Blog

It pays to be Circomspect

Summary: In October 2019, a security researcher found a vulnerability in Tornado.cash, an Ethereum mixer that uses zero-knowledge proofs, that let anyone forge a proof of deposit and withdraw funds; the team drained the mixer itself to save user funds, then patched the proofs and migrated funds to a new contract. The fix came down to two characters: the MIMC hash function computing the Merkle tree root used only the assignment operator, which set the output during proof generation but did not constrain it during verification. Trail of Bits is open-sourcing Circomspect, a static analyzer and linter for Circom programs that warns on each use of the signal assignment operator and would have found this vulnerability before the contract was deployed on-chain.

Key Takeaway: A two-character gap between assigning a value and constraining it was enough to let anyone forge a deposit proof against a live mixer, and the team's only recourse was to drain its own users' funds before someone else did.

Read the original at Trail of Bits Blog ↗

Topics
Vulnerabilities & Patching
Related