Santa's List

AI First Flight #3
Beginner FriendlyFoundry
EXP
View results
Submission Details
Impact: medium
Likelihood: low
Invalid

SantasList::checkTwice() does not check if person was first added to s_theListCheckedOnce as NICE or EXTRA_NICE

Root + Impact

Description

  • Describe the normal behavior in one or more sentences

  • Explain the specific issue or problem in one or more sentences

/*
* @notice Do a second pass on someone if they are naughty or nice.
* Only callable by santa. Only if they pass this are they eligible for a present.
*
* @param person The person to check
* @param status The status of the person
*/
function checkTwice(address person, Status status) external onlySanta {
@> // here there should be a check that person is in s_theListCheckedOnce
if (s_theListCheckedOnce[person] != status) {
revert SantasList__SecondCheckDoesntMatchFirst();
}
s_theListCheckedTwice[person] = status;
emit CheckedTwice(person, status);
}

Risk

Likelihood:

  • This lack of a check that address person has been given a Status in s_theListCheckedOnce will happen every time checkTwice() is called. The only thing that is checked by checkTwice() is that the parameter status be equal to a previously assigned status in the first mapping.

Impact:

  • Impact

  • Impact 2

Proof of Concept

Recommended Mitigation


An additional if-statement should be added to check whether the address was given the Status NICE or EXTRA_NICE beforehand. This is especially confused because Status defaults to NICE as its 0th element's value.

- remove this code
+ add this code
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge 12 days ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!