msg.sender == currentKing blocks throne claimingThe claimThrone function is designed to allow players to claim the throne by sending a sufficient amount of ETH (claimFee). When successful, the player becomes the new king.
However, the following condition incorrectly prevents anyone other than the current king from using the function:
Likelihood:
Occurs always, after the initial king has been established, because no other player appart from the initial one can claim the throne anymore.
Impact:
Game cannot progress, defeating its purpose.
To recreate this vulnerability write the following test in Game.t.sol:
As shown with this text, player1 is unable to claim the throne via claimThrone since the function is reverting due to msg.sender == currentKing requirement
A good mitigation is rewriting the require logic to make sure the player claiming the throne is not the current king.
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.