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

Attacker can Prevent user from collecting present

Summary

Attacker can prevent user from collecting by sending nft to the users address. This happens because the collectPresent track if a user has claimed his/her present by checking the number of nft in thier wallet. If the nft balance of user is greater than zero the function will revert. Attacker can take advantage of this by sending user one nft.

Vulnerability Details

DOS

Impact

user wont be able to collect present

Tools Used

foundry

Recommendations

present collected should be tracked with a separate state(enum) instead.

Updates

Lead Judging Commences

inallhonesty Lead Judge almost 2 years 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.