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

Missing check for uninitialized status enum value leads to arbitrary minting

Summary

When the s_theListCheckedOnce and s_theListCheckedTwice are not initialized, the default value of the enum will be NICE. It will bypass the validation rules in collectPresent and earn the NFT.

Vulnerability Details

Since the default value of enum type will be its first value in the enum structure. In this case, all the default mapping value will be NICE. User bypasses the validation rules in collectPresent since s_theListCheckedOnce[msg.sender] == Status.NICE and s_theListCheckedTwice[msg.sender] == Status.NICE. Users are able to mint and receive the NFT even though they should be marked naughty later.

Impact

Unintended amount of NFTs will be allocated.

Tools Used

Manual Review

Recommendations

Add a new type in the first element in Status, such as UNINITIALIZED.

Updates

Lead Judging Commences

inallhonesty Lead Judge almost 2 years 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.