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

Incorrect status type positions

Summary

With the status type set to NICE at position 0 - the default value for any address, it implies that any user can be in the NICE status without having to go through Santa's check functions.

Vulnerability Details

Impact

Any user can call the collectPresent() function with the status type set to NICE to mint 1 NFT token.

Test

function testDefaultType() public {
    assertEq(uint256(santasList.getNaughtyOrNiceOnce(user)), uint256(SantasList.Status.NICE));
    vm.warp(santasList.CHRISTMAS_2023_BLOCK_TIME() + 1);
    vm.prank(user);
    santasList.collectPresent();
    vm.stopPrank();
    assertEq(santasList.balanceOf(user), 1);
}
## Recommendations
Change the positions of the status types in Status:
```solidity
enum Status {
NOT_CHECKED_TWICE,
NAUGHTY,
NICE,
EXTRA_NICE,
}
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.