Mystery Box

First Flight #25
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Potential Transfer of Zero-Value Rewards

Summary

The transferReward function allows the transfer of rewards by index. However, if a reward at a given index has been deleted, it can still be transferred as a default-valued reward, leading to unintended behavior and potential confusion.

Vulnerability Details

The transferReward function uses delete to remove rewards, which sets the reward to its default value but does not remove it from the array. Consequently, a reward at a deleted index can still be transferred, albeit with default values (e.g., an empty string for name and zero for value).

function transferReward(address _to, uint256 _index) public {
require(_index < rewardsOwned[msg.sender].length, "Invalid index");
>> rewardsOwned[_to].push(rewardsOwned[msg.sender][_index]);
>> delete rewardsOwned[msg.sender][_index];
}

Impact

Recipients may receive rewards with default values, which are not meaningful or intended, leading to user confusion.

Tools Used

Manual Review

Recommendations

Implement checks to ensure that only valid, non-default rewards are transferred

Updates

Appeal created

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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