The depositEgg
function in the EggVault
contract lacks proper access control, allowing any external caller to register an egg as deposited and assign an arbitrary depositor address. This could result in inconsistencies in game logic and misattribution of ownership.
The depositEgg
function is marked public
and can be called by anyone. While the contract checks that the NFT is already transferred to the vault and that it hasn't been deposited before, it does not restrict who can perform the call.
This means that a malicious actor could call the function before the legitimate game contract does, assigning themselves or another incorrect address as the depositor
of a given token ID.
Attacker waits for a user to transfer an egg NFT to the vault via depositEggToVault
in EggHuntGame
.
Attacker front-runs the expected call to depositEgg
by calling below.
The egg is now recorded as deposited by the attacker instead of the actual user, which can impact logic dependent on eggDepositors
.
Incorrect attribution of egg ownership within the vault.
Potential to disrupt reward systems, eligibility checks, or future logic based on the depositor field.
No direct loss of funds or NFTs due to existence of ownerOf and duplicate guard checks.
This is a Low severity issue per CodeHawks standards, as it introduces a logic flaw and potential for misbehavior but does not endanger assets directly or indirectly.
Restrict the depositEgg
function so it can only be called by the game contract:
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.