Withdrawing from the Bridge
is incompatible with contracts that implement IERC721Receiver
.
The relevant withdrawTokens
implementation is listed below:
The logic works as follows.
If the token was in circulation when bridged (i.e. purchased from a marketplace), it can be withdrawn from the escrow via _withdrawFromEscrow
:
Conversely, if the token is one of the proxy implementations used to represent a collection item bridged from Starknet, the corresponding token is newly minted via mintFromBridge
:
Notice that these transfers are implemented inconsistently.
When transferring a token to a contract receiver during _withdrawFromEscrow
, we correctly invoke onERC721Received
to prevent tokens from being sent to receiver contracts which fail to acknowledge the inbound transfer of NFTs.
However, when dealing with bridge tokens, we use _mint
instead, meaning that we do risk transferring tokens to incompatible receivers depending on the underlying token type:
This means any contracts which define the onERC721Received
callback as a critical component of the transaction lifecycle are compatible with tokens that originate from the market, but incompatible with those specifically generated by Ark.
Stuck bridgeable tokens on destination contracts that demand communication via onERC721Received
.
Manual Review
Use safeMint
whilst minting bridgeable tokens.
Note, following this recommendation may result in unintentional re-entrancy. Consider adding a
nonReentrant
modifier to all untrusted external parents of invocations tomintFromBridge
.
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.