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

Status in s_theListCheckedOnce and s_theListCheckedTwice will always be set to 0

Summary

If a person is not in s_theListCheckedOnce his status will default to 0.

Vulnerability Details

Any person that called in s_theListCheckedOnce has a default value of 0 (NICE) for status,
If a person has not went through the first check , the s_theListCheckedTwice mapping will have his Status set to 0 as default.

Impact

This means that any person can be set to "NICE" in without going through the first check.

Tools Used

Manual review

Recommendations

Enums starting from 0 is not a viable state, use other ways to store the Status.
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.