Summary
The MysteryBox contract uses a weak random number generation method in its openBox function, which is vulnerable to prediction and manipulation. This can lead to attackers exploiting it to win rewards and exploiting the randomness aspect of the protocol.
The root of the bug lies in this line of code
This method relies on block.timestamp and msg.sender, both of which are predictable or manipulable, making the randomness vulnerable.
Critical-High
The users or miners can have a way to know the result of openBox beforehand, which will result in them:
Constantly win - Gold / Silver Coins.
Revert transactions so they can avoid - Coal.
Drain contract with unfair advantage / exploitation.
Manual Review.
Solidity in its nature has no secure way to generate truely random values so the recommentations are:
Use a verifiable random function (VRF) from a trusted oracle service like Chainlink VRF.
Use off chain solutions to generate true randomness.
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.