Author: Valentin Wustholz
Many Layer 2 (L2) blockchains, including Linea, rely on zero-knowledge (ZK) infrastructure. This infrastructure is highly complex ("moon math") and critical for the correct operation of these chains. In other words, even a single bug can result in catastrophic financial and reputational damage. Even though we have not seen a catastrophic incident in ZK-based L2s comparable to TheDAO hack in 2016, it requires great engineering discipline and rigorous testing to bulletproof such software components, given their inherent complexity.
Linea is well aware of this responsibility and highly prioritizes security. Currently, Linea works with over 20 security partners on threat prevention, real-time monitoring, post-incident tracing, user protection, and trust and reputation systems.
The Rio fuzzer is the latest result of an ongoing collaboration between Diligence, Linea, and TU Vienna with the goal of strengthening the security of the Linea ecosystem. Diligence is a collective of like-minded white hats, security researchers and engineers dedicated to safeguarding the Ethereum ecosystem. This team has already been instrumental in reviewing critical Linea components, with fuzzing acting as a second safety net beyond manual security reviews and audits.
Fuzzing, as an automated testing technique, is already widely used in the web2 industry (for instance, through large-scale continuous fuzzing efforts at Microsoft, Google, and Meta) to catch bugs before hackers can exploit them.
Over the last few years, Diligence has developed the Harvey fuzzer to catch bugs in smart contracts for any EVM-based chain. Harvey powers the Diligence Fuzzing service and is one of the most effective fuzzers on the market.
Today, we're happy to provide a sneak peek at Rio, a new fuzzer the Diligience team has been working on. Rio is designed to identify potential million-dollar bugs in Linea's ZK infrastructure. More specifically, it targets the gnark infrastructure, a library used by Linea as well as many other projects for designing, executing, proving, and verifying circuits.
Rio has been continuously fuzzing gnark’s codebase over the past year; it has already identified 10 issues that helped the Linea development team to improve gnark. For instance, Rio identified crashes and a specific circuit operation for which gnark tracked unnecessary constraints.
What about potential million-dollar bugs? Rio has already found several critical issues; for instance, in gnark’s AssertIsLessOrEqual primitive. More specifically, it found cases where gnark behaved differently for two logically equivalent but syntactically different circuits; it verified one of them for a given input but not the other one. In other words, gnark's constraint tracking was over- or under-constrained for one of the two circuits. Both types of issues are critical because they may affect the liveness/completeness (over-constrained) or safety/soundness (under-constrained) of the system.
“The issues that the Rio fuzzer is designed to catch are critical and can lead to catastrophic consequences. Linea currently uses additional safeguards to limit the impact of such issues; for instance, manual protocol upgrades in case of liveness issues and a centralized prover in case of safety issues. However, avoiding them in the first place is a top priority for Linea, and fuzzing is one of our security measures for catching them,” shares Gautam Botrel, gnark team lead.
Diligence continuously fuzzes gnark to catch such issues in every new commit and are creating new fuzzers for other ZK infrastructure in Linea.
Stay tuned for more technical details about Rio!
-
Acknowledgments: Diligence team (Pedro Santos, Tobias Vogel, and Valentin Wüstholz), gnark team (especially, Gautam Botrel and Ivo Kubjas), TU Vienna team (Maria Christakis, Christoph Hochrainer, and Anastasia Isychev).