Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Invalid

The EggVault.depositEgg method needs to add permission check

Summary

The EggVault.depositEgg method needs to add permission check

Vulnerability Details

The EggVault.depositEgg method lacks permission check

Impact

If the user accidentally sends the nft directly to the Vault, the attacker can steal it directly.

Tools Used

Recommendations

....
++++EggHuntGame public eggHuntGame;
....
function depositEgg(uint256 tokenId, address depositor) public {
+++ require(msg.sender == eggHuntGame,"");
require(eggNFT.ownerOf(tokenId) == address(this), "NFT not transferred to vault");
require(!storedEggs[tokenId], "Egg already deposited");
storedEggs[tokenId] = true;
eggDepositors[tokenId] = depositor;
emit EggDeposited(depositor, tokenId);
}
Updates

Lead Judging Commences

m3dython Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.