Christmas Dinner

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

ETH is effectively trapped in the `ChristmasDinner` contract after deadline, as there’s no host withdrawal mechanism

Summary

In the ChristmasDinner::withdrawfunction it only sweeps the ERC20 tokens and not ETH effectively locking the ETH in the contract after the deadline passes.

function withdraw() external onlyHost {
address _host = getHost();
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)));
}

Vulnerability Details

When participants deposit ETH, the host has no way to withdraw it making the contract not working as it should and putting funds at risk. Once the deadline passes, there’s no method to recover that ETH at all, since refunds are only possible before the deadline.

Tools Used

Manual code review

Recommendations

Add this line to the withdraw function:

function withdraw() external onlyHost {
address _host = getHost();
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)));
+ payable(_host).transfer(address(this).balance);
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge about 1 year 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.

Give us feedback!