The withdraw_auto_from_l1
function in the L2 Bridge.cairo
contract uses the transfer_from
function to transfer tokens from the escrow to the recipient. This differs from the _withdrawFromEscrow
function in the L1 Escrow.sol
contract, which uses safeTransferFrom
. This inconsistency may lead to a situation where tokens are sent to recipient contracts that do not implement the required onERC721Received
interface, potentially causing tokens to become permanently locked in those contracts.
In the L2 Bridge.cairo
contract, the withdraw_auto_from_l1
function uses the transfer_from
function to transfer tokens from escrow to the recipient:
This approach does not perform any checks to ensure that the to
address is capable of receiving ERC721 tokens, such as checking for the implementation of the onERC721Received
interface. In contrast, the _withdrawFromEscrow
function in the L1 Escrow.sol
contract uses safeTransferFrom
:
The safeTransferFrom
function ensures that the recipient is either an externally owned account (EOA) or a contract that implements the onERC721Received
interface, as shown in the OpenZeppelin implementation:
If the recipient contract does not implement this interface, the transaction reverts, preventing the loss of tokens. The use of transfer_from
in withdraw_auto_from_l1
bypasses this safeguard, leading to potential loss of tokens if the recipient contract does not support the onERC721Received
interface.
Tokens may be sent to recipient contracts that do not support the onERC721Received
interface, leading to tokens being locked in the recipient contract without any way to retrieve them.
Considering that Ark
is a NFT Bridge, it is likely that there are 100's of transactions involving contracts and the onus is on the protocol to ensure that no transfers lead to token lockup scenarios.
Manual review
Consider modifying** **the withdraw_auto_from_l1
function to use safe_transfer_from
instead of transfer_from
to ensure that the recipient can properly receive the ERC721 tokens.
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.