Skip to content
Crypto Write-up Advanced

Polygon zkEVM

Weaknesses in the zkProver's recursive proof generation, arising from field incompatibilities between STARK and SNARK, allowed the Trusted Aggregator to forge valid proofs for arbitrary computations. This could let them alter the network state, potentially causing loss of funds or freezing of assets on layer 2 and affecting layer 1 deposits.

blog.verichains.io

Published on blog.verichains.io

Troy and Verichains

Troy, on blog.verichains.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the conversion of Fp^3 elements into a single Fq element and an arithmetic gate that over-allocated space to its third operand failed to constrain values to 64 bits, breaking soundness of the recursive proof.

Impact

Because the exploit relied on malice from the Trusted Aggregator, a centralised module run by the zkEVM team, the probability of exploitation was low, but a malicious aggregator could have modified network state and caused loss of funds.

What the attacker needed

Control of the Trusted Aggregator; ability to run the zkProver

The fix

The fix added constraints ensuring recursive verifier inputs stay below 2^64, introduced separate GL add and subtract templates, added operation tags, and added edge-case tests; it was reviewed and implemented on mainnet in December 2023.

How it was found

  1. Generate counterfeit proofs for the Fork ID 4 zkEVM on Ethereum mainnet and Fork ID 5 on the Goerli testnet.
  2. Compile and run scripts with precise inputs to produce and validate the fake proofs.
  3. Record the legitimate state roots before execution.
  4. Observe that StateRoot and LocalExitRoot were changed to the predetermined values after execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A zero-knowledge rollup proves that off-chain transactions are correct using mathematical proofs, and a smart contract on Ethereum checks those proofs before accepting a new state. Here the proof system had a flaw in how it converted between two number formats, so someone running the central proving component could create a fake proof that the contract would accept. That would let them rewrite the record of who owns what.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.