Mystery Box

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

accidental loss of user rewards when using `transferReward()` function

Summary

Users can mistakenly transfer rewards to the zero address when using the transferReward() function resulting in loss of funds.

Vulnerability Details

The transferReward()function is missing a zero address check for the _to parameter input when a user transfers their rewards, resulting in accidental loss of funds.

Impact

Loss of user funds to the zero address.

Tools Used

Manual review.

Recommendations

Apply a requirestatement to the function to avoid accidental loss of user funds when using the function to transfer rewards.

function transferReward(address _to, uint256 _index) public {
+ require(_to != address(0), "Cannot trasnfer to address(0).")
require(_index < rewardsOwned[msg.sender].length, "Invalid index");
rewardsOwned[_to].push(rewardsOwned[msg.sender][_index]);
delete rewardsOwned[msg.sender][_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.