Description:
The function changeParticipationStatus can be called by anyone, since there are neither controls nor modifiers that prevent random callers to be listed as participants.
Impact:
This problem is considered to be high-severity, since this will heaviliy interfere with the organization of the Christmas dinner. Indeed, a random user could trick the host and list themselves as a participant even without sending any whitelisted ERC20 token or ETH.
In the documentation for ChristmasDinner it is clearly stated that
"with our Christmas Dinner Contract we directly "force" the attendees to pay upon signup".
The function changeParticipationStatus allows, in fact, the prohibited behavior, since there is no enforcement of payment for users to be listed as participants.
Tools Used:
Manual review
Proof of concept:
Add this test to ChristmasDinnerTest.t.sol. This demonstrates that a user can change their participation status to true even though they didn't deposit any whitelisted ERC20 token or ETH.
Recommended mitigation
The proposed mitigation aims at maintaining a strong readbility of code. To achieve this it is recommended to add a private function hasDepositedFunds to check whether the user has already deposited one (o more) of the whitelisted ERC20 token or ETH. A new modifier is then created to implement this control on the changeParticipationStatus function. In case the user has not deposited any funds, the modifier will cause the function to revert with a custom error OnlyUserWithDepositedFundsCanChangeTheirStatus.
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.