The Game::updateGracePeriod(uint256 _newGracePeriod)
function allows the contract owner to arbitrarily change the gracePeriod at any time—even while a game is actively ongoing. Since the grace period determines when a winner can be declared, this function introduces a centralized attack vector where Game::owner()
can manipulate the game outcome in their favor by changing the grace period to suit their purpose
Likelihood:
Owner can change grace period anytime
Impact:
If the owner participates in the game, they can:
Claim the throne (become currentKing)
Reduce the grace period to near-zero
Immediately call Game::declareWinner()
to declare themselves the winner, and gain all the eth in the pot.
This enables the owner to force-win the game
Only allow Game::updateGracePeriod
to be called when there is no active game by adding gameEndedOnly
modifier.
Restrict Game::owner()
so that they can only set initial game parameters before new round starts. Eg Game::owner()
can set initialGracePeriod
not gracePeriod
Restrict Game::owner()
from participating in game by adding the below checker
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.