Mystery Box

First Flight #25
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Valid

`randomValue` is not truely random

Summary

The random value generated in the openBox() function is not truly random and can be easily predicted because it relies on block.timestamp for randomness.

Vulnerability Details

The block.timestamp represents the current block's timestamp, which is set by the miner. Since miners can adjust this timestamp within a limited range, it is not entirely unpredictable, allowing them to exploit the contract.

Impact

By manipulating the block.timestamp, a miner could control the outcome to consistently open rare boxes, such as those containing a "Golden coin".

Tools Used

Slither, manual review

Recommendations

Implement a secure random number generation method like Chainlink VRF (Verifiable Random Function), which provides tamper-proof randomness through an oracle.

Updates

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Weak Randomness

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!