Description: From the README, it states that "A player must deposit 1 ETH to play, with a maximum payout of 2 ETH upon winning." However, the startGame function contains a check to ensure that >= 1 ETH is sent. Additionally, the endGame function fixes the payout at 2 ETH, meaning that
This means that a player could start the game by sending in > 1 ETH, and will only get 2 ETH upon winning.
Impact: This creates situations where the player can win, but still end up losing money, breaking the protocol functionality
Proof of Concept:
The player bets 10 ETH, either by accident or assuming that the payout for winning will be 20 ETH.
Player wins the game
Player gets credited 2 ETH instead of the expected 20ETH, resulting in the player losing money despite winning
Proof of Code
Insert the following in TwentyOne.t.sol
Recommended Mitigation: Include a check for bets that exceed 1 ETH
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.