Christmas Dinner

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

receive()

Summary

The receive() function in the contract is missing a check to ensure that msg.value is greater than zero.

Vulnerability Details

The receive() function updates the etherBalance mapping and emits event even when msg.value could be zero. This could allow users to appear as participants without actually paying Ether.

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

Impact

Mark users as participants for free.

Tools Used

Manual review

Recommendations

Check to ensure that msg.value is greater than zero before updating the etherBalance and emitting event.

receive() external payable {
require(msg.value > 0, "Not enough ETH");
etherBalance[msg.sender] += msg.value;
emit NewSignup(msg.sender, msg.value, true);
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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

Give us feedback!