Mystery Box

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

No initial balance

Summary

The contract is initialized without an initial balance which creates aproblem for the logic of the contract.

Vulnerability Details

The problem with the constructor as it is, is that there is not an initial balance for the rewards meaning there might not be enough ether to give as rewards.For example lets say someone pays the 0.1 ether to buy a box using the buyBox function.and lets say through the randomValue in the openBox function he wins the 0.5 ether reward.there are not enough ether in the contract balance to give the reward to the user.

Impact

The impact of this vulnerability is that no rewards will be given in the situation above meaning user might just lose their funds without getting any rewards.

Tools Used

Manual

Recommendations

Make sure when the contract is constructed an inital balance is given to the contract that combined with the price of each box from each user is enough to give out the rewards.

Updates

Appeal created

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

Protocol should have a higher initial balance to prevent prize withdrawing problems

Support

FAQs

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

Give us feedback!