ChoosingRam::increaseValuesOfParticipants function allows an attacker to win every time by submitting the same NFT id as both tokenIdOfChallenger and tokenIdOfAnyPerticipent.Description: The ChoosingRam::increaseValuesOfParticipants function is supposed to update the characteristics of the NFT of the challenger if the value of the random variable is 0, otherwise, it should update the characteristics of the NFT of the tokenIdOfAnyPerticipent. Because there is no check that enforces tokenIdOfAnyPerticipent to be different than the tokenIdOfChallenger a malicious user can call this function and he is guaranteed to update his NFT every time, irrespective of what the value of random is.
Impact: A user can guarantee the update of the characteristics of his NFT, irrespective of randomness.
Proof of Concepts: Input the test below in the Dussehra.t.sol file.
Test output
Recommended mitigation: Add a new require statement that enforces the tokenIdOfAnyPerticipent and tokenIdOfChallenger are different.
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.