The endGame
function in the EggHuntGame
contract allows the game owner to end the egg hunt at any time while the game is active, which can cause unexpected behavior that affect multiple users, even if they don’t result in a direct loss of funds.
https://github.com/CodeHawks-Contests/2025-04-eggstravaganza/blob/main/src/EggHuntGame.sol#L51
Manual and Visual Code Inspection.
Forge Test
Test the endGame
function to end earlier than endTime
:
The test passes and owner succeeded in ending the game prematurely
This vulnerability enables the owner to prematurely terminate the game, which can:
Prevent players from continuing to find eggs within the expected timeframe.
Disrupt gameplay and reduce fairness for participants.
Violate trust assumptions about game integrity.
Potentially result in fewer NFTs being minted or collected than players anticipated.
While no funds are at risk, the fairness and core logic of the NFT-based game are significantly compromised.
Update the endGame
function to enforce that the current block timestamp has reached or passed the declared endTime
:
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.