The claimThrone()
function lacks a check to ensure the grace period has not expired. This allows a player to claim the throne even after the current king's time has run out, effectively stealing the win from the rightful king. This vulnerability breaks the game's core rule, which is that the last king standing after the grace period wins the pot.
The king at the end of the grace period is supposed to be the winner.
However, the claimThrone()
function does not verify if the grace period has already expired.
This allows any player to become the new king even after the previous king should have been declared the winner, as long as declareWinner()
has not yet been called.
Likelihood:
A malicious player can intentionally wait for the grace period to expire to steal the throne from the current king just before declareWinner()
is called. This is a clear incentive.
Impact:
This vulnerability undermines the entire point of the game. The rightful winner can be denied their prize, which destroys fairness and trust in the contract.
The following test demonstrates that a player can still claim the throne after the grace period has expired.
Add a require
statement to the claimThrone()
function to ensure that the grace period has not expired. This prevents new claims after the time limit has passed, ensuring the rightful winner can be declared.
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.