Faulty access control condition in
Game::claimThrone, causing a Functional Denial of Service to the Contract.
The claimThrone function is designed to allow any new player to claim the throne by sending an amount of ETH that meets or exceeds the required claimFee. When a player successfully calls this function, they become the new currentKing, the pot increases by the sent amount.
The claimThrone function contains a faulty access control condition that incorrectly requires msg.sender to already be the currentKing in order to claim the throne. This prevents any new player from participating, effectively locking the game and causing a functional denial of service.
Likelihood:
This issue will occur every time a new player attempts to call claimThrone, since the require(msg.sender == currentKing) condition blocks anyone who is not already the current king. This includes the very first player after deployment.
Because the currentKing is initially set to a zero address (or unset), no user can ever meet the condition unless manually set, which causes the game to remain unusable from the beginning and indefinitely.
Impact:
The claimThrone function becomes completely inaccessible to all users, including the first intended player, rendering the core game logic unusable.
This causes a functional Denial of Service (DoS) to the entire contract, as no game round can ever be initiated, leading to a total loss of utility for both players and the contract owner.
First Player Tries to claim throne and pay the initial claim fee
Gets an error that he is already king and doesn't need to reclaim
Place the following into the Game.t.sol
Replace the incorrect access control check which will allow new players to claim the throne, while preventing the current king from reclaiming their own position unnecessarily.
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.