Normally, when a player wants to claim the throne in the game, the function should ensure that they are not already the king.
However, the contract incorrectly checks that the caller is already the king, which completely blocks the game's functionality from the start since no one is king initially (address(0)
).
Testing
Deploy the contract : currentKing = address(0)
Sam Tries to Claim :
msg.sender = Sam
Check Sam == address(0)?
reverts
Severity: Critical
Likelihood:
This will always occur on initial deployment since currentKing
is initialized to address(0)
Any first-time claim attempt will revert due to the faulty logic
Impact:
The game is completely paralyzed
No one can ever claim the throne
Any ETH sent during failed claim attempts is permanently locked
A redeployment of the contract is necessary to fix the logic
Exploitability: Low (only visible in code)
Initial state: currentKing = address(0)
Call: claimThrone()
by any player will revert because msg.sender != address(0)
Immediate FIx :
After Fix :
Deploy the contract : currentKing = address(0)
Sam Tries to Claim :
msg.sender = Sam
Check Sam != address(0)?
proceeds
Sam becomes the 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.