The ChoosingRam::increaseValuesOfParticipants
function allows for the possibility of increasing the value of non-existent tokens due to improper validation checks on token IDs. This can lead to unintended behavior and potential manipulation of the game mechanics, as non-existent tokens should not have their values increased.
ChoosingRam::increaseValuesOfParticipants
function is used to increase value of Ram NFT. Challenger is calling function and plays against participant by providing his token id and token id of participant.
In this function there is check that token id of participant must be less than or equal to token counter. This is not correct, because RamNFT::tokenCounter
returns number of tokens that exist and minting in RamNFT
contract starts from token id 0. So if there are 2 tokens, token id 0 and token id 1 exist, but token id 2 does not exist yet. If token id 2 is used as parameter, function will not revert which is incorrect.
Player 1 and player 2 mint their Ram NFT, token id 0 and 1. Token id 2 does not exist yet.
Player 1 with token id 0 plays against non-existant token id 2.
Value of token id 0 or token id 2 is increased based on random value.
Assert that value of token id 0 or token id 2 is increased to Jita Krodhah.
Place the following test into Dussehra.t.sol
.
Token that currently does not exist can increase its value. One player could play multiple times against this non-existant token, because its win-win situation for him. If that non-existant token accrues bigger value, player just needs to mint that token.
Another situation is that if non-existant increase value to become selected Ram, it will be possible to kill Ravana by calling Dussehra::killRavana
function even if no one mints that token.
Manual review
Change operator in ChoosingRam::increaseValuesOfParticipants
function to >=
.
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.