Mystery Box

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

Loss of Rewards in transferReward

Summary

In the transferReward function, the reward is deleted from rewardsOwned[msg.sender] using delete rewardsOwned[msg.sender][_index]. This does not shift the array, so the array will have gaps. This could lead to unintended behavior when interacting with the rewards array.

Vulnerability Details

MysteryBox.sol/Line 76

Impact

Users might lose rewards or experience inconsistent behavior when trying to transfer or claim rewards due to empty array slots caused by the delete operation.

Tools Used

Foundry

Recommendations

Consider using array shifting or swapping the last element with the deleted one before removing it to ensure proper handling of the array.

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:

A user can poison the `rewardsOwned` of another user via `transferReward` of an empty reward index

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

A user can poison the `rewardsOwned` of another user via `transferReward` of an empty reward index

Support

FAQs

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

Give us feedback!