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

Anyone can collect presents when Christmas come.

Summary

When block.timestamp is equal to or grater than CHRISTMAS_2023_BLOCK_TIME i.e. when Christmas come, anyone will be able to collect presents even if they aren't checked

Vulnerability Details

Since the Enums default value is their first element, for this Enum https://github.com/Cyfrin/2023-11-Santas-List/blob/6627a6387adab89ae2ba2e82b38296723261c08a/src/SantasList.sol#L69 the default value will be NICE. When the function collectPresents is called, this line https://github.com/Cyfrin/2023-11-Santas-List/blob/6627a6387adab89ae2ba2e82b38296723261c08a/src/SantasList.sol#L154 will be evaluated to true, and msg.sender will be able to collect tokens even if he doesn't have any.

Impact

High

Tools Used

Manual review

Recommendations

Change the first value of the Enum to NAUGHTY

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.