Outdated CURRENT_MAX_PRECOMPILE_ADDRESS
#961
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-888
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2023-10-zksync/blob/main/code/system-contracts/contracts/Constants.sol#L35
Vulnerability details
Impact
The
Constants
contract defines aCURRENT_MAX_PRECOMPILE_ADDRESS
constant that should be set to the max precompile address.The max precompile address is
ECMUL_SYSTEM_CONTRACT = address(0x07)
but it is set toSHA256_SYSTEM_CONTRACT = address(0x02)
instead. There is even a comment that it is "Important" to update this value.Code that relies on this address to be accurate does not work correctly. For example, the
AccountCodeStorage.getCodeHash
function should return theEMPTY_STRING_KECCAK = 0xc5...
code hash forECADD_SYSTEM_CONTRACT
andECMUL_SYSTEM_CONTRACT
but returnsbytes32(0)
instead.Proof of Concept
https://github.com/code-423n4/2023-10-zksync/blob/main/code/system-contracts/contracts/Constants.sol#L35
https://github.com/code-423n4/2023-10-zksync/blob/main/code/system-contracts/contracts/AccountCodeStorage.sol#93
Tools Used
Manual
Recommended Mitigation Steps
Consider changing this line:
Assessed type
Error
The text was updated successfully, but these errors were encountered: