The RockPaperScissors contract contains a vulnerability in the _cancelGame()
and _handleTie()
functions where ETH transfers are made directly to player addresses and the transfer validation is carried out on them altogether. If one player's address is a contract that reverts when receiving ETH (e.g., a contract without a fallback or receive function, or one that deliberately reverts), it will cause the entire transaction to fail. This prevents the other legitimate player from receiving their refund, effectively locking funds in the contract.
The problematic pattern looks like this in test:
If the first transfer succeeds but the second one fails, the entire transaction reverts, causing both transfers to fail. This means that if either player is a malicious or incompatible contract, they can prevent both players from receiving their funds.
The impact of this vulnerability is considered to be medium:
A malicious player can deliberately use a contract address that rejects ETH transfers to prevent the other player from receiving their refund intending to undermine the Game by causing a denial of service.
Even non-malicious scenarios, where a player uses a smart contract wallet with improper ETH receiving capabilities, can cause funds to become locked for other players.
The ETH bets become permanently trapped in the RockPaperScissors contract with no extraction mechanism.
Players might lose trust in the game contract due to funds becoming unrecoverable.
Scope: The vulnerability affects game tie scenarios, which are limited but still common outcome in a Rock-Paper-Scissors game.
Foundry
Implement a pull-over-push pattern for ETH refunds:
Store refund amounts in a mapping instead of immediate transfers. Create a separate claimRefund()
function that players can call individually.
Malicious player wins a game using a contract that intentionally reverts when receiving ETH, the entire transaction will fail
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.