Eggstravaganza

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

EggNFT can be set more than once

Summary

EggNFT can be set more than once on setEggNFT on EggVault.sol

Vulnerability Details

function setEggNFT(address _eggNFTAddress) external onlyOwner {
require(_eggNFTAddress != address(0), "Invalid NFT address");
// not checking if eggNFT is already initialized
eggNFT = EggstravaganzaNFT(_eggNFTAddress);
}

Impact

EggstravaganzaNFT can always be changed, and if the depositor already deposit the egg before the eggNFT is changed, they cannot have withdraw it anymore on the new one.

Tools Used

  • Manual Review

Recommendations

Check if eggNFT is already have the address or already initialized using boolean flags, or checking if address is not 0.

Updates

Lead Judging Commences

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

State corruption

Changing the NFT contract address doesn't update the storedEggs and eggDepositors mappings

Support

FAQs

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