The Game::updatePlatformFeePercentage()
function allows the contract owner to set the platformFeePercentage
at any time whether a game is active or not, up to 100%. Combined with the fee calculation logic in Game::claimThrone()
, this creates a vulnerability:
When a player claims the throne, the platformFeePercentage
is applied to the full msg.value
to get the currentPlatformFee
.
There is a defensive check to ensure the platformFee
doesn’t exceed the difference between sentAmount
and previousKingPayout
, but previousKingPayout
is always 0, therefore currentPlatformFee
== sentAmount
This means that Game::owner()
can collect 100% of the ETH sent, and nothing goes to the pot.
This creates an honey pot, where all funds go to the owner.
Likelihood:
Reason 1: owner can update the platformFeeParameter at anytime during the game;
Impact:
Owner can continuously extract 100% of every throne claim fee.
Game becomes a honeypot: participants think they're contributing to the pot, but all funds go to the owner.
Restrict Game::updatePlatformFeePercentage()
such that it can only be called when a game is not active/before the start of a new game. Eg by adding gameEndedOnly
modifier.
or by adding a check to see if the grace period has successfully elapsed
Set the Game::platformFeePercentage
within reasonable limits, e.g (0-20%) so that the check below in Game::claimThrone()
is not triggered.
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.