The claimSingleReward function in the MysteryBox contract contains an off-by-one error in its index validation logic. This allows users to attempt accessing an out-of-bounds index, potentially leading to unexpected behavior or contract failure.
The function incorrectly validates the index using <= instead of <, allowing an index equal to the length of the array, which is out of bounds.
The line require(_index <= rewardsOwned[msg.sender].length, "Invalid index"); is where the off-by-one error occurs, allowing an invalid index to pass the check.
Attempting to access an out-of-bounds index could cause the contract to revert, potentially disrupting service for legitimate users.
Manual review
Ensure the index is strictly less than the length of the array to prevent out-of-bounds access.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.