In collectPresent
, the check if (balanceOf(msg.sender) > 0) revert SantasList__AlreadyCollected();
is useless. If someone has an NFT, they can simply transfer it to a friend or another address, making their original balance 0 so they can keep claiming more NFTs as long as they are still NICE
or EXTRA_NICE
.
Add this test to the existing suite. You could also write a more sophisticated script to automate this process of clearing an account of their NFT before collecting another gift.
A malicious user can mint as many free NFTs and/or tokens as they want.
Manual Review
Rather than checking the callers balance, make a Boolean mapping to determine if the person has already collected their gifts. Notice in the below fix that the effect (updating the mapping of the caller to true if they are about to mint free stuff), is executed before the actual minting (Interaction) process. This prevents re-entrancy attacks by following CEI.
Relying on balanceOf > 0 in collectPresent() allows the msg.sender to send their present to another address and then collect again.
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.