Description:
Impact: High
Likelihood: High
The MysteryBox::openBox() function employs a so called Pseudo Randomness which makes it possible to predict the outcome of the function.
Vulnerable Code:
Impact:
Miners can directly force which reward they want to get when using MysteryBox::openBox() by either determining a block.timestamp in the future in which they want to open their box or alternatively mint new addresses until they have a suitable fit for the upcoming block.
Tools Used:
Manual Review and Forge.
Proof of Concept:
The following test and console output for example shows that MysteryBox::openBox() will always return the highest reward on block.timestamp = 1641070805 for the following addresses.
To verify the results use the following test in your existing repo:
In this example it is obviously possible to win the highest value price with 9 addresses on given block.timestamp. Note: 9 addresses within only 100 loops totalling a compute time of roughly 50ms.
Recommended Mitigation:
Use Chainlink VRF instead of predictable hashing.
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.