Christmas Dinner

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

The `ChristmasDinner::changeParticipationStatus` function lacks payment validation, allowing unpaid users to change their participation status.

Summary

In the ChristmasDinner::changeParticipationStatus function, there is no validation to check whether a participant has made a payment. This may allow attackers to change their status to a participant without making any payment, impacting the contract's fairness and fund security.

Vulnerability Details

The ChristmasDinner::changeParticipationStatus function changes participation status based solely on the current state and time without verifying whether balances[msg.sender][token] is greater than zero, meaning it does not validate whether the user has made a payment. The function lacks logic to verify the payment status of users, allowing attackers to call this function and change their status to participant without making any actual payment.

Impact

  • Abuse of Participation Privileges
    Attackers can bypass the payment requirement to become a participant and gain access to privileges or resources without contributing any funds.

  • Financial Loss
    If the contract contains logic to allocate funds or benefits to participant members, it may result in a loss of benefits for actual contributors.

  • System Integrity Damage
    This vulnerability undermines the fairness and credibility of the contract, reducing user trust and affecting community participation.

Tools Used

Manual review.

Recommendations

Add payment validation logic to the changeParticipationStatus function to ensure that only users who have made a payment can change their status to participant.

function changeParticipationStatus() external {
if (participant[msg.sender]) {
participant[msg.sender] = false;
} else if (!participant[msg.sender] && block.timestamp <= deadline) {
+ // Ensure the user has made a payment before allowing them to become a participant
+ bool hasPaid = false;
+ for (uint i = 0; i < whitelistedTokens.length; i++) {
+ if (balances[msg.sender][whitelistedTokens[i]] > 0) {
+ hasPaid = true;
+ break;
+ }
+ }
+ require(hasPaid, "No payment made, cannot become a participant");
participant[msg.sender] = true;
} else {
revert BeyondDeadline();
}
emit ChangedParticipation(msg.sender, participant[msg.sender]);
}
Updates

Lead Judging Commences

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

usage of change participation logic circumvents deposit

Support

FAQs

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