The MysteryBox contract uses a vulnerable method to generate random numbers for reward distribution. The randomness is based on easily predictable parameters (block.timestamp and msg.sender), making it susceptible to manipulation and allowing malicious actors to potentially influence or predict the reward selection process.
The openBox function generates a pseudo-random number using:
This method is predictable because:
block.timestamp can be estimated or manipulated slightly by miners.
msg.sender is known to the transaction sender.
An attacker can calculate the randomValue in advance and time their transaction to increase the likelihood of receiving a desired outcome.
This test demonstrates that the random value can be accurately predicted.
Users can manipulate the system to obtain desired rewards more frequently.
If exploited, users may lose confidence in the fairness of the reward system.
Manual code review
Implement Chainlink VRF (Verifiable Random Function) for secure, verifiable randomness.
Implement a two-step process using the hash of a future block for 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.