In the changeParticipationStatus function of the ChristmasDinner contract, a user can change their participation status from false to true (to become a participant) without making any deposit. This behavior occurs because there is no check to ensure that a deposit is made before allowing a user to join the event
In the current implementation, a user can change their participation status from false to true even if they haven't deposited any tokens. This happens due to the absence of a requirement that a user must have made a deposit in order to become a participant. The function checks if the user is already a participant (participant[msg.sender] == false), and if not, it allows them to change their participation status to true without any deposit, which is a critical flaw in the logic.
This vulnerability allows users to register as participants in the event without contributing any funds, which could lead to the system being misused. For example, a user could register to gain access to benefits or rewards that are intended only for contributors, without actually participating or supporting the event. This also undermines the integrity of the system, as participation should be tied to a deposit or some form of contribution. Also that allows a malicious user who became like that a participant, but has not contributed any funds, to be selected as the host. After becoming the host, they could withdraw all the funds from the contract and steal the assets from other participants.
Manual code review
It is recommended to add a check to the changeParticipationStatus function to ensure that users cannot change their participation status to true without having made a deposit. A possible solution is to add a condition that verifies if the user has a non-zero balance or contribution before allowing them to change their status.
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.