Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

The first entrants of the contract can get back the value of the entrance fee even if he/she paid nothing

Summary

The first entrants of the raffle will be paying nothing to enter the raffle but can get a refund which is equal to entranceFee which the contract is initialized with.

Vulnerability Details

The enterRaffle contracts allows for the msg.value to be equal entranceFee * newPlayers.length, where the newPlayers.length in initialized with zero making the first entrants pay nothing to enter the raffle. However, the refund in the refund function allows for every players to get refunded the entrance fee (payable(msg.sender).sendValue(entranceFee)).

Impact

Contract ends up having less money than it should have or goes out of balance leading to loss by some users.

Tools Used

Manual Review

Recommendations

There should be a mapping which keep tracks of how much each user paid to enter the raffle and the fund should be based on that.

Updates

Lead Judging Commences

Hamiltonite Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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

Give us feedback!