Christmas Dinner

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

The host can withdraw funds before the dealing, leaving participatngs unable to refund.

Summary

The host can withdraw funds before the dealing, leaving participatngs unable to refund.

Vulnerability Details

In the current implementation of the "ChristmasDinner" smart contract, the host has the unrestricted ability to withdraw funds before the deadline, which poses a significant risk to participants. This functionality allows the host to remove all collected ERC-20 tokens from the contract at any time, potentially before participants decide to opt out or seek refunds. If the host exercises this option prematurely, participants could be left without the means to retrieve their contributions, leading to financial losses and undermining trust in the event's management. This situation highlights the need for additional safeguards in the contract, such as restrictions on withdrawal timings or conditions that ensure funds are available for refunds and the successful execution of the event, thereby aligning the interests of the host and participants for a fair and transparent management of the event.

Impact

The ability of the host to withdraw funds from the "ChristmasDinner" smart contract before the deadline can severely impact participants, leaving them unable to claim refunds should they decide to withdraw their participation. This unrestricted access to withdrawals could lead to significant financial losses for participants and severely damage trust in the contractual arrangement and its management. Additionally, it may discourage future participation and affect the reputation of the organizers, as potential participants might view the event and associated contracts as unreliable or unfairly managed, leading to broader implications for user engagement and the overall success of similar future events.

Tools Used

foundry

Recommendations

Only allow the withdrwl after deadline:

function withdraw() external onlyHost {
require(block.timestamp > deadline, "Withdrawal not allowed before deadline");
// Withdrawal logic
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)));
}
Updates

Lead Judging Commences

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

withdraw is callable before deadline ends

Support

FAQs

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