Rewards added through MysteryBox::addReward function by the owner are never used.addReward function can be used by the owner of the protocol to add rewards to the rewardPool that are available for winning through buying and opening a box. But due to hardcoding of the rewards associated with each interval of randomValue inside openBox function, these new rewards being added are never utilised.rewardPool and have a picture of what the kind of rewards he might recieve and play the game.But he can only receive the rewards hardcoded in the openBox function. This makes the protocol a malciious one creating a misallignment between what players' might think they will win and what they actually can win by playing the protocol.Simple code inspection as explained above proves the vulenrability.
Rather than hardcoding the rewards corresponding to each inteval of randomvalue, following process of concept can be sued to mitigate this vulnerability.
Once a randomValue is calculated, the value 100 can be divided into number of intervals, that is equal to the length of rewardPool array.
Whichever interval the calculated randomValue falls in, the reward associated with that index must be awarded to the player.
the above conept can be applied in the openBox function as follows.
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.