Eggstravaganza

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

[H-1] `EggVault:depositEgg` has no access control.

[H-1] EggVault:depositEgg has no access control.

Description: Anyone can call EggVault:depositEgg and put any address the want as the depositor.

Impact: If someone sends an NFT to the EggVault but does not call the depositEgg function, anybody can call the function and put their own address as the depositor, then withdraw that NFT from the EggVault.

Recommended Mitigation: Change the depositEgg logic to transfer the NFT and update theeggDepositors mapping in one function. The storedEggs mapping can also be removed if using this logic.

function depositEgg(uint256 tokenId) public {
require(eggNFT.ownerOf(tokenId) == msg.sender, "You do not own this NFT");
eggNFT.transferFrom(msg.sender, address(this), tokenId);
eggDepositors[tokenId] = msg.sender;
emit EggDeposited(depositor, tokenId);
}
Updates

Lead Judging Commences

m3dython Lead Judge 8 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.

Give us feedback!