If there are many players in the game expected prize for the owner may become zero.
The code uses Solidity 0.7.6
. In this version there is no automatic checks for integer over- / underflows. totalFees
is explicitly defined as uint64
which means that every value greater than 18,446,744,073,709,551,615
will result in overflow. Here is the test which shows the exploit:
High. It is easy to calculate, even manually which amount combination of number of players and entrance fee will result in the overflow.
Manual check.
Automatic over- and underflow checks were introduced in Solidity 0.8.0. Use the latest Solidity version. This will require a review of project's dependences as not all of them work with Solidity >= 0.8.0.
Use safe math libraries like the one from OpenZeppelin Math.
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.