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

The calculation of totalAmountCollected is incorrect.

Summary

The calculation of totalAmountCollected is incorrect because it includes people who have withdrawn.

Vulnerability Details

The formula is as follows
uint256 totalAmountCollected = players.length * entranceFee;
The player who performed a refund is assigned a zero address in the index and becomes non-active, but the length of the array remains the same. Therefore, the returned fee is also included in the calculation formula.

Impact

Calculate the wrong amount when distributing the award.

Tools Used

Manual

Recommendations

When making a player non-active, the length of the array is also changed.

Updates

Lead Judging Commences

Hamiltonite Lead Judge about 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

refund-doesnt-reduce-players-array-size-causing-protocol-to-freeze

zero address can win the raffle

Funds are locked to no one. If someone gets the refund issue, they also got this issue. IMPACT: High Likelihood: High

Support

FAQs

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

Give us feedback!