Rock Paper Scissors

First Flight #38
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Received ETH cannot be withdrawn from contract

Summary

All ETH that is sent to the RockPaperScissors contract via RockPaperScissors::receive() can never be withdrawn.

Vulnerability Details

It is intended that the RockPaperScissors contract is able to accept ETH via receive() however the admin is only able to withdraw from the pot of accumulated fees.

The admin cannot withdraw ETH accepted via RockPaperScissors::receive() because its amount was not added to the accumulated fees.

Impact

Funds that are sent to the RockPaperScissors contract via RockPaperScissors::receive() will be locked in the contract and are effectively lost forever.

Tools Used

Manual Review.

Recommendations

Simply add the received amount to accumulatedFees in order to allow the admin to withdraw received ETH:

receive() external payable {
accumulatedFees += msg.value; // SOLUTION: add this line!
}
Updates

Appeal created

m3dython Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Orphaned ETH due to Unrestricted receive() or Canceled Game

ETH sent directly to the contract via the receive function or after a canceled game becomes permanently locked

Support

FAQs

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