A key invariant of the protocol is
An address is only allowed to collect 1 NFT per address, there is a check in the codebase to prevent someone from minting duplicate NFTs.
But this it's possible for users once they get NICE
or EXTRA_NICE
eligibility to collect as many tokens as they want.
The function SantasList::collectPresent
contains a check to verify if an user already claimed a present by checking the balance of the user.
But an user can easily circumvent this check by transferring the token to a second account to gain access the function again to collect a second present. This process can be repeated by the user many times.
This attack is possible because the eligibility of the user is not set to NOT_CHECKED_TWICE
after minting the presents.
Paste the following test in SantasListTest.t.sol
to test this vulnerability.
Invariant of the protocol broken.
Foundry and VS Code
Don't check the balance of the user and instead set the status of the user to NOT_CHECKED_TWICE
.
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.