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

Validators can choose the winner

Description

In RapBattle::goOnStageOrBattle, the winner is decided using the random variable which uses block.timestamp, block.prevrandao, and msg.sender to be random. The problem is that validators can slightly move these variables during block validation. A malicious validator is able to manipulate the randomness and choose a winner.

uint256 random = uint256(
keccak256(
@> abi.encodePacked(block.timestamp, block.prevrandao, msg.sender)
)
) % totalBattleSkill;

Risk

Likelyhood: Low

  • Only validators can manipulate the randomness.

Impact: High

  • Validors are able to manipulate the randomness and choose a winner.

Recommended Mitigation

Use an oracle like Chainlink to obtain real randomness.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Weak Randomness

Support

FAQs

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