Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Invalid

No Check for Time Expiry in endGame(), since endgame fuction is not clear, for security purpose or just end game

Summary

Since endgame function is not clear, for security purpose or just to end the game. The endGame() function does not check whether the game's scheduled endTime has passed before allowing the game to be ended. This allows the owner to end the game prematurely, before the game has reached the designated end time.

Vulnerability Details

The issue arises because the endGame() function does not verify if the current time (block.timestamp) is greater than or equal to the endTime. This means the owner can call endGame() at any point, even before the game is meant to end, potentially leading to unfair or unintended game behavior.

function endGame() external onlyOwner {
require(gameActive, "Game not active");
gameActive = false;
emit GameEnded(block.timestamp);
}

Impact

  • The owner can prematurely end the game, disrupting game flow and creating unfair scenarios for players.

  • Users may feel the game is not being handled fairly if it ends too early.

Tools Used

Manual review

Recommendations

Implement a check to ensure that block.timestamp >= endTime before allowing the game to be ended. This ensures that the game can only be ended after the designated time.

Updates

Lead Judging Commences

m3dython Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

Trusted Owner

Owner is trusted and is not expected to interact in ways that would compromise security

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.