Last Man Standing

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

No one is able to participate in the game

Root + Impact

Description

Function Game::claimThrone has an incorrect validation that does not allow anyone to participate in the game.

Risk

Likelihood: High

  • The function does not allow anyone to participate

Impact: High

  • The contract does not work

Proof of Concept

Function claimThrone has the validation below:

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

This validation only allows the current king to call the function. Since currentKing is 0 after the contract initialization, the function will always revert since msg.sender cannot be 0.

Recommended Mitigation

Fix the validation:

-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 4 months 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.

Give us feedback!