The ChristmasDinner::withdraw
function lacks a deadline check which allows the host to withdraw funds prematurely, bypassing the refund period.
There is a missing deadline check in the ChristmasDinner::withdraw
function that allows the host to withdraw funds at any time, regardless of whether the event deadline has passed. The host can just drain all the funds that were deposited by participants, making it impossible for them to claim refunds before the deadline passes.
Add the following code to ChristmasDinnerTest::test_withdrawAsHost
:
In the ChristmasDinnerTest::test_setUp
a deadline is set for 7 days. Then, in the ChristmasDinnerTest::test_withdrawAsHost
the test simulates that 3 days have passed since the beginning of the fundraising event. Although there are 4 days left, the host still withdraws the funds. Now, if a participant decides to refund, they will not receive their deposits back.
Participants lose their deposits.
Participants lose their trust in the protocol.
The host can drain all deposited funds before the deadline passes.
The protocol's behavior of securing funds for the event until the deadline is flawed.
Manual review
Foundry
Add a check to the withdraw
function to ensure that it can only be called after the deadline has passed.
Add an appropriate event to revert with as well.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.