一句话:探讨零知识证明电路模糊测试的挑战,提出输入生成与测试框架技术,并在 zk-regex 中发现 13 个新 bug。
零知识证明(ZKP)已从理论密码学概念发展为隐私保护与可验证应用的重要工具,但通过 ZKP 电路实现和使用 ZKP 仍具挑战性,实践中存在大量 bug,而模糊测试在该领域基本未被探索。本文讨论将模糊测试应用于 ZKP 电路所面临的独特挑战,分析其中的 oracle 问题及其潜在解决方案,并提出输入生成与测试框架(test harness)构建的技术。作者通过为现代 ZKP 应用中的核心库 zk-regex 实现一个模糊测试器来验证方法的有效性。案例研究发现了 13 个新 bug,且均已被开发者确认,表明模糊测试在 ZKP 电路领域可以发挥有效作用。
Zero-knowledge proofs (ZKPs) have evolved from a theoretical cryptographic concept into a powerful tool for implementing privacy-preserving and verifiable applications without requiring trust assumptions. Despite significant progress in the field, implementing and using ZKPs via ZKP circuits remains challenging, leading to numerous bugs that affect ZKP circuits in practice, and fuzzing remains largely unexplored as a method to detect bugs in ZKP circuits. We discuss the unique challenges of applying fuzzing to ZKP circuits, examine the oracle problem and its potential solutions, and propose techniques for input generation and test harness construction. We demonstrate that fuzzing can be effective in this domain by implementing a fuzzer for zk-regex, a cornerstone library in modern ZKP applications. In our case study, we discovered 13 new bugs that have been confirmed by the developers.