Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

withdraw() function doesn't send Ether to host, which leads to having Ether locked forever

Summary

While withdraw()withdraws all ERC20s, it does not withdraw Ether, which gets locked in the contract forever after deadline passes.

Vulnerability Details

After deadline, the refund() function is no longer callable because of the beforeDeadline modifier, leaving withdraw() as the only option to withdraw funds from the contract. However, this function only withdraws ERC20s, and not the Ether locked in the contract.

Recommendations

Add a ether transfer to the withdraw function:

function withdraw() external onlyHost {
address _host = getHost();
++ payable(_host).transfer(address(this).balance);
i_WETH.safeTransfer(_host, i_WETH.balanceOf(address(this)));
i_WBTC.safeTransfer(_host, i_WBTC.balanceOf(address(this)));
i_USDC.safeTransfer(_host, i_USDC.balanceOf(address(this)));
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

withdraw function lacks functionality to send ether

Support

FAQs

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