Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Unrestricted depositEgg() Function (Access Control Bypass)

Summary

Malicious users can spoof deposits, corrupting vault state and enabling theft.

Vulnerability Details

function depositEgg(uint256 tokenId, address depositor) public

Impact

Anyone can call depositEgg(), allowing fake deposits even if the NFT was never transferred.

Tools Used

manual review

Recommendations

this should be best implemented with this snippet

function depositEgg(uint256 tokenId) external {

require(eggNFT.ownerOf(tokenId) == msg.sender, "Not NFT owner");

eggNFT.transferFrom(msg.sender, address(this), tokenId); // Move NFT first

storedEggs[tokenId] = true;
eggDepositors[tokenId] = msg.sender;
emit EggDeposited(msg.sender, tokenId);
}

Updates

Lead Judging Commences

m3dython Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Frontrunning Vulnerability DepositEgg

Front-running depositEgg allows deposit ownership hijacking.

Support

FAQs

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