Skip to content

Code4rena

zkSync Era

Every publicly disclosed report for zkSync Era and what kind of bugs they were.

disclosed reports
42
most reported class
Business logic
bug classes found
6
first disclosure
2023
Find zkSync Era on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what zkSync Era chose to make public.

Business logic

L2SharedBridge l1LegacyBridge is not set

The L2SharedBridge contract's initialize function fails to assign the l1LegacyBridge address, leaving it as zero. As a result, deposits made through the old L1ERC20Bridge before its upgrade cannot be finalised on L2, causing those transactions to fail.

zkSync Era

Medium
Business logic

paymaster will refund spentOnPubdata to user

In zkSync's bootloader, the refund calculation for transactions that use a paymaster passes a maximum refundable gas value that does not subtract the gas spent on pubdata. A user with a paymaster could therefore receive a refund for pubdata gas they actually consumed, slowly draining funds from the paymaster.

zkSync Era

High
Business logic

User might be able to double withdraw during migration

During the zkSync Era upgrade, a user could finalize an ERC20 withdrawal on the old L1ERC20Bridge and then finalize the same withdrawal again on the new L1SharedBridge if the withdrawal's L2 batch number equals or exceeds the predefined eraFirstPostUpgradeBatch. This allows a double withdrawal of funds under specific edge conditions.

zkSync Era

Medium
Crypto

Missing range constraint on remainder check in div opcode implementation

The zero-knowledge circuit for the div opcode failed to range-constrain the subtraction result used to check that the remainder is less than the divisor. A malicious validator could exploit this to generate a valid proof for an incorrect division result, potentially manipulating smart contracts that rely on div.

zkSync Era

High
Business logic

Lack of access to ETH on L2 through L1->L2 transactions

ETH held on L2 by externally owned accounts cannot be used as msg.value in L1-to-L2 transactions, because such transactions only mint ETH from L1. A malicious operator that ignores L2 transactions could therefore trap users' L2 ETH, violating the guarantee that users can withdraw funds via L1 before a malicious upgrade.

zkSync Era

Medium
Smart contracts

Wrong encoding of the data in the sendCompressedBytecode function

The bootloader's sendCompressedBytecode function lacked a check that originalBytecodeOffset equals afterSelectorPtr + 64 and used unsafe arithmetic, allowing the operator to pass extra bytes or malformed calldata. This could let the operator spend part of the transaction gas limit or force the Compressor::publishCompressedBytecode call to revert.

zkSync Era

Medium
Business logic

Incorrect max precompile address

The constant that marks the highest precompile address was not updated when two new precompiles were added, so the system does not treat them as precompiles. As a result, the code hash function returns zero instead of the expected empty-string hash for those addresses.

zkSync Era

Medium
Business logic

Loss of funds for the sender when L1->L2 TX fails in the bootloader on L2

When an L1-to-L2 transaction fails on zkSync, the bootloader burns all remaining execution gas instead of refunding the unused portion to the sender. An attacker or unlucky user could lose a significant amount of gas fees, especially for computationally intensive transactions with large gas limits.

zkSync Era

Medium
Business logic

TransactionValidator checks intrinsic costs against wrong value

The transaction validator checked the intrinsic gas cost against the total gas limit, which already includes operator overhead, instead of the remaining gas after overhead. An attacker could submit L1-to-L2 transactions that cover only the larger of overhead or intrinsic costs, forcing the operator to process them without full compensation.

zkSync Era

Medium
Crypto

Missing constraint on remainder in shr opcode implementation

The zkSync Era circuit for the `shr` (right shift) opcode failed to constrain the remainder of the division used to implement the shift to be less than the divisor. A malicious validator could therefore generate a valid proof with an incorrect shift result, potentially manipulating smart contracts that rely on shifts, such as a DEX price calculation.

zkSync Era

High
Crypto

Reduction gate in binop operation is unsafe

The range check in the binop reduction gate only verifies that the and and or results are less than 128, but does not check the xor result. An attacker could forge arbitrary results for the and and or opcodes, and cause an overflowed UInt8 xor result to remain in the circuit, potentially leading to unexpected behaviour.

zkSync Era

High
Business logic

Attacker can manipulate the sorted queue in log sorter to emit reverted logs and events

The zero-knowledge circuit that sorts logs did not enforce enough ordering constraints, so a crafted sorted queue could pass validation even though it interleaved write and rollback entries incorrectly. An attacker could then cause already reverted L1 logs and events to be emitted as if they were valid.

zkSync Era

High
Business logic

Unit difference between transaction encoding and bootloader memory constant

The overhead calculation for transactions in zkSync used inconsistent units: encoding length in bytes but bootloader memory in words (32 bytes). This caused the overhead to be calculated 32 times larger than intended, overcharging users for some transactions.

zkSync Era

Medium
DoS

Burning of the user gas in the sendCompressedBytecode function

The bootloader's sendCompressedBytecode function uses nearCallPanic when the Compressor::publishCompressedBytecode call fails, which can be triggered by invalid data from the operator. This allows the operator to burn all gas of an L2 transaction if at least one bytecode is to be published.

zkSync Era

Medium
Access control

Nonce ordering of EOA can be updated to “arbitrary” through an L1 tx

The default account on zkSync Era does not allow calling updateNonceOrdering, but an L1 priority transaction bypasses this check because the bootloader sets the isSystem flag for any call to the ContractDeployer. An attacker can permanently freeze their own account by changing its nonce ordering to arbitrary, after which no new transactions can be initiated.

zkSync Era

Medium
Smart contracts

Deployment Nonce Does not Increment For a Reverted Child Contract

zkSync Era's deployment nonce for a factory contract does not increment when a child contract's constructor reverts, unlike the EVM where the nonce is consumed regardless of success. This divergence can cause factory-deployed contract addresses to differ between chains, breaking assumptions that factories behave consistently with the EVM.

zkSync Era

Medium
DoS

Mul/div relation should not be enforced when divisor is zero

The zero-knowledge circuit for the EraVM division opcode enforced a multiplication relation even when the divisor was zero, which does not hold for a non-zero dividend. An attacker could submit a transaction that made the circuit unprovable, causing a denial of service on the priority queue.

zkSync Era

High
Business logic

Timestamp Constraints Leading to Number of Blocks Creation Limitations

The timestamp constraints in zkSync's batch and block creation allow the operator to set a batch timestamp far in the future, which limits the number of blocks that can be included in subsequent batches and prevents committing multiple batches in the same Ethereum block. This can lead to slower soft confirmations and potential bottlenecks during high transaction volumes.

zkSync Era

Medium
Access control

M-23 The owner is a single point of failure and a centralization risk

The report claims that having a single externally owned account (EOA) as the sole owner of several contracts creates a centralisation risk and a single point of failure. An attacker who compromises the private key, or a malicious owner, could perform a rug-pull or otherwise abuse the privileged functions.

zkSync Era

Medium
Business logic

Potential Gas Manipulation via Bytecode Compression

The compression mechanism for publishing bytecode to L1 allows a malicious operator to artificially inflate the dictionary length, increasing the gas cost charged to users without any benefit. This could lead to users paying higher gas fees for message publication.

zkSync Era

Medium
Business logic

Nonce Behavior Discrepancy Between zkSync Era and EIP-161

zkSync Era starts the deployment nonce for newly created contracts at zero, whereas the EVM (per EIP-161) increments it by one before the constructor runs. This discrepancy can cause factories that predict child contract addresses based on the EVM nonce behaviour to compute incorrect addresses, potentially leading to lost funds if ETH is sent to a mispredicted address.

zkSync Era

Medium
Smart contracts

Divergences in the Simulation of the extcodehash EVM Opcode

The zkSync Era's emulation of the extcodehash opcode diverges from EIP-1052 for accounts with zero code and non-zero balance, and for precompile addresses. An attacker could exploit this inconsistency to cause smart contracts that rely on the opcode's standard behaviour to misbehave.

zkSync Era

Medium
Business logic

Discrepancy in Default Account Behavior

The default account's fallback function reverts when called via delegatecall from a custom account, breaking the promised EOA-like behaviour. An attacker could exploit this discrepancy to cause unexpected failures in protocols that rely on consistent behaviour.

zkSync Era

Medium
Smart contracts

Discrepancy in ECRECOVER Precompile when Using Delegatecall

In zkSync Era, calling the ECRECOVER precompile through delegatecall returns a zero value instead of the recovered address, unlike standard EVM behaviour where call, staticcall and delegatecall all agree. A contract relying on this path could accept an invalid signature or misidentify a signer, which may compromise data integrity or funds.

zkSync Era

Medium
Business logic

Synchronization Issue Between L1 and L2 Upgrades

The L1 executor clears the stored L2 upgrade transaction hash and advances the protocol version even when the L2 upgrade transaction fails on L2. This leaves the recorded protocol version out of sync with the actual L2 state and breaks the requirement that upgrade transaction hashes be unique.

zkSync Era

Medium