Addresses on Layer 2 (Starknet) are of type felt252
while on the Layer 1 (Ethereum) are of type uint160
. It's important that the matching between the different address versions is preserved correctly.
Particularly during cross-layer messaging, Solidity addresses are given as uint256
which is greater than felt252
and this may cause issues in the matching.
A good way to avoid this type of issues is to ensure that when sending a message from L1 to L2, all inputs are validated properly: address should be lower than the Finite Field order p
used on the Layer 2.
This is correctly done in Bridge::depositTokens()
:
However, this is not done in Bridge::setL1L2CollectionMapping()
/ CollectionManager::_setL1L2AddressMapping()
:
CollectionManager.sol#L151-L165
This _l1ToL2Addresses
mapping is then used in Bridge::depositTokens()
to build the request to be passed to L2. Thus, if on L1 it builds a message with values above the maximum felt252
, the message will be stuck and never consumed on L2.
This can cause severe disruption to the protocol's functionality, as all users' calls to Bridge::depositTokens()
will be stuck and never consumed on L2. The admin will have to call Bridge::startRequestCancellation()
, wait 5 days, and then call Bridge::cancelRequest()
for each transaction to recover the NFTs.
Add the same check used in Bridge::depositTokens()
to CollectionManager::_setL1L2AddressMapping()
:
Please, do not suppose impacts, think about the real impact of the bug and check the CodeHawks documentation to confirm: https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity A PoC always helps to understand the real impact possible.
Please, do not suppose impacts, think about the real impact of the bug and check the CodeHawks documentation to confirm: https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity A PoC always helps to understand the real impact possible.
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.