Mystery Box

First Flight #25
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

The protocol is susceptible to reentrancy attack.

Summary

the contract can be reentered due to use of low level call.

Vulnerability Details

The following functions transfer funds using the low level call; withdrawFunds(), claimAllRewards(), and claimSingleReward(). the issue here is that if the called address is a contract, it can callback into the contract to drain the contract funds. this is plausible before the state is being updated after the transfer of funds were made.

function claimSingleReward(uint256 _index) public {
require(_index <= rewardsOwned[msg.sender].length, "Invalid index");
uint256 value = rewardsOwned[msg.sender][_index].value;
require(value > 0, "No reward to claim");
(bool success,) = payable(msg.sender).call{value: value}("");
require(success, "Transfer failed");
delete rewardsOwned[msg.sender][_index];
}

Impact

draining of funds from the protocl

Tools Used

Manual Review

Recommendations

Use reentrancy guard and update state changes before token transfer or use safeTransfer function from openzeppellin

Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge
about 1 year ago

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

`claimAllRewards` reentrancy

`claimSingleReward` reentrancy

Support

FAQs

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

Give us feedback!