Christmas Dinner

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

It is possible to attend the event for Free

Description:

In the ChristmasDinner::refund() there is no mechanism which changes the status of participants. As a result the participants are still be able to attend the event with zero contribution.

Impact:

When this bug is exploited by even few of the participants, the host will not be able to organise the event properly as the funds will not be enough to cover the event's expenses.

Proof of Concept:

Please this code in ChristmasDinnerTest.t.sol.

  • run the following command forge test --mt test_refundButStatusNotChanged.

function test_refundButStatusNotChanged() public {
vm.startPrank(user1);
cd.deposit(address(wbtc), 1e18);
// the user ask for refund
cd.refund();
// after refund the user is still participant
assertEq(cd.getParticipationStatus(user1),true);
}

Recommended Mitigation:

function refund() external nonReentrant beforeDeadline {
...
+ participant[msg.sender] = false
emit Refunded(msg.sender);
}
Updates

Lead Judging Commences

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

refund does not update participation status

Support

FAQs

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