Mystery Box

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

Weak randomness In the `openBox` function.

Summary

The function is using a week random value. The block.timestamp is susceptible on manipulation by a validator's administrator. It is quite easy to prepare request for the highest reward rewardsOwned[msg.sender].push(Reward("Gold Coin", 1 ether)).

Vulnerability Details

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

Impact

Here weak randomValue can be use to select the highest Reward in openBox function

Tools Used

Foundry

Recommendations

Better use oracle for that like Chainlink's VRF or similar well auditing solution.

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!