The depositEgg function in EggVault.sol is public and lacks proper access control, allowing anyone to call it and potentially mark an egg as deposited without proper validation or authorization.
The function:
It’s intended to be called by EggHuntGame.depositEggToVault after transferring the NFT, but since it’s public, anyone can call it directly.
An attacker could call depositEgg after transferring an NFT to the vault themselves, bypassing the game’s logic and potentially locking the NFT in the vault under their control.
An attacker could deposit eggs directly into the vault, bypassing game mechanics, and later withdraw them, potentially stealing or manipulating game assets.
This could disrupt the game’s intended flow and lead to unauthorized control over NFTs.
Manual code review.
Understanding of Solidity access control patterns.
Restrict depositEgg to only be callable by the EggHuntGame contract using an access modifier (e.g., onlyGame modifier) or by making it internal and calling it via a controlled function.
Example:
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.