The depositEgg function is public, allowing anyone to call it with any tokenId owned by the vault and set any depositor.
The function checks eggNFT.ownerOf(tokenId) == address(this), but lacks caller restrictions, allowing manipulation. For example, if a player transfers an NFT to the vault and calls depositEgg with their address, they can set themselves as the depositor, bypassing intended ownership checks.
Unauthorized users could transfer NFTs to the vault and claim ownership by calling depositEgg, enabling them to withdraw eggs they didn't deposit.
Manual code review
Solidity best practices and ERC721 standard guidelines
Grok by xAI
Restrict depositEgg to only be callable by the EggHuntGame contract or owner. Add a gameContract variable and modify the function:
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.