Christmas Dinner

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

The user deposits ETH, but their participant status remains false.

Summary

Although the user has deposited ETH, the system does not update their status to "participant."

Vulnerability Details

https://github.com/Cyfrin/2024-12-christmas-dinner/blob/9682dcc306db935a2511e1eb8280d17ef01e9004/src/ChristmasDinner.sol#L205-L209

receive() external payable {
etherBalance[msg.sender] += msg.value;
emit NewSignup(msg.sender, msg.value, true);
}

This function only accepts ETH, but does not update the participant status, violating the contract's intended rules.

Impact

This results in a situation where a legitimate user fails to change their participation status to true by depositing ETH, which severely impacts the functionality of the contract.

Tools Used

Manual Review

Recommendations

To add the functionality that updates the user's participation status in the receive() function

receive() external payable {
etherBalance[msg.sender] += msg.value;
participant[msg.sender] = true;
emit NewSignup(msg.sender, msg.value, true);
}
Updates

Lead Judging Commences

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

receive does not update participation status

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

receive does not update participation status

Support

FAQs

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