Closed c4-bot-8 closed 6 months ago
saxenism (sponsor) confirmed
saxenism (sponsor) disputed
saxenism (sponsor) confirmed
saxenism (sponsor) disputed
The Warden describes a toolkit misbehavior relying on foundry
which is considered Out-of-Scope as this misbehavior has not been properly correlated or attached to any in-scope code of the contest.
alex-ppg marked the issue as unsatisfactory: Out of scope
Lines of code
https://github.com/code-423n4/2024-03-zksync/blob/main/code/system-contracts/bootloader/bootloader.yul#L1
Vulnerability details
Impact
Hey there, I was testing the functionalities of L2 smart contract using
yarn test-node
, and forking with foundry. And apparently there is some inconsistency in reading the code length of some addresses.Proof of Concept
ethereum:
cast code 0x0000000000000000000000000000000000000000 --rpc-url https://rpc.ankr.com/eth
This will give us0x
.cast codesize 0x0000000000000000000000000000000000000000 --rpc-url https://rpc.ankr.com/eth
This will give us 0zksync:
yarn test-node
This will give us the RPC URL (In this case 127.0.0.1:8011)cast code 0x0000000000000000000000000000000000000000 --rpc-url http://127.0.0.1:8011
This will give us '0x0000000101200190000000040000c13d0000000001000019000000110001042e0000008001000039000000400010043f0000000001000416000000000101004b0000000e0000c13d0000002001000039000001000010044300000120000004430000000501000041000000110001042e000000000100001900000012000104300000001000000432000000110001042e0000001200010430000000000000000000000002000000000000000000000000000000400000010000000000000000004d1f25f776f5b2892f4915d389c969ce225b4c569dea7e9e04c0df9bf1530f2a'cast codesize 0x0000000000000000000000000000000000000000 --rpc-url http://127.0.0.1:8011
This will give us 224Because fork testing in foundry relies on
eth_getCode
the code will read the underlying bytecode of that address, without going through the bootloader which handle the odd behavior that zksync has.This also applies for other address, such ass precompile 0x01 ecrecover, and the other.
Tools Used
Foundry
Assessed type
Other