Description
Hashing msg.sender and block.timestamp together creates a predictable value that can be used to determine the reward. Malicious user can use this predictable value to influence the rewards and get a higher reward than expected. Also a user can mine an address to get a higher reward than expected.
Additionally, a user can front-run the MysteryBox::openBox function and if the reward is not higher than expected user simply reverts the transaction.
Impact
User can get a higher reward than expected.
Proof of Concepts
1-Attacker sets up a contract with a attack funtion to buy a box and open it.
2-If the reward is not higher than expected, attacker can revert the transaction.
Additionally,
3-Validators can know ahead of time the block.timestamp and use that to predict when/how to open the box.
Proof of Code
Place to following into TestMysteryBox.t.sol
And this contact as well
Recommended mitigation
Consider using crytographically secure random number generation 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.