claimThrone
Bricks the Game (No One Can Become King)Expected behaviour: claimThrone()
should allow any address that is not the current king to pay claimFee
and become the new king.
Actual issue: the contract uses the comparison msg.sender == currentKing
which reverts unless the caller is already the king. At deployment currentKing
is address(0)
, so the first call (and every subsequent call) fails, making it impossible for the game to start.
Likelihood:
The erroneous require
is executed on every claimThrone
call immediately after deployment
Because currentKing
is address(0)
at deployment, 100 % of first-mover transactions revert
Impact:
No one can ever become king; the core game mechanic is permanently disabled
ETH sent directly to the contract (e.g. via receive()
) becomes locked; downstream functions (declareWinner
, resetGame
) are unreachable, bricking the protocol
The PoC below deploys the vulnerable contract, funds a test account, and shows that any attempt to call claimThrone()
immediately reverts. Running this test therefore proves that the game cannot start in its current form.
Replace the equality check with an inequality check so that only non-kings can claim the throne. The one-line fix below is storage-layout-safe and fully restores intended gameplay.
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.