Severity: High
The enterRaffle() function at PuppyRaffle.sol:82 checks that msg.value matches the total entrance fee:
Since Solidity 0.7.6 has no built-in overflow protection, the multiplication entranceFee * newPlayers.length can overflow uint256 and wrap back to a small value or zero. An attacker can craft a newPlayers array length such that the product overflows to exactly match a small msg.value (including zero), entering many players for free.
With lower entrance fees, the attacker needs a longer array, but the principle holds: for any entranceFee > 0, there exists a newPlayers.length that causes entranceFee * newPlayers.length to overflow to zero.
Impact: High — attacker enters unlimited players for free, gaining unfair advantage in the raffle. They can also immediately refund() all entries to extract ETH from the contract.
Likelihood: Medium — requires a specific array length to trigger the overflow, but the computation is trivial off-chain.
Use SafeMath or check for overflow at PuppyRaffle.sol:82:
Alternatively, upgrade to Solidity >=0.8.0 where arithmetic overflow reverts by default.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.