The TwentyOne
contract contains a vulnerability in the startGame
function that allows users to inadvertently lose any Ether they send above 1 Ether. This vulnerability can result in the loss of funds for users.
The startGame
function allows users to start a game by sending Ether. However, the current logic only checks that the sent value (msg.value
) is at least 1 Ether, without accounting for larger amounts. As a result, any Ether sent above 1 Ether is neither accounted for nor refunded, leading to a potential loss for the user.
The impact of this vulnerability is significant, as users sending more than 1 Ether will lose any extra amount sent. This can result in loss of funds and a poor user experience, as well as potential damage to the reputation of the contract and its developers.
To identify this vulnerability, the following tools and techniques were used:
Manual Code Review: Analyzing the contract line by line to identify logic and potential errors.
Foundry
To fix this vulnerability, it is recommended to update the startGame
function to only accept exactly 1 Ether and return any excess sent. This can be achieved by updating the verification logic and adjusting the value of msg.value
.
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.