Mystery Box

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

Potential reentrancy attack

Summary

the call option of withdrawing ether is the most flexible option but it s quite risky because of its susceptibiliy to reentrant attack

Vulnerability Details

function withdrawFunds() public {
require(msg.sender == owner, "Only owner can withdraw");
- (bool success,) = payable(owner).call{value: address(this).balance}("");
+ (bool success,) = payable(owner).Transfer{value: address(this).balance}("");
require(success, "Transfer failed");
}

Impact

it is medium because even though it is susceptible to reentrant attack, it won't expose the user to external attack since the contract had been set to make sure only the owner can withdraw from it

Tools Used

Manual review

Recommendations

function withdrawFunds() public {
require(msg.sender == owner, "Only owner can withdraw");
- (bool success,) = payable(owner).call{value: address(thi).balance}("");
+ (bool success,) = payable(owner).Transfer{value: address(this).balance}("");
require(success, "Transfer failed");
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!