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

Winner could be zero address

Summary

In certain cases, the winner could be zero address.

Vulnerability Details

Imagine a situation a user, say ABC enters the raffle, and is in 10th index position. But after some time, ABC changed the mind and went to get the refund using the function with the same name, which makes the players[10] = address(0). Now if someone calls the function selectWinner(...) and the winnerIndex is calculated as 10, then winner will be address(0). And there is no check for zero address done as well.

Impact

  • Loss of funds to zero address.

Tools Used

Manual Review

Recommendations

Either checking if the index found has a non zero address, or using a modified version of the internal function _isActivePlayer(...) which takes the index and returns true if the index is a non-zero address.

Updates

Lead Judging Commences

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

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.