The bridge on L2 does not update the escrow
map when withdrawing NFTs causing users' NFTs to be stuck in the bridge when using auto-burn.
Currently when an NFT is bridged, it is escrowed in the bridge from which it comes. If the user specifies the auto-burn flag, this NFT should be burnt after successful bridging.
In order to keep track of escrowed NFTs, both bridges (L1 and L2) have mappings indicating if a NFT is escrowed or not.
On L2 this is done like this:
We see that if the collection's token_id
is contained in the escrowed
mapping, the bridge tries to transfer the NFT to the user as it assumes that it is escrowed in the bridge.
The problem is that the escrow
mapping is never updated. This means that once the NFT is marked as escrowed, it will always be, even if the NFT is transferred out of the bridge!
Let's take the following scenario:
User bridges NFT from L2 to L1 -> NFT is escrowed in L2 bridge
User bridges NFT back from L1 to L2 with ENABLED auto-burn
-> NFT gets burnt on L1
-> NFT gets transferred to owner on L2
User bridges the NFT back to L1 with ANOTHER bridge which burns it
User bridges back to L2
Now the bridge thinks the NFT is still escrowed in it even though it is not existent on L2
This means withdraw_auto_from_l1
will fail, causing the bridging to fail needing admin intervention to get the NFT back again.
Manual review
This is easy to fix by updating the escrow
mapping, removing the NFT if the transfer was successful. (As it is done on L1)
Impact: Incorrect state without any other impact, which deserves a Low according to CodeHawks documentation.
Impact: Incorrect state without any other impact, which deserves a Low according to CodeHawks documentation.
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.