In the _parseL2WithdrawalMessage
function of the L1Nullifier
contract, there is an incorrect length check on the _l2ToL1message
byte array when the bytes4(functionSignature)
equals IAssetRouterBase.finalizeDeposit.selector
. The expected message length should be 68 bytes, but it is incorrectly checked as 36 bytes.
_parseL2WithdrawalMessage
function of the L1Nullifier
contract is used to parse the withdrawal message and returns withdrawal details.
The function performs an internal length check on _l2ToL1message
based on the function signature. However, when the bytes4(functionSignature)
equals IAssetRouterBase.finalizeDeposit.selector
, the expected length is incorrectly checked as 36 instead of the correct value of 68, as it requires at least two variables:
originalChainId: Uint256
assetId: Bytes32
Considering the variables required, the total expected byte length adds up to 4 + 32 + 32 = 68 bytes.
The implementation of the _parseL2WithdrawalMessage
function is provided below, highlighting the length check and the process of reading variables:
As mentioned in UnsafeBytes.sol, the byte length should be correctly validated before utilizing any functions from UnsafeBytes:
Without a proper length check, the function risks reverting with an OutOfBounds
error instead of the intended WrongMsgLength
error, revealing a flaw in error reporting logic and creating debugging challenges.
Furthermore, if the length exceeds 36, attempting to access bytes beyond this point could result in unpredictable runtime behavior, introducing unexpected and potentially harmful system outcomes.
Manual Review
Validate _l2ToL1message.length
against 68 instead of 36.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.