code-423n4 / 2023-10-zksync-findings

4 stars 0 forks source link

Absence of Enforcement for zkSync Era Virtual Machine Version in Bootloader Processing #424

Open c4-submissions opened 1 year ago

c4-submissions commented 1 year ago

Lines of code

https://github.com/code-423n4/2023-10-zksync/blob/main/code/contracts/ethereum/contracts/zksync/facets/Executor.sol#L444

Vulnerability details

Impact

The lack of enforcement for the zkSync Era virtual machine version in bootloader processing introduces a security risk. If a bug is discovered and patched in EraVM but operators continue to use the outdated version, vulnerabilities may persist, potentially compromising the security of zkSync transactions.

Proof of Concept

In the process of committing a block, various meta parameters are also committed, including l2BootloaderBytecodeHash. This inclusion serves the purpose of ensuring that the batch to be proven contains the correct version of the bootloader. https://github.com/code-423n4/2023-10-zksync/blob/main/code/contracts/ethereum/contracts/zksync/facets/Executor.sol#L55 https://github.com/code-423n4/2023-10-zksync/blob/main/code/contracts/ethereum/contracts/zksync/facets/Executor.sol#L445

However, there is a notable absence of mechanisms enforcing the usage of the correct version of the zkSync Era virtual machine when running the bootloader program. For instance, certain simulated opcodes, like verbatim_3i_0o, can directly impact the processing of transactions. https://github.com/code-423n4/2023-10-zksync/blob/c3ff020df5d11fe91209bd99d7fb0ec1272dc387/code/system-contracts/bootloader/bootloader.yul#L2464

This introduces a potential vulnerability or lack of transparency. For example, if a bug exists in EraVM and is later patched, but an operator continues to run the bootloader with the old version of EraVM (containing the bug), it should not be allowed to be provable on L1. The absence of enforcement in this regard could lead to vulnerabilities or obscurities in the zkSync system.

Tools Used

Recommended Mitigation Steps

The EraVM's version should be embedded within the bootloader for verification on Layer 1.

Assessed type

Context

c4-pre-sort commented 1 year ago

bytes032 marked the issue as low quality report

miladpiri commented 12 months ago

We don’t need explicit check for VM version - as this is what the verification keys are used for.

c4-sponsor commented 12 months ago

miladpiri (sponsor) disputed

c4-judge commented 11 months ago

GalloDaSballo changed the severity to QA (Quality Assurance)

GalloDaSballo commented 11 months ago

QA for operative risk