Mystery Box

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

Missing implementation for distribution the newly added rewards from the `rewardPool` through the `openBox` function

Summary

addRewardfunction allows the contract owner to add a new reward (name and value) to the rewardPool array.

By calling the openBoxfunction, randomValue is generated and then the user gets it`s reward, but only within the initialized by the constructor types of rewards.

Vulnerability Details

Although owneradds a new reward to the protocol, no functionality is provided for it's random picking process by the user, implemented in openBox function.

Tools Used

Manual review

Recommendations

To distribute the newly added rewards from the rewardPool through the openBox function, adjustments need to be the openBox logic so that it selects a reward from the rewardPool array based on randomization, instead of hardcoding specific rewards (like "Coal", "Bronze Coin", etc.).

Updates

Appeal created

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

addReward won't have any effect on openBox

Support

FAQs

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