ChoosingRam::selectRamIfNotSelected
and ChoosingRam::increaseValuesOfParticipants
are only pseudo random. It allows users to influence and predict outcome of which ramNFT will be selected and hence enable gaming of the outcome of the Dussehra
protocol.Description:
Hashing block.timestamp
and block.prevrandao
together at ChoosingRam::selectRamIfNotSelected
creates a predictable final number. It is not a truly random number. It is possible for an organiser to calculate the outcome before calling the function, allowing them to choose who will be the winner.
Similarly, hashing block.timestamp
, block.prevrandao
and msg.sender
together at ChoosingRam::increaseValuesOfParticipants
also creates a predictable final number. This time, though, the addition of msg.sender
also allows the final number to be influenced, choosing which of the two participants will receive the increased value.
Impact:
The organiser can choose who get to be selected as Ram.
Any participant can game the seemingly random selection of tokenIdOfChallenger
or tokenIdOfAnyPerticipent
at the increaseValuesOfParticipants
.
A central element of the intended functionality of the protocol is the random selection of Ram. This vulnerability breaks this intended functionality.
Proof of Concept:
The organiser knows ahead of time the block.timestamp
andblock.prevrandao
and uses this calculate outcome of calculation of "random" value.
When this value brings up the correct RamNFT id, organiser calls the selectRamIfNotSelected
function.
The expected participant is selected as the winner.
Recommended Mitigation: Use an off-chain verified random number generator. The most popular one is Chainlink VRF, but others exist. As this will require extensive refactoring of code, I did not write out the mitigation here.
The organizer is trusted, but the function `ChoosingRam::selectRamIfNotSelected` uses a way to generate a random number that is not completely random.
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.