Description:
Although the game logic specifies that a player can only start with exactly 1 ETH and win double that amount if victorious, the contract currently allows players to send more than 1 ETH when calling startGame(). Any excess ETH sent is not accounted for or refunded, resulting in the player losing the additional funds, even if they win.
Impact:
Players who inadvertently send more than 1 ETH will lose the excess amount, leading to financial losses.
This could harm the contract's reputation, reducing player trust and deterring users from engaging with the game.
ewer players might participate, negatively affecting the adoption and success of the game.
Proof of Concept:
Add this POC to TwentyOne.t.sol
Run the command :
Notice the player entered with 5 ETH and although he win he get only 2 ETH as balance and instead it should be 6.
Recommended Mitigation:
Restrict the game start to exactly 1 ETH and reject transactions with any other amount.
Alternatively, refund any excess ETH to the sender:
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.