Location: cancelGame()
, createGameWithEth()
, createGameWithToken()
The RockPaperScissors
contract allows playerA to create games and later cancel them via cancelGame. There's no restriction on how many games can be created. Since the _gameId
is a sequential uint256, an attacker can pre-fill a large number of game IDs with cheap games (using minimum ETH/token) and then cancel them, effectively reserving/bloating valuable game IDs and increasing lookup/storage costs.
Storage Griefing / Denial of Access to Legitimate Game IDs
a. Storage griefing.
b. Game ID space bloating.
c. Potential gas cost increase for legitimate players.
d. Difficulties in game discovery/tracking.
Impose a cap on the number of pending or cancelled games per user.
Consider using a mapping indexed by (playerA, nonce) instead of a global incrementor.
Implement cleanup logic for stale/cancelled games.
Manual review
Code suggestions or observations that do not pose a direct security risk.
Code suggestions or observations that do not pose a direct security risk.
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.