The depositEgg() function in EggVault.sol is publicly accessible and allows any caller to register themselves (or any address) as the depositor of a transferred NFT. If a user transfers an NFT to the vault and then attempts to call depositEgg() instead of using the depositEggToVault function, a front-running attacker can intercept the transaction and register themselves as the depositor, resulting in stolen withdrawal rights.
The vulnerable flow occurs when:
A user approves and transfers their NFT to the vault.
They then call depositEgg(tokenId, user) to register it.
However, depositEgg() is public and does not restrict the caller or depositor address.
An attacker can monitor for NFT transfers and front-run the call to register themselves as the depositor:
Theft of NFTs: Attacker becomes the recorded depositor and can withdraw the egg.
Broken trust in the vault: Users may lose valuable assets through UI interactions or custom scripts.
Manual Code Review
Foundry Test Suite
Make depositEgg() callable only by a trusted source — e.g., the EggHuntGame contract — by adding an access control check:
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.