Mystery Box

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

REENTRANCY IN `transferReward()`

Summary:

The function first pushes the reward from, rewardOwned[msg.sender]at _index torewardsOwned[to]` then deletes the
reward at the given index from the senders reward list.

Vulnerability Details:

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:

The reentrancy could lead to unexpected behaviour, such as transferring the same reward multiple times or corrupting the reward
list, which could lead to loss of funds or rewards.

Tools Used:

Solidity aderyn slither

Recommendations:

 To mitigate this reentrancy follow the Checks Effect Interactions pattern. 
 You should make all state changes before calling an external function. 
Updates

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!