The endGame()
function allows the owner to end the game at any time, regardless of the scheduled endTime
. The function lacks checks to prevent premature termination, which introduces centralization risks, disrupts fairness and also user trust.
Vulnerable Contract: EggHuntGame.sol
Vulnerable Function: endGame()
The owner can call endGame()
at any time, even before the scheduled endTime
.
If rewards are time-based, an early and premature ending of the game could place participants at a disadvantage, as players may rely on endTime
to strategize while playing.
The owner could end the game when certain players are winning, preventing them from claiming rewards.
An untimely termination of the game undermines the confidence of players in the game's integrity.
Solidity
Foundry forge
Manual Review
Test Case: test_OwnerCanEndGame
Add the following code to the EggHuntGameTest.t.sol
file
When you run forge test --match-test test_OwnerCanEndGame
, the test should pass.
Modify the endGame()
function to prevent premature ending by adding a timestamp check.
Owner is trusted and is not expected to interact in ways that would compromise security
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.