gracePeriod
mid game.Description:
Parameters set for a game should not be altered during the game. The deployer can update gracePeriod
mid-game. This could potentially cause confusion and disruption of the protocol. A malicious deployer could use this to manipulate the outcome of a game, allowing the current king to gain an advantage.
Impact: Medium
While no funds are directly at risk, many players could be put at a disadvantage, especially if the new grace period is set to a short amount.
Likelihood: Medium
There are no checks on being able to change the gracePeriod
parameter only when the game is not active.
Proof of Concept:
Create a game with a one-day grace period
VM.warp 1 hour
Deployer updates grace period to 1 hour
The game is now over
Proof of Code:
Paste the below code into Game.t.sol
.
Here is the output after running:
"forge test --mt test_CanGracePeriodUpdateMidGame -vv"
Recommended Mitigation:
I would recommend adding the gameEndedOnly
modifier to game::updateGracePeriod
. This would prevent the deployer from updating the grace period while a game is ongoing!
Here is how to make the change:
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.