Denial of Service can occur for a player when their opponent fails to receive funds. The player will be unable to cancel/tie the game, therefore the player will be unable to be refunded ETH.
The functions RockPaperScissors::_handleTie(uint256 _gameId)
and RockPaperScissors::_cancelGame(uint256 _gameId)
contain external calls to the addresses of both players.
A problem arises when a call to one of the players fails.
Let's examine the following code from _cancelGame
which attempts to refund both players:
If successA
is false, then the logic for refunding playerB is never reached. Likewise, if successB
is false, then the transaction is reverted and playerA is not refunded.
A player will be unable to cancel or tie their game if the other player fails to receive their funds. This means that a malicious actor could utilize a Smart Contract to revert the transaction upon receiving the funds, effectively locking the ETH that was bet by both players.
Manual Review.
It is recommended to simply change the game state to Cancelled
or Finished
in _cancelGame
and _handleTie
respectively. Afterwards, it is recommended implement a separate function allowing players to withdraw their refunds individually.
Malicious player wins a game using a contract that intentionally reverts when receiving ETH, the entire transaction will fail
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.