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

Users are marked as having NICE status on both lists by default

Summary

All users are marked as being NICE by default, regardless of whether or not they have been checked yet.

Vulnerability Details

In Solidity, if the key in a mapping has not yet been set, the zero (i.e. default) value for the type will be returned. In the case of the Status enum, the zero value is the first value of the enum, which is NICE.

Example:

function testCollectPresentWithoutAnyCheck() public {
vm.warp(santasList.CHRISTMAS_2023_BLOCK_TIME() + 1);
vm.prank(user);
// Should revert since user has not been checked by Santa.
santasList.collectPresent();
// User successful collected their present.
assertEq(santasList.balanceOf(user), 1);
}

Impact

Users that have not been checked at all will be able to collect a present.

Tools Used

  • Foundry

Recommendations

  • Add a NOT_CHECKED value for the Status enum as the first enum value

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.