The EggVault contract enables players to deposit and withdraw their egg NFTs into a vault. However, the depositEgg function does not verify that the depositor address matches the original depositor (msg.sender). Since the address depositor parameter is not validated, a player can deposit eggs to any address, preventing them from withdrawing their NFT later via the withdrawEgg function.
The depositEgg function lacks address validation checks for the address depositor parameter, which can result in a player's egg NFT becoming locked in the vault.
This vulnerability allows the following issues:
Players cannot withdraw NFTs accidentally deposited to other addresses.
Players may receive egg NFTs they did not earn from the hunt.
Bob accidentally deposits his NFT to Alice's address
Bob tries to withdraw the NFT
Fails with "Not the original depositor" error
Bob is unable to ever withdraw his NFT
Add the following test to EggHuntGameTest.t.sol file and run with forge test --mt testVaultEggsLockedFromOriginalDepositor.
Manual review, Foundry
Consider adding documentation to advise players to double check the addresses provided to the depositEgg function.
Additionally, implement a validation check to the depositEgg function, similar to the one in the withdrawEgg function:
Users can transfer NFTs directly to the vault using standard ERC721 transferFrom(), bypassing the registration
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.