The revert SantasList__AlreadyCollected()
message is enforced using a balance check, resulting in easy manipulation to collect more than one NFT.
In the external collectPresent()
function, it is stated in 2 places that addresses should not be able to collect an NFT more than once (the natspec @notice
comment on line 145, and the SantasList__AlreadyCollected
revert message on line 152).
Despite the aforementioned rule, a malicious actor may bypass the balance check on line 151 by sending their previously minted NFT to a different wallet, and then called collectPresent()
again. They may do this repeatedly and infinitely.
The below PoC (written as a forge test) demonstrates a NICE
user repeatedly minting and transferring the NFT to an alternative wallet, resulting in a token balance of 1,000.
Users may repeatedly mint many NFTs, potentially destroying the value of each token due to so much supply.
Forge
Use a mapping
to track which addresses have collected their NFTs, rather than a balanceOf()
check.
Make sure to update the mappings value for the person
upon minting in both the collectPresent()
and buyPresent()
functions as well.
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.