Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Anyone can mint NFT

Summary

Anyone can call the function and mint an NFT since s_theListCheckedOnce and s_theListCheckedTwice for a random address has default value for enum Status - 0 NICE

Vulnerability Details

Just call collectPresent() function and mint your NFT!
POC:

function testAnyoneCanMintNFT() public {
address atacker = makeAddr("anyone");
vm.startPrank(atacker);
vm.warp(santasList.CHRISTMAS_2023_BLOCK_TIME() + 1);
santasList.collectPresent();
uint balance = santasList.balanceOf(atacker);
vm.stopPrank();
assertEq(balance,1);
}

Impact

Anyone can mint an NFT!

Tools Used

Manual review, Foundry

Recommendations

Change the enum STATUS so that in default value 0 to have a UNCHECKED value and implement it's needed checks.

enum Status {
UNCHECKED,
NICE,
EXTRA_NICE,
NAUGHTY,
NOT_CHECKED_TWICE
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

default status is nice

In Solidity the first element of an enum is the default value. In Santa's List, the means each person is mapped by default to 'NICE'.

Support

FAQs

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