KittyConnect::mintBridgedNFT
Does Not Update KittyConnect::s_ownerToCatsTokenId
, Preventing Owners from Bridging NFTs Back to the Original ChainDescription: The mintBridgedNFT
function within the NFT bridge protocol is designed to mint a new NFT on the target blockchain, effectively bridging an NFT from the original chain to the target chain. However, it appears that this function does not update the s_ownerToCatsTokenId
mapping, which is crucial for tracking the ownership of NFTs across chains. This mapping is used in the KittyConnect::bridgeNftToAnotherChain
function, and if it's empty, this function will revert if the user tries to send the NFT back to the original or any other chain.
Impact: This issue can significantly impact the functionality of the NFT bridge, as it prevents owners from transferring their NFTs back to the original chain. This could lead to a loss of access to NFTs for users who have transferred them to another chain and wish to return them.
Proof of Concept: To demonstrate this issue, one can attempt to bridge an NFT back to the original chain after it has been minted on the target chain. If the mintBridgedNFT
function does not update the s_ownerToCatsTokenId
mapping, the system will not recognize the owner of the NFT, and the bridge operation will fail. This can be verified by attempting to call the KittyConnect::bridgeNftToAnotherChain
function and observing that the operation reverts due to the lack of an updated s_ownerToCatsTokenId
entry.
To test this add following test function to protocol test suit, and run it using a forked speolia testnet url.
Recommended Mitigation: o mitigate this issue, the mintBridgedNFT function should be modified to include a step where it updates the s_ownerToCatsTokenId mapping with the new owner's address and the token ID of the newly minted NFT. Here's a simplified example of how the mintBridgedNFT function might be modified to include the necessary update to the s_ownerToCatsTokenId mapping:
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.