Pudoo
BTC $64,992.6 +0.89%
ETH $1,915.44 +0.56%
SOL $74.72 +2.33%
BNB $594.7 +1.24%
XRP $1.03 +0.59%
DOGE $0.0703 +1.43%
ADA $0.1992 -1.09%
AVAX $6.52 +1.48%
DOT $0.8173 +0.10%
LINK $8.25 +0.52%
⛽ ETH Gas 28 Gwei
Fear&Greed
30

The Undisclosed Bug in zkSync Era’s Batch Verification: A Forensic Analysis

Price Analysis | CryptoKai |

A single line of missing bitwise masking. That was the difference between a valid proof and a forged one. In February 2025, a routine audit of zkSync Era’s batch verification circuit revealed a critical flaw: the verify_batch function did not constrain the number of public inputs within the allowed range. The fix was deployed silently. No public disclosure. No CVE. No post-mortem.

I spent six months building a minimal Groth16 implementation in Rust during the 2022 bear market. I know how fragile these circuits are. When I first saw the patch commit on GitHub—a single line added, removing the ability to overflow the public input array—I knew exactly what it meant: an attacker could craft a valid proof for an invalid state transition. The math doesn’t negotiate. If the circuit doesn’t enforce constraints, someone will exploit the gap.

Context: How Zero-Knowledge Rollups Verify Batches

zkSync Era, like other ZK-rollups, uses a recursive proving system. Each batch of transactions is compressed into a single validity proof. The sequencer submits the proof on-chain. The verifier contract checks that the proof corresponds to a valid execution. If the proof passes, the state is updated.

The key component is the batch verifier—a smart contract that performs the pairing check on the Groth16 proof. Inside that contract, there is a loop that processes public inputs. In zkSync’s implementation, the number of public inputs was derived from the proof itself, not from a separate trusted source. This is the locus of the bug.

Core: The Integer Overflow in Input Length

The vulnerability existed in the _verify_batch function inside ZkSyncVerifier.sol. The public inputs were stored in a dynamic array. The length of that array was read from the proof data. The circuit expected exactly 32 public inputs for a batch. However, the verifier contract did not explicitly check that publicInputs.length == 32. Instead, it used a loop that iterated up to publicInputs.length.

If an attacker submitted a proof with publicInputs.length set to a value greater than 32, the loop would read garbage from memory. But the critical risk was the opposite: setting publicInputs.length to 0. In Solidity, an empty array has a length of 0. The loop would not execute. The pairing check would proceed with default values. Under certain conditions, this allowed a forged proof to pass verification.

I traced the exact exploit path by reconstructing the verifier’s state machine. The attacker would craft a proof where the public inputs array is empty. The verifier would still compute the pairing equation, but with a nullified input term. The circuit’s degree of freedom—the ability to choose any public input—was no longer constrained. The result: the verifier accepted a proof of a state transition that never happened.

Trade-offs in the Design Choice

Why did the zkSync team miss this? Because they optimized for gas. Iterating over a dynamic array and checking its length costs 100−200 gas. Adding a require statement adds a fixed cost of about 500 gas. For a batch verifier that processes thousands of transactions per day, the gas savings compound. But privacy is a feature, not a bug—and so is security. The trade-off between gas efficiency and constraint enforcement is classic. Many L2 teams prioritize throughput over correctness.

Contrarian: The “Centralized Escrow” Blind Spot

The common narrative is that ZK-rollups are secure because they inherit Ethereum’s security. That is true at the protocol level. But at the implementation level, the verifier contract is a single point of failure. If the contract has a bug, the entire rollup’s state is compromised. No number of validators or decentralized sequencers can fix a broken verifier.

Moreover, the silent patch raises questions about responsible disclosure. The bug was discovered by a third-party auditor in a routine engagement. The patch was merged without a public advisory. In a bear market, developer resources are thin. Teams rush to release features instead of hardening code. This is the real threat to ZK-rollups: not the math, but the human decisions around code deployment.

Takeaway: Expect More Verifier Bugs in 2025-2026

As the number of ZK-rollups grows, so will verifier bugs. The trend toward recursive proofs and cross-chain verification compounds the complexity. Each new proof system—Groth16, PLONK, Halo2—has its own constraint pitfalls. I forecast at least three major verifier exploits before the end of 2026. Teams should publish their verifier code for peer review before mainnet upgrades. Silence before the audit is acceptable; silence after the fix is not.

Code is law, but bugs are reality. The missing line in zkSync’s verifier was a reminder that every line of on-chain code is a liability. Math doesn’t negotiate—but developers can. And they did, by removing the gas-inefficient check. The next bug might not be caught by a friendly auditor. It might be caught by an attacker. And by then, the only negotiation left will be in the form of a drain event.

Market Prices

BTC Bitcoin
$64,992.6 +0.89%
ETH Ethereum
$1,915.44 +0.56%
SOL Solana
$74.72 +2.33%
BNB BNB Chain
$594.7 +1.24%
XRP XRP Ledger
$1.03 +0.59%
DOGE Dogecoin
$0.0703 +1.43%
ADA Cardano
$0.1992 -1.09%
AVAX Avalanche
$6.52 +1.48%
DOT Polkadot
$0.8173 +0.10%
LINK Chainlink
$8.25 +0.52%

Fear & Greed

30

Fear

Market Sentiment

Event Calendar

{{年份}}
10
05
upgrade Ethereum Pectra Upgrade

Raises validator limit and account abstraction

08
04
upgrade Solana Firedancer

Independent validator client goes live on mainnet

15
04
halving Bitcoin Halving

Block reward reduced to 3.125 BTC

30
04
upgrade Celestia Mainnet Upgrade

Improves data availability sampling efficiency

12
05
halving BCH Halving

Block reward halving event

22
03
unlock Optimism Unlock

Circulating supply increases by about 2%

28
03
unlock Arbitrum Token Unlock

92 million ARB released

18
03
unlock Sui Token Unlock

Team and early investor shares released

7x24h Flash News

More >
{{快讯列表(10)}} {{loop}}
{{快讯时间}}

{{快讯内容}}

{{快讯标签}}
{{/loop}} {{/快讯列表}}

Tools

All →

Altseason Index

43

Bitcoin Season

BTC Dominance Altseason

Gas Tracker

Ethereum 28 Gwei
BNB Chain 3 Gwei
Polygon 42 Gwei
Arbitrum 0.5 Gwei
Optimism 0.3 Gwei

Market Cap

All →
1
Bitcoin
BTC
$64,992.6
1
Ethereum
ETH
$1,915.44
1
Solana
SOL
$74.72
1
BNB Chain
BNB
$594.7
1
XRP Ledger
XRP
$1.03
1
Dogecoin
DOGE
$0.0703
1
Cardano
ADA
$0.1992
1
Avalanche
AVAX
$6.52
1
Polkadot
DOT
$0.8173
1
Chainlink
LINK
$8.25

🐋 Whale Tracker

🟢
0xda84...93db
12m ago
In
36,541 SOL
🔴
0x5b80...0283
3h ago
Out
4,827,491 USDT
🔴
0xa1db...9f91
12h ago
Out
832.98 BTC

💡 Smart Money

0x5df8...897c
Arbitrage Bot
+$1.8M
92%
0xc0d5...af98
Arbitrage Bot
+$1.3M
70%
0x8a34...6df6
Early Investor
-$2.4M
77%