Wrong default value of Status
data type allows anyone to collect NFT.
The default value of Status
enum is NICE
. Due to this, all the addresses in both the s_theListCheckedOnce
and s_theListCheckedTwice
variables will have NICE
Status.
With NICE
Status, any user/address can call collectPresent
function without calling checkList
and checkTwice
functions and collect their present.
Due to the default NICE
Status, any user can collect their NFT without any confirmation from Santa
.
Hence, destroying the whole contract's purpose.
To execute this test : forge test -vvvvv
Manual Review
To mitigate the vulnerability, the order in which members are present in the Status
enum should be changed, such that, the default value is neither NICE
nor EXTRA_NICE
.
Here's how you can modify it:
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.