The RockPaperScissors
contract has no mechanism to recover tokens that are accidentally sent to the contract address. This includes both the internal WinningToken
and any external ERC20 or ERC721 tokens that might be transferred to the contract by mistake.
The contract handles WinningToken
as part of its normal game operations, but lacks any function that would allow the admin or owner to recover:
Excess WinningToken
tokens that accumulate in the contract due to canceled games, timeouts, or other edge cases
Any other ERC20/ERC721 tokens that users might accidentally send to the contract address
The only token management implemented is the minting of new tokens as rewards. There is no functionality to:
Withdraw tokens that are not part of active games
Recover tokens in case of contract migration or upgrade
Handle tokens sent erroneously to the contract
Unlike ETH, which can be withdrawn through the withdrawFees
function, tokens have no recovery path:
The impact of this vulnerability is moderate as it doesn't directly compromise game mechanics or user funds in active games. However, it does create situations where:
Tokens become permanently locked in the contract
Users who make mistakes cannot recover their assets
In case of contract deprecation, accumulated tokens become unrecoverable
Over time, this could result in significant value being locked in the contract with no way to recover it.
Manual code review
Implement token recovery functions that allow the admin to recover tokens that aren't part of active games:
Additionally, consider implementing a similar function for ERC721 tokens and native ETH recovery for amounts that exceed the accumulatedFees
balance.
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.