Description
ChoosingRam::increaseValuesOfParticipants
uses Weak PRNG due to a modulo on block.timestamp, now or blockhash. These can be influenced by miners to some extent so they should be avoided. Given that this function can be called many times in succession, 5 calls within the same block will return the same answer. A miner can influence this to make sure that their token is the one selected to have its values increased, then call the function in succession within the same block.
Impact
As this method of RNG can be influenced or predicted, this renders the randomness of selecting a winner not best practice and creates an unfair environment for participants.
Proof of Concepts
Run the following test in any test suite:
When running the test multiple times the same answer of 0
was returned. Without calling vm.warp and modifying the block.timestamp this calculation will always return the same result.
for further context see the following slither documentation:
https://github.com/crytic/slither/wiki/Detector-Documentation#weak-PRNG
Recommended Mitigation
Consider using Chainlink VRF as this is a cryptographically proven way of choosing a random number.
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.