The Rock Paper Scissors game smart contract contains a vulnerability that allows users to perform a Sybil attack by exploiting the token reward mechanism. When a user wins a game with ETH stakes, they receive both the ETH prize and a WinningToken. If the value of this WinningToken exceeds the minimum required ETH bet (minBet
), players can create games and join them with different addresses to farm tokens at a profit, leading to an unfair economic advantage and potential token value dilution.
The vulnerability stems from the following issues:
In the _finishGame
function, lines 609-611, a winning token is minted to the winner of an ETH-based game:
The minBet
value is defined as a constant at 0.01 ETH (line 76):
There's no mechanism to adjust the minBet
value after deployment to align with the market value of the WinningToken.
This creates an economic vulnerability: if the value of 1 WinningToken exceeds 0.02 ETH (accounting for the 10% protocol fee), users can:
Create a game with address A using the minimum bet of 0.01 ETH
Join the same game with address B, also paying 0.01 ETH
Ensure one of their addresses wins the game
Receive back the ETH prize (minus protocol fee) plus 1 WinningToken
Repeat this process to accumulate tokens at a profit
The attack becomes economically viable when:
Value of 1 WinningToken > (2 * minBet * (1 - PROTOCOL_FEE_PERCENT/100))
This vulnerability has several significant impacts:
Token Inflation: Malicious users can mint an excessive number of WinningTokens, potentially devaluing the token.
Economic Imbalance: The attack allows for risk-free acquisition of valuable tokens with minimal ETH investment, creating an unfair advantage.
Protocol Fee Manipulation: While the protocol still collects fees from these self-played games, these fees don't represent genuine game activity.
Game Ecosystem Degradation: An influx of fake games could make it difficult for legitimate players to find real opponents.
Reputation Damage: A visible exploit could damage the platform's reputation and user trust.
The severity is high if the token has or gains significant value, as it would create a direct economic incentive for exploitation.
Manual code review
Economic incentive analysis
Game theory analysis
Dynamic Minimum Bet:
Replace the constant minBet
with a variable that can be adjusted by the admin:
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.