Lune

NDSS2025Top-tier venue

MTZK: Testing and Exploring Bugs in Zero-Knowledge (ZK) Compilers

Dongwei Xiao, Zhibo Liu, Yiteng Peng, Shuai Wang

Abstract

—Zero-knowledge (ZK) proofs have been increasingly popular in privacy-preserving applications and blockchain systems. To facilitate handy and efficient ZK proof generation for normal users, the industry has designed domain-specific languages (DSLs) and ZK compilers. Given a program in ZK DSL, a ZK compiler compiles it into a circuit, which is then passed to the prover and verifier for ZK checking. However, the correctness of ZK compilers is not well studied, and recent works have shown that de facto ZK compilers are buggy, which can allow malicious users to generate invalid proofs that are accepted by the verifier, causing security breaches and financial losses in cryptocurrency. In this paper, we propose MTZK, a metamorphic testing framework to test ZK compilers and uncover incorrect compila-tions. Our approach leverages deliberately designed metamorphic relations (MRs) to mutate ZK compiler inputs. This way, ZK compilers can be automatically tested for compilation correctness using inputs and mutated variants without requiring manual intervention. We propose a set of design considerations and optimizations to deliver an efficient and effective testing framework. In the evaluation of four industrial ZK compilers, we successfully uncovered 21 bugs, out of which the developers have promptly patched 15. We also show possible exploitations of the uncovered bugs to demonstrate their severe security implications.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

7 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Divergence-Aware Testing of Graphics Shader Compiler Back-Ends cites Random testing for C and C++ compilers with YARPGen
  • Arguzz: Testing zkVMs for Soundness and Completeness Bugs cites DifuzzRTL: Differential Fuzz Testing to Find CPU Bugs
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers7

  1. zkFuzz: Foundation and Framework for Effective Fuzzing of Zero-Knowledge CircuitsHideaki Takahashi, Jihwan Kim, Suman Jana, Junfeng YangS&P 2026 · 8 citations
  2. Arguzz: Testing zkVMs for Soundness and Completeness BugsChristoph Hochrainer, Valentin Wüstholz, Maria ChristakisUSENIX Security 2026 · 2 citations
  3. Divergence-Aware Testing of Graphics Shader Compiler Back-EndsDongwei Xiao, Shuai Wang, Zhibo Liu, Yiteng Peng et al.PLDI 2025 · 1 citation
  4. Testing and Understanding Deviation Behaviors in FHE-Hardened Machine Learning ModelsYiteng Peng, Daoyuan Wu, Zhibo Liu, Dongwei Xiao et al.ICSE 2025 · 1 citation
  5. MetaSpace: Metamorphic Testing for Spatial Cognition in Embodied AgentsGengyang Xu, Dongwei Xiao, Yiteng Peng, Shuai WangOOPSLA 2026

Builds on38

  1. Marlin: Preprocessing zkSNARKs with Universal and Updatable SRSAlessandro Chiesa, Yuncong Hu, Mary Maller, Pratyush Mishra et al.EUROCRYPT 2020 · 356 citations
  2. Testing Database Engines via Pivoted Query SynthesisManuel Rigger, Zhendong SuOSDI 2020 · 150 citations
  3. Random testing for C and C++ compilers with YARPGenVsevolod Livinskii, Dmitry Babokin, John RegehrOOPSLA 2020 · 140 citations
  4. Systematic Fuzzing and Testing of TLS LibrariesJuraj SomorovskyCCS 2016 · 136 citations
  5. DifuzzRTL: Differential Fuzz Testing to Find CPU BugsJaewon Hur, Suhwan Song, Dongup Kwon, Eunjin Baek et al.S&P 2021 · 126 citations

Related papers

  1. Metamorphic Testing of Secure Multi-party Computation (MPC) CompilersYichen Li, Dongwei Xiao, Zhibo Liu, Qi Pang et al.FSE 2024 · 5 citations
  2. Fuzzing Processing Pipelines for Zero-Knowledge CircuitsChristoph Hochrainer, Anastasia Isychev, Valentin Wüstholz, Maria ChristakisCCS 2025 · 1 citation
  3. Bounded Verification for Finite-Field-Blasting - In a Compiler for Zero Knowledge ProofsAlex Ozdemir, Riad S. Wahby, Fraser Brown, Clark W. BarrettCAV 2023 · 11 citations
  4. Metamorphic Shader Fusion for Testing Graphics Shader CompilersDongwei Xiao, Zhibo Liu, Shuai WangICSE 2023 · 12 citations
  5. Cost-Effective Testing of MPC CompilersSebastian Watzinger, Valentin Wüstholz, Deepak Garg, Maria ChristakisFSE 2026
Dusk over the sea between two cliffs drawn in fine vertical lines