An arbitrary address have NICE status as default in both of the mapping s_theListCheckedOnce
and s_theListCheckedTwice
which allows them to call collectPresent
and collect the reward without any being checked twice by santa.
As shown in the code below, enum with 4 values, NICE, EXTRA_NICE, NAUGHTY, NOT_CHECKED_TWICE. The default value of an enum is the first value, which is NICE. The mapping s_theListCheckedOnce
and s_theListCheckedTwice
are both mapping from address to Status. This means that an arbitrary address have NICE status as default in both of the mapping s_theListCheckedOnce
and s_theListCheckedTwice
which allows them to call collectPresent
and collect the reward without any being checked twice by santa.
POC, Here, Without checking user in both mapping, user have NICE status by default. Here, user is able to call collectPresent() function without being checked twice by santa. and collect the Present of NICE status i.e 1 SANTA(NFT) and 0 SantaToken.
This is the output in the terminal when we run the test.
Arbitrary address can call collectPresent
and collect the reward of NICE status without any being checked twice by santa.
Manual Review
foundry
This is a simple fix, just change the order of the enum values so that the default value is NAUGHTY.
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'.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.