The updateGracePeriod()
function allows the owner to modify the grace period at any time during an active game, without any restrictions or timelock mechanisms. This creates a critical governance vulnerability where the owner can manipulate game outcomes to their advantage.
The function lacks any checks for:
Whether the game is currently active
Whether the current grace period has already expired
Any minimum/maximum bounds on the new grace period
Any timelock or delay mechanisms
Scenario 1 - Delaying winner declaration:
Game is active with King A, grace period is 24 hours
23 hours pass, King A is about to win
Owner calls updateGracePeriod(86400 * 365)
(1 year)
King A's victory is indefinitely delayed
Scenario 2 - Forcing immediate winner:
Game is active with multiple players competing
Owner's preferred player becomes king
Owner calls updateGracePeriod(1)
(1 second)
Owner immediately calls declareWinner()
to fix their preferred winner
Scenario 3 - Post-expiry manipulation:
Grace period expires, King A should win
Before anyone calls declareWinner()
, owner increases grace period
More players can claim throne, changing the rightful winner
Owner can arbitrarily decide game winners regardless of legitimate gameplay
Change this line in claimThore()
for sucessful test run
Put this into Game.t.sol
file and run forge test --mt testOwnerCanChangeGracePeriodWhenGameIsActive -vvv
Restrict updates during active games:
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.