Paper 2023/512

Automated Detection of Underconstrained Circuits for Zero-Knowledge Proofs

Shankara Pailoor, Veridise
Yanju Chen, Veridise
Franklyn Wang, Harvard University, 0xparc
Clara Rodríguez, Complutense University of Madrid
Jacob Van Gaffen, Veridise
Jason Morton, ZKonduit
Michael Chu, 0xparc
Brian Gu, 0xparc
Yu Feng, Veridise
Isil Dillig, Veridise
Abstract

As zero-knowledge proofs gain increasing adoption, the cryptography community has designed domain-specific languages (DSLs) that facilitate the construction of zero-knowledge proofs (ZKPs). Many of these DSLs, such as Circom, facilitate the construction of arithmetic circuits, which are essentially polynomial equations over a finite field. In particular, given a program in a zero-knowledge proof DSL, the compiler automatically produces the corresponding arithmetic circuit. However, a common and serious problem is that the generated circuit may be underconstrained, either due to a bug in the program or a bug in the compiler itself. Underconstrained circuits admit multiple witnesses for a given input, so a malicious party can generate bogus witnesses, thereby causing the verifier to accept a proof that it should not. Because of the increasing prevalence of such arithmetic circuits in blockchain applications, several million dollars worth of cryptocurrency have been stolen due to underconstrained arithmetic circuits. Motivated by this problem, we propose a new technique for finding ZKP bugs caused by underconstrained polynomial equations over finite fields. Our method performs semantic reasoning over the finite field equations generated by the compiler to prove whether or not each signal is uniquely determined by the input. Our proposed approach combines SMT solving with lightweight uniqueness inference to effectively reason about underconstrained circuits. We have implemented our proposed approach in a tool called $\mathbf{\mathsf{QED}^2}$ and evaluate it on 163 Circom circuits. Our evaluation shows that $\mathbf{\mathsf{QED}^2}$ can successfully solve 70\% of these benchmarks, meaning that it either verifies the uniqueness of the output signals or finds a pair of witnesses that demonstrate non-uniqueness of the circuit. Furthermore, $\mathbf{\mathsf{QED}^2}$ has found 8 previously unknown vulnerabilities in widely-used circuits.

Note: Addressing typo in Figure 1.

Metadata
Available format(s)
PDF
Category
Applications
Publication info
Published elsewhere. Programming Languages Design and Implementation (PLDI)
DOI
10.1145/3591282
Keywords
Zero Knowledge ProofsZK-SNARKsProgram VerificationProgram AnalysisAutomated Reasoning
Contact author(s)
spailoor @ cs utexas edu
yanju @ cs ucsb edu
franklynw2000 @ gmail com
clarrodr @ ucm es
jsvg @ cs washington edu
jason @ zkonduit com
michael @ 0xparc org
brian @ 0xparc org
yufeng @ cs ucsb edu
isil @ cs utexas edu
History
2023-04-19: revised
2023-04-09: received
See all versions
Short URL
https://ia.cr/2023/512
License
No rights reserved
CC0

BibTeX

@misc{cryptoeprint:2023/512,
      author = {Shankara Pailoor and Yanju Chen and Franklyn Wang and Clara Rodríguez and Jacob Van Gaffen and Jason Morton and Michael Chu and Brian Gu and Yu Feng and Isil Dillig},
      title = {Automated Detection of Underconstrained Circuits for Zero-Knowledge Proofs},
      howpublished = {Cryptology ePrint Archive, Paper 2023/512},
      year = {2023},
      doi = {10.1145/3591282},
      note = {\url{https://eprint.iacr.org/2023/512}},
      url = {https://eprint.iacr.org/2023/512}
}
Note: In order to protect the privacy of readers, eprint.iacr.org does not use cookies or embedded third party content.