EggVault::depositEgg()
is a public function that updates the internal mapping of egg ID to depositor (eggDepositors
). This function requires that the NFT has already been transferred and is currently owned by the vault. There are no other checks in this function regarding the original owner of the NFT. This means anyone can frontrun the function to insert themselves as depositors of the NFT in the eggDepositors
mapping. EggVault::withdrawEgg()
uses this mapping to allow withdrawals of the NFTs, which means the NFTs can be withdrawn by malicious users.
Users can steal NFTs from other users.
The test file already contains a proof of concept for this.
forge test --mt testVaultDepositAndWithdraw -vvvv
Relevant test portion:
Manual Review
Access control on EggVault::depositEgg()
can fix this vulnerability such that only the game contract can call this function. This would make EggHuntGame::depositEggToVault()
the only function that can call depositEgg()
, which finalizes the deposit right after the transfer.
Front-running depositEgg allows deposit ownership hijacking.
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.