Last Man Standing

First Flight #45
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Impact: medium
Likelihood: low
Invalid

Potential Integer Overflow in Fee Calculations

Description:
The fee for each new claim is updated via

claimFee = claimFee + (claimFee * feeIncreasePercentage) / 100;

If many claims occur with a high feeIncreasePercentage, this multiplication can overflow and revert, halting the game.

Impact:

  • Denial of Service: Once an overflow occurs, no further claims can be made.

  • Locked Pot: The game becomes unplayable, and funds sit idle.

Proof of Concept:

function testPotentialFeeOverflow() public {
// Deploy with high initial fee and increase percentage
vm.prank(deployer);
Game overflowGame = new Game(
type(uint256).max / 2, // Very high initial fee
GRACE_PERIOD,
100, // 100% increase each time
PLATFORM_FEE_PERCENTAGE
);
// This would eventually overflow if the logic was fixed and multiple claims were made
uint256 currentFee = overflowGame.claimFee();
// Calculate what would happen after fee increase
uint256 nextFee = currentFee + (currentFee * 100) / 100; // 100% increase
// This demonstrates the potential for overflow
assertGt(nextFee, currentFee); // Would fail if overflow occurred
}

Mitigation:

  • Impose an upper cap on claimFee to prevent overflows.

  • Use a checked-math pattern or revert with a clear error when claimFee would exceed a safe maximum.

  • Alternatively, switch to a fixed-increment model rather than percentage growth.

Updates

Appeal created

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!