Hashing msg.sender
, block.timestamp
, block.prevrandao
together creates a predictable final number. A predictable number is not a good random number. Malicious users can manipulate these values or know them ahead of time to choose the winner of the battle themselves.
This vulnerability exists in the RapBattle::_battle function in the RapBattle.sol file starting on line 55.
Using block.timestamp as a source of randomness can lead to predictable outcomes. Since miners have some control over the timestamp within certain bounds, malicious miners may manipulate the timestamp to influence the outcome of the random number generation.
Manual Review
Instead of relying solely on block.timestamp, consider using more secure randomness sources, such as cryptographic randomness generated from a secure random number generator (RNG) or an external oracle (chainlink). Secure randomness sources provide stronger guarantees of unpredictability and resistance to manipulation.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.