Bid Beasts

First Flight #49
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: medium
Valid

Integer Division Precision Loss Allows Bids Below Minimum Increment

Root + Impact

Description

  • Bid calculation divides before multiplying, losing precision and allowing bids below the 5% minimum increment.

// in src/BidBeastsNFTMarketPlace.sol:156
requiredAmount = (previousBidAmount / 100) * (100 + S_MIN_BID_INCREMENT_PERCENTAGE);
// @> Division first truncates remainder
For 199 wei: (199/100) * 105 = 1 * 105 = 105 wei (should be 209)

Risk

Likelihood:

  • Happens on every bid not divisible by 100

  • No validation prevents exploitation

Impact:

  • Up to 49% savings on bid increments

  • Bids under 100 wei bypass increment

  • Undermines auction fairness

Proof of Concept

function testPrecisionLoss() public {
// Case 1: Small bids get completely bypassed
uint256 previousBid = 99;
uint256 required = (previousBid / 100) * 105;
assertEq(required, 0); // Should be 104 wei, but got 0!
// Attacker can bid 1 wei instead of 104 wei
// Case 2: Larger bids still lose significant precision
previousBid = 199;
required = (previousBid / 100) * 105;
assertEq(required, 105); // Should be 209, got 105
// Attacker saves 104 wei (nearly 50% discount on increment)
// Case 3: Pattern repeats - 299 wei bid
previousBid = 299;
required = (previousBid / 100) * 105;
assertEq(required, 210); // Should be 314, got 210
// Saves another 104 wei
}

Recommended Mitigation

- requiredAmount = (previousBidAmount / 100) * (100 + S_MIN_BID_INCREMENT_PERCENTAGE);
+ requiredAmount = (previousBidAmount * (100 + S_MIN_BID_INCREMENT_PERCENTAGE)) / 100;
Updates

Lead Judging Commences

cryptoghost Lead Judge 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

BidBeasts Marketplace: Integer Division Precision Loss

Integer division in requiredAmount truncates fractions, allowing bids slightly lower than intended.

cryptoghost Lead Judge 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

BidBeasts Marketplace: Integer Division Precision Loss

Integer division in requiredAmount truncates fractions, allowing bids slightly lower than intended.

Support

FAQs

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

Give us feedback!