The Last Man Standing game has a vulnerability in its claimThrone()
function where the previous king payout logic is declared but never implemented. According to the function's documentation comment, a portion of the new claim fee should be sent to the previous king, but this functionality is completely missing from the implementation.
When a new player claims the throne, a portion of their claim fee should be sent to the previous king as a consolation prize, as described in the function's comment: "If there's a previous king, a small portion of the new claim fee is sent to them."
The variable previousKingPayout
is declared and initialized to 0, but it's never updated or used to transfer any ETH to the previous king. Instead, the entire claim fee (minus the platform fee) goes directly to the pot.
The vulnerability exists in the claimThrone()
function where the payout logic is missing:
The code declares previousKingPayout
but never calculates or transfers any ETH to the previous king. Additionally, there are references to this variable in the defensive check for platform fees, suggesting that the payout logic was intended but not implemented.
The impact is medium because:
It breaks a promised feature of the game (compensating previous kings)
It changes the economic incentives for players
It could reduce player engagement as there's no consolation prize for being dethroned
The likelihood is high as this issue affects every throne claim after the first one. It's not an edge case but a core feature that's completely missing.
The issue can be verified by examining the claimThrone()
function in Game.sol. The variable previousKingPayout
is declared but never assigned any value other than 0, and there's no logic to transfer ETH to the previous king.
Implement the missing previous king payout logic:
The fix adds logic to:
Calculate a payout for the previous king (e.g., 10% of the claim amount)
Transfer this amount to the previous king's address
Adjust the pot calculation to account for this payout
This ensures that previous kings receive a consolation prize as described in the function's documentation, creating a more balanced economic model for the game.
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.