Due to the improper check of whether the user collected, malicious users can abuse it to collect more than one presents.
The collectPresent
function in SantasList.sol
is intended to allow users to collect a single present. It attempts to enforce this by checking the balance of msg.sender
to ascertain if they have already collected a present. However, this can be heavily bypassed. An attacker can easily circumvent this check by transferring their NFT to a different address under their control and then repeating the collection process. This allows unlimited present collection by a single user through the use of multiple addresses.
Attackers can unlimitedly call collectPresent
.
Manual Review + Foundry
Consider using a mapping variable to store the status of a user. Instead of using balanceOf
to check if the person has collected.
Once the user has collected, change the status of the user.
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.