Last Man Standing

First Flight #45
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Extra ETH is silently accepted and added to the pot

Silent acceptance of excess ETH in claimThrone leads to unintended pot inflation

Description

  • The Game::claimThrone functions lacks a strict equality check, this allows users to overpay. This may lead to silent ETH loss and incorrect pot inflation.

@> require(msg.value >= claimFee, "Game: Insufficient ETH sent to claim the throne.");

Risk

Likelihood:

  • It is easy for users to accidentally send more ETH

Impact:

  • When users unintentionally send excess ETH, it is added to the pot without refund or warning.

  • Users can lose accidentally sent ETH


Proof of Concept

Add this test to GameTest.t.sol

function test_extra_sent(address user, uint256 claimFee) public {
address safeUser = address(uint160(bound(uint256(uint160(user)), 1, type(uint160).max)));
claimFee = bound(claimFee, 0.1 ether, 1 ether);
vm.deal(safeUser, claimFee);
game.claimThrone{value: claimFee}();
}

Recommended Mitigation

Enforce exact ETH payment.

- require(msg.value >= claimFee, "Game: Insufficient ETH sent to claim the throne.");
+ require(msg.value == claimFee, "Game: Invalid ETH amount sent to claim the throne.");
Updates

Appeal created

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Overpayment not refunded, included in pot, but not in claim fee

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!