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

Weak source of randomness leads to precomputable results

Summary

The use of weak source of randomness in the PuppyRaffle::selectWinner function leads to precomputable results.

Vulnerability Details

Anyone has access to the variables used to calculate the PuppyRaffle::winnerIndex and the PuppyRaffle::rarity variables. So anyone can precompute those results and participate only if they are going to win. The exploitability of this function is increased due to the functionality of the PuppyRaffle::refund function which allows participants to be dropped from the raffle without modifying the length of the PuppyRaffle::players array.

When calculating PuppyRaffle::winnerIndex, block.timestamp is used, this variable is a bit more tricky to use to exploit the vulnerability but it is not a problem at all.

Impact

The raffle can always be manipulated

Tools Used

Foundry

Recommendations

Chainlink's oracle can be used in order to prevent this

Updates

Lead Judging Commences

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

weak-randomness

Root cause: bad RNG Impact: manipulate winner

Support

FAQs

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

Give us feedback!