Mystery Box

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

Weak random number generation in openBox

Summary

The openBox function uses block.timestamp and msg.sender to generate a "random" number, which is vulnerable to manipulation by miners or adversarial users, as these values can be influenced or predicted.

Vulnerability Details

Impact

The random number is predictable due to weak entropy sources.

Tools Used

manual review

Recommendations

While true randomness is difficult to achieve on-chain, you can improve randomness by incorporating more unpredictable inputs like block.difficulty or an external randomness oracle such as Chainlink VRF

uint256 randomValue = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, msg.sender))) % 100;
Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago

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!