Description: The EggVault::depositEgg
function is publicly accessible, allowing any external caller to execute it. In a situation where a player does not call the intended EggHuntGame::depositEggToVault
and manually transfers the EggstravaganzaNFT
, an attacker can frontrun the subsequent EggVault::depositEgg
call by passing the an arbitrary address as the depositor and illegitimately claim the unclaimed tokenId
of the NFT. This is possible because there is no proper access control on the public EggVault::depositEgg
function.
Impact: Unauthorized users might be able to claim ownership of NFTs sent to the vault by legitimate players, by frontrunning the EggVault::depositEgg
transaction. This can lead to loss of assets as ownership can be stolen before rightful ownership is established, undermining trust in the protocol.
Proof of Code:
Code
Recommended Mitigation: A strict access control mechanism should be implemented to ensure that only the EggHuntGame
contract is allowed to call EggVault::depositEgg
. Additionally, users should be explicitly warned not to send NFTs directly to the contract via transferFrom
, as such transfers cannot be tracked or recovered by the contract, potentially resulting in asset loss.
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.