Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Function collectPresent() can be reentered multiple times

Summary

The collectPresent() function can be entered multiple times by NICE and EXTRA_NICE users due to this required statement.

            revert SantasList__AlreadyCollected();
        }

Vulnerability Details

after the time: block.timestamp < CHRISTMAS_2023_BLOCK_TIME, NICE and EXTRA_NICE can collect their presents. The if(balanceOf(msg.sender) > 0) is easily bypassed by the user collecting their present, then transferring their NFT to another account, making their balanceOf(msg.sender) back to 0;

Impact

Users can mint NFTs and SantaToken's as much at they desire.

Tools Used

hardhat.

Recommendations

Add a Mapping that will keep track if the user has collected their present instead of using balanceOf(msg.sender). If user collects present successfully, update mapping to true.

mapping(address => bool) collectedPresent;

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Weak Already Collected Check

Relying on balanceOf > 0 in collectPresent() allows the msg.sender to send their present to another address and then collect again.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.