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

selectWinner can be frontrun

Summary

selectWinner() can be frontrun to select the preferable outcome.

Vulnerability Details

Nothing prevents users from entering or refunding a raffle even if the transaction that contains selectWinner() was submitted. Indeed, that transaction is visible in the mempool by anyone and can be front-runned or even delayed by an attacker. In that case, the attacker could wait for the right RNG state to enter the raffle and call selectWinner to be selected as a winner.

Please note this is a different bug than my other submission where the RNG is not strong enough. Here the problem is due to the way a miner can re-organize transactions based on MeV. If not accounting for it correctly, an attacker can manipulate the re-ordering to get the most favorable outcome.

Impact

Attacker can force his way to be selected as a winner every time.

Tools Used

Manual review.

Recommendations

The protocol should implement a 2-steps process that are mutually exclusive:

  • first step allows users to enter the raffle and exit it by getting a refund (it could be based on a time period for example).

  • second step, only selectWinner() can be called. This insures that the winner selection process cannot be front-runned.

Updates

Lead Judging Commences

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

selectWinner can be frontran

Support

FAQs

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

Give us feedback!