Last Man Standing

First Flight #45
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Logic Flaw in claimThrone() Allows Only Current King to Reclaim – Blocks All Other Players

Root + Impact

Description

  • the claimThrone() function allows any player (except the current king) to become the new king by paying a claim fee.

  • the current logic only allows the current king to call the function, preventing all other players from claiming the throne.

@> require(msg.sender == currentKing, "Game: You are already the king. No need to re-claim.");

Risk

Likelihood:

  • Triggered whenever a player (other than the current king) attempts to claim the throne.

  • This action is part of the intended game flow, so the issue is easily triggered during normal use.

Impact:

  • Breaks core game logic: only the current king can call claimThrone(), which defeats the purpose of the game.

  • Loss of functionality and user funds if others send ETH expecting to claim the throne.

Proof of Concept

// Assume Hulk is the current king
address currentKing = address(0xA11CE);
address newPlayer = address(0xBEEF);
// New player attempts to claim the throne
vm.prank(newPlayer);
vm.deal(newPlayer, 1 ether);
game.claimThrone{value: 1 ether}();
// Reverts with:
// "Game: You are already the king."

Recommended Mitigation

- require(msg.sender == currentKing, "Game: You are already the king. No need to re-claim.");
+ require(msg.sender != currentKing, "Game: You are already the king. No need to re-claim.");
Updates

Appeal created

inallhonesty Lead Judge 9 days ago
Submission Judgement Published
Validated
Assigned finding tags:

Game::claimThrone `msg.sender == currentKing` check is busted

Support

FAQs

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