The EggHuntGame
contract contains a critical vulnerability in the endGame()
function, allowing the contract owner to prematurely terminate the game at any time, even before the pre-set duration ends. This undermines the game's fairness and trustworthiness.
Description: The endGame()
function is restricted to the contract owner (onlyOwner
), but it lacks a time-based validation to ensure the game can only end after its natural duration. This allows the owner to terminate the game before the endTime
, disrupting player expectations and potentially manipulating outcomes.
Code Location:
Exploitation:
The owner can call endGame()
even if the game is still active (e.g., before endTime
).
This bypasses the game's pre-set duration, violating the intended rules .
Exploitation Risks:
The owner can end the game early to prevent players from earning rewards.
Manipulate game outcomes (e.g., stopping the game before a player wins).
Trust Loss: Users may lose confidence in the contract's fairness and transparency.
Static code analysis (e.g., Slither).
Manual review of control flow and ownership privileges.
Enforce Time-Based Validation:
Modify endGame()
to only allow termination after the endTime
or during an emergency with additional safeguards.
Emergency Pause Mechanism:
If early termination is necessary (e.g., security issues), implement a timelock or multi-signature approval .
Documentation:
Clarify the game’s rules and owner privileges to align expectations with the code’s behavior .
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.