Mystery Box

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

Out-of-Bounds Access in `claimSingleReward` Function

Summary

The claimSingleReward function uses <= instead of < to check the index, which is out of bounds for zero-based indexing in arrays.

Vulnerability Details

The claimSingleReward function allows users to claim a single reward. The function uses the _index parameter to access the rewardsOwned array.

require(_index <= rewardsOwned[msg.sender].length, "Invalid index");

Impact

Attempting to access an index equal to the array's length can result in accessing uninitialized memory, which could lead to incorrect operations or vulnerabilities. This could cause the function to behave unexpectedly, potentially allowing users to claim non-existent rewards.

Tools Used

Manual Review

Recommendations

Using < instead of <= to ensure the index is within the valid range of the array.

require(_index < rewardsOwned[msg.sender].length, "Invalid index");
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.