In RockPaperScissors::_handleTie
function refund amount is sent by call
to the players.
This instance is also present in RockPaperScissors::_cancelGame
and RockPaperScissors::_finishGame
Any player can join via a malicious contract that doesn't implement a fallback
or receive
function in the contract will revert when sending ETH via call
This vulnerability will lead to ETH
being stuck forever in the contract, leading to loss of fund for both the player.
Proof Of Code
Add this block of code in the RockPaperScissors.t.sol
as a new contract
Also add the following test in RockPaperScissors
contract and test, here I have taken the example of RockPaperScissors::_cancelGame
This impacts the protocol severly, as honest players loose their bet due to malicious actors joining the game. Directly leading to loss of funds deposited as bet.
Foundry test suites.
There are several ways to mitigate this issue.
It is recommended to consider the refund to be collected manually by the players.
Consider setting a grace period and creating an admin function to recover stuck funds after the grace period is expired.
ETH sent directly to the contract via the receive function or after a canceled game becomes permanently locked
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.