The depositEgg function allows depositing an NFT into the EggVault contract and associating it with a depositor address. However, it lacks a check to prevent the depositor address from being the zero address (address(0)).
The depositEgg function accepts a tokenId and a depositor address as parameters. It updates the eggDepositors mapping to link the tokenId with the provided depositor.
The corresponding withdrawEgg function requires that msg.sender matches the stored eggDepositors[tokenId] to allow withdrawal.
If a user mistakenly calls depositEgg with depositor set to address(0), the eggDepositors[tokenId] mapping will record the zero address for that specific tokenId. Consequently, the require(eggDepositors[tokenId] == msg.sender, "Not the original depositor") check in withdrawEgg will always fail because msg.sender can never be the zero address.
If an NFT is deposited with the depositor address set to address(0), it becomes permanently locked within the EggVault contract. No user, including the original owner or the contract owner, will be able to withdraw the NFT via the withdrawEgg function, leading to a permanent loss of the asset for the user.
Manual Review
Add a require statement at the beginning of the depositEgg function to ensure the depositor address is not the zero address.
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.