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

Battle manipulation risk due to using on-chain blockchain data to generate randomness

Summary

Using blockchain on-chain data to generate randomness allows battle manipulation.

Vulnerability Details

RapBattle uses blockchain on-chain data to generate the random number that will be used to determinate the winner.
These data are publicly accessible on the blockchain. Which means easily manipulable, and so the winner of the battle via random.

File: src/RapBattle.sol
uint256 random =
uint256(keccak256(abi.encodePacked(block.timestamp, block.prevrandao, msg.sender))) % totalBattleSkill;

Impact

The battle issue can be manipulated at will to favor a particular rapper.

Tools Used

Manual review

Recommendations

Use off-chain data to generate random.

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.