The collectPresent
function in the smart contract does not adequately verify if a person has already collected a present. This allows users to transfer their NFT to another address and collect as many present as he wants.
The vulnerability arises from the lack of proper verification in the collectPresent
function. The function only check if currently the user has a present, which is not the same that "user have already collected their gift". This enables users to transfer their NFT to any other address and collect presents infinitely.
By exploiting this vulnerability, "Nice" or "Extra-Nice" users can collect multiple presents by transferring their NFT to different addresses. This can lead to an unfair distribution of presents or a steal of all presents minting all possible NFTs.
Additionnaly, with this bad verification, If one user send a present to anyone who didn’t collect their present, this person won’t be able to collect the present they deserve.
Manual review
To mitigate this vulnerability, it is recommended to implement proper verification in the collectPresent
function. The function should check if a person has already collected a present and prevent them from collecting another one. This can be achieved by creating a mapping to keep track of addresses that have already collected a present.
Here is a possible solution :
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.