The TwentyOne contract, contains several Denial of Service vulnerabilities. These arise primarily from unbounded loops, improper Ether handling, and state-update patterns that violate Solidity best practices.
ìnitializeDeck()function contains a loop that iterates 52 times to populate the player's deck of cards. This operation consumes significant gas, especially when called for multiple players in the same block. If the loop exceeds the block gas limit, the transaction will revert. This could prevent the game from starting for a player, resulting in a DoS.
The call function repeatedly invokes dealersHand within a while loop. Each invocation iterates over the dealer's cards, leading to potential hitting the block gas limit as the number of dealer cards increases, potentially locking players out of completing their games.
Players may be unable to start or complete games due to gas exhaustion caused by unbounded loops.
Manual Review
Replace the unbounded loop in initializeDeck with a predefined deck stored in storage or calldata:
Cache the result of dealersHand to avoid repeated iterations
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.