This function, depositEggToVault
, allows a player to deposit their egg (NFT) into the Egg Vault. But there’s a potential problem with security that could allow someone to exploit it.
** Lack of proper access control:** The function only checks if the player is the owner of the egg. But it doesn’t have any extra protections, like ensuring only certain people (the actual player) can call this function. This can lead to bad actors potentially exploiting it if other parts of the system aren’t secure.
NFT Transfer Approval: The player must first approve the NFT for transfer. This is important because without the approval, the contract can’t transfer the NFT. But if a player forgets or doesn't do it, the function won't work properly.
Potential exploit: If there's no proper protection, someone could trick the system and steal the NFT by taking advantage of the weak points in the code.
The main risk is that a player could lose control of their NFT if there’s a mistake in the process, or if the contract is manipulated by a malicious user.
Manual code review.
Add proper access control: Use a method like require(msg.sender == owner)
to make sure only the person who owns the egg (NFT) can deposit it into the vault.
Ensure approval is in place: Always make sure the player approves the contract to transfer the NFT before calling the depositEggToVault
function. This will ensure the transfer happens smoothly.
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.