Randomness seed is generated from hashing msg.sender & block.timestamp. Both of these parameters are deterministic and can therefore be predicted to ensure the box is opened at an optimal time to gain a valuable reward.
Overview:
Using onchain values as a randomness seed is a well documented attack vector in the blockchain space.
Proof of Code:
Validators can know ahead of time the block.timestamp and can use this information to know when they should open their mystery box to gain the best possible reward.
Players can mine/manipulate their msg.sender value to ensure that they will roll the correct value to earn a rare reward.
Users can revert their MysteryBox::openBox transaction if they don't like the result of the reward the mystery box revealed.
Any player can predict when they should open their mystery box to guarantee a rare and valuable reward. Players will be able to turn 0.1 eth into a 0.5 or 1 eth reward consistently. Therefore, the protocol will be guaranteed to lose money, as the desired functionality of player's spending 0.1 ether and earning no reward 75% of the time is invalidated.
Manual review & Slither
Consider using a cryptographically provably random number generator such as Chainlink VRF.
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.